Passed
Push — master ( c30ced...7519a9 )
by Morris
20:39 queued 08:45
created
lib/private/Files/FileInfo.php 1 patch
Indentation   +368 added lines, -368 removed lines patch added patch discarded remove patch
@@ -38,372 +38,372 @@
 block discarded – undo
38 38
 use OCP\IUser;
39 39
 
40 40
 class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
41
-	/**
42
-	 * @var array $data
43
-	 */
44
-	private $data;
45
-
46
-	/**
47
-	 * @var string $path
48
-	 */
49
-	private $path;
50
-
51
-	/**
52
-	 * @var \OC\Files\Storage\Storage $storage
53
-	 */
54
-	private $storage;
55
-
56
-	/**
57
-	 * @var string $internalPath
58
-	 */
59
-	private $internalPath;
60
-
61
-	/**
62
-	 * @var \OCP\Files\Mount\IMountPoint
63
-	 */
64
-	private $mount;
65
-
66
-	/**
67
-	 * @var IUser
68
-	 */
69
-	private $owner;
70
-
71
-	/**
72
-	 * @var string[]
73
-	 */
74
-	private $childEtags = [];
75
-
76
-	/**
77
-	 * @var IMountPoint[]
78
-	 */
79
-	private $subMounts = [];
80
-
81
-	private $subMountsUsed = false;
82
-
83
-	/**
84
-	 * The size of the file/folder without any sub mount
85
-	 *
86
-	 * @var int
87
-	 */
88
-	private $rawSize = 0;
89
-
90
-	/**
91
-	 * @param string|boolean $path
92
-	 * @param Storage\Storage $storage
93
-	 * @param string $internalPath
94
-	 * @param array|ICacheEntry $data
95
-	 * @param \OCP\Files\Mount\IMountPoint $mount
96
-	 * @param \OCP\IUser|null $owner
97
-	 */
98
-	public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) {
99
-		$this->path = $path;
100
-		$this->storage = $storage;
101
-		$this->internalPath = $internalPath;
102
-		$this->data = $data;
103
-		$this->mount = $mount;
104
-		$this->owner = $owner;
105
-		$this->rawSize = $this->data['size'] ?? 0;
106
-	}
107
-
108
-	public function offsetSet($offset, $value) {
109
-		$this->data[$offset] = $value;
110
-	}
111
-
112
-	public function offsetExists($offset) {
113
-		return isset($this->data[$offset]);
114
-	}
115
-
116
-	public function offsetUnset($offset) {
117
-		unset($this->data[$offset]);
118
-	}
119
-
120
-	public function offsetGet($offset) {
121
-		if ($offset === 'type') {
122
-			return $this->getType();
123
-		} else if ($offset === 'etag') {
124
-			return $this->getEtag();
125
-		} else if ($offset === 'size') {
126
-			return $this->getSize();
127
-		} else if ($offset === 'mtime') {
128
-			return $this->getMTime();
129
-		} elseif ($offset === 'permissions') {
130
-			return $this->getPermissions();
131
-		} elseif (isset($this->data[$offset])) {
132
-			return $this->data[$offset];
133
-		} else {
134
-			return null;
135
-		}
136
-	}
137
-
138
-	/**
139
-	 * @return string
140
-	 */
141
-	public function getPath() {
142
-		return $this->path;
143
-	}
144
-
145
-	/**
146
-	 * @return \OCP\Files\Storage
147
-	 */
148
-	public function getStorage() {
149
-		return $this->storage;
150
-	}
151
-
152
-	/**
153
-	 * @return string
154
-	 */
155
-	public function getInternalPath() {
156
-		return $this->internalPath;
157
-	}
158
-
159
-	/**
160
-	 * Get FileInfo ID or null in case of part file
161
-	 *
162
-	 * @return int|null
163
-	 */
164
-	public function getId() {
165
-		return isset($this->data['fileid']) ? (int)  $this->data['fileid'] : null;
166
-	}
167
-
168
-	/**
169
-	 * @return string
170
-	 */
171
-	public function getMimetype() {
172
-		return $this->data['mimetype'];
173
-	}
174
-
175
-	/**
176
-	 * @return string
177
-	 */
178
-	public function getMimePart() {
179
-		return $this->data['mimepart'];
180
-	}
181
-
182
-	/**
183
-	 * @return string
184
-	 */
185
-	public function getName() {
186
-		return isset($this->data['name']) ? $this->data['name'] : basename($this->getPath());
187
-	}
188
-
189
-	/**
190
-	 * @return string
191
-	 */
192
-	public function getEtag() {
193
-		$this->updateEntryfromSubMounts();
194
-		if (count($this->childEtags) > 0) {
195
-			$combinedEtag = $this->data['etag'] . '::' . implode('::', $this->childEtags);
196
-			return md5($combinedEtag);
197
-		} else {
198
-			return $this->data['etag'];
199
-		}
200
-	}
201
-
202
-	/**
203
-	 * @return int
204
-	 */
205
-	public function getSize($includeMounts = true) {
206
-		if ($includeMounts) {
207
-			$this->updateEntryfromSubMounts();
208
-			return isset($this->data['size']) ? 0 + $this->data['size'] : 0;
209
-		} else {
210
-			return $this->rawSize;
211
-		}
212
-	}
213
-
214
-	/**
215
-	 * @return int
216
-	 */
217
-	public function getMTime() {
218
-		$this->updateEntryfromSubMounts();
219
-		return (int) $this->data['mtime'];
220
-	}
221
-
222
-	/**
223
-	 * @return bool
224
-	 */
225
-	public function isEncrypted() {
226
-		return $this->data['encrypted'];
227
-	}
228
-
229
-	/**
230
-	 * Return the currently version used for the HMAC in the encryption app
231
-	 *
232
-	 * @return int
233
-	 */
234
-	public function getEncryptedVersion() {
235
-		return isset($this->data['encryptedVersion']) ? (int) $this->data['encryptedVersion'] : 1;
236
-	}
237
-
238
-	/**
239
-	 * @return int
240
-	 */
241
-	public function getPermissions() {
242
-		$perms = (int) $this->data['permissions'];
243
-		if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
244
-			$perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
245
-		}
246
-		return (int) $perms;
247
-	}
248
-
249
-	/**
250
-	 * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
251
-	 */
252
-	public function getType() {
253
-		if (!isset($this->data['type'])) {
254
-			$this->data['type'] = ($this->getMimetype() === 'httpd/unix-directory') ? self::TYPE_FOLDER : self::TYPE_FILE;
255
-		}
256
-		return $this->data['type'];
257
-	}
258
-
259
-	public function getData() {
260
-		return $this->data;
261
-	}
262
-
263
-	/**
264
-	 * @param int $permissions
265
-	 * @return bool
266
-	 */
267
-	protected function checkPermissions($permissions) {
268
-		return ($this->getPermissions() & $permissions) === $permissions;
269
-	}
270
-
271
-	/**
272
-	 * @return bool
273
-	 */
274
-	public function isReadable() {
275
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
276
-	}
277
-
278
-	/**
279
-	 * @return bool
280
-	 */
281
-	public function isUpdateable() {
282
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
283
-	}
284
-
285
-	/**
286
-	 * Check whether new files or folders can be created inside this folder
287
-	 *
288
-	 * @return bool
289
-	 */
290
-	public function isCreatable() {
291
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
292
-	}
293
-
294
-	/**
295
-	 * @return bool
296
-	 */
297
-	public function isDeletable() {
298
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
299
-	}
300
-
301
-	/**
302
-	 * @return bool
303
-	 */
304
-	public function isShareable() {
305
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
306
-	}
307
-
308
-	/**
309
-	 * Check if a file or folder is shared
310
-	 *
311
-	 * @return bool
312
-	 */
313
-	public function isShared() {
314
-		$sid = $this->getStorage()->getId();
315
-		if (!is_null($sid)) {
316
-			$sid = explode(':', $sid);
317
-			return ($sid[0] === 'shared');
318
-		}
319
-
320
-		return false;
321
-	}
322
-
323
-	public function isMounted() {
324
-		$storage = $this->getStorage();
325
-		if ($storage->instanceOfStorage('\OCP\Files\IHomeStorage')) {
326
-			return false;
327
-		}
328
-		$sid = $storage->getId();
329
-		if (!is_null($sid)) {
330
-			$sid = explode(':', $sid);
331
-			return ($sid[0] !== 'home' and $sid[0] !== 'shared');
332
-		}
333
-
334
-		return false;
335
-	}
336
-
337
-	/**
338
-	 * Get the mountpoint the file belongs to
339
-	 *
340
-	 * @return \OCP\Files\Mount\IMountPoint
341
-	 */
342
-	public function getMountPoint() {
343
-		return $this->mount;
344
-	}
345
-
346
-	/**
347
-	 * Get the owner of the file
348
-	 *
349
-	 * @return \OCP\IUser
350
-	 */
351
-	public function getOwner() {
352
-		return $this->owner;
353
-	}
354
-
355
-	/**
356
-	 * @param IMountPoint[] $mounts
357
-	 */
358
-	public function setSubMounts(array $mounts) {
359
-		$this->subMounts = $mounts;
360
-	}
361
-
362
-	private function updateEntryfromSubMounts() {
363
-		if ($this->subMountsUsed) {
364
-			return;
365
-		}
366
-		$this->subMountsUsed = true;
367
-		foreach ($this->subMounts as $mount) {
368
-			$subStorage = $mount->getStorage();
369
-			if ($subStorage) {
370
-				$subCache = $subStorage->getCache('');
371
-				$rootEntry = $subCache->get('');
372
-				$this->addSubEntry($rootEntry, $mount->getMountPoint());
373
-			}
374
-		}
375
-	}
376
-
377
-	/**
378
-	 * Add a cache entry which is the child of this folder
379
-	 *
380
-	 * Sets the size, etag and size to for cross-storage childs
381
-	 *
382
-	 * @param array|ICacheEntry $data cache entry for the child
383
-	 * @param string $entryPath full path of the child entry
384
-	 */
385
-	public function addSubEntry($data, $entryPath) {
386
-		$this->data['size'] += isset($data['size']) ? $data['size'] : 0;
387
-		if (isset($data['mtime'])) {
388
-			$this->data['mtime'] = max($this->data['mtime'], $data['mtime']);
389
-		}
390
-		if (isset($data['etag'])) {
391
-			// prefix the etag with the relative path of the subentry to propagate etag on mount moves
392
-			$relativeEntryPath = substr($entryPath, strlen($this->getPath()));
393
-			// attach the permissions to propagate etag on permision changes of submounts
394
-			$permissions = isset($data['permissions']) ? $data['permissions'] : 0;
395
-			$this->childEtags[] = $relativeEntryPath . '/' . $data['etag'] . $permissions;
396
-		}
397
-	}
398
-
399
-	/**
400
-	 * @inheritdoc
401
-	 */
402
-	public function getChecksum() {
403
-		return $this->data['checksum'];
404
-	}
405
-
406
-	public function getExtension(): string {
407
-		return pathinfo($this->getName(), PATHINFO_EXTENSION);
408
-	}
41
+    /**
42
+     * @var array $data
43
+     */
44
+    private $data;
45
+
46
+    /**
47
+     * @var string $path
48
+     */
49
+    private $path;
50
+
51
+    /**
52
+     * @var \OC\Files\Storage\Storage $storage
53
+     */
54
+    private $storage;
55
+
56
+    /**
57
+     * @var string $internalPath
58
+     */
59
+    private $internalPath;
60
+
61
+    /**
62
+     * @var \OCP\Files\Mount\IMountPoint
63
+     */
64
+    private $mount;
65
+
66
+    /**
67
+     * @var IUser
68
+     */
69
+    private $owner;
70
+
71
+    /**
72
+     * @var string[]
73
+     */
74
+    private $childEtags = [];
75
+
76
+    /**
77
+     * @var IMountPoint[]
78
+     */
79
+    private $subMounts = [];
80
+
81
+    private $subMountsUsed = false;
82
+
83
+    /**
84
+     * The size of the file/folder without any sub mount
85
+     *
86
+     * @var int
87
+     */
88
+    private $rawSize = 0;
89
+
90
+    /**
91
+     * @param string|boolean $path
92
+     * @param Storage\Storage $storage
93
+     * @param string $internalPath
94
+     * @param array|ICacheEntry $data
95
+     * @param \OCP\Files\Mount\IMountPoint $mount
96
+     * @param \OCP\IUser|null $owner
97
+     */
98
+    public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) {
99
+        $this->path = $path;
100
+        $this->storage = $storage;
101
+        $this->internalPath = $internalPath;
102
+        $this->data = $data;
103
+        $this->mount = $mount;
104
+        $this->owner = $owner;
105
+        $this->rawSize = $this->data['size'] ?? 0;
106
+    }
107
+
108
+    public function offsetSet($offset, $value) {
109
+        $this->data[$offset] = $value;
110
+    }
111
+
112
+    public function offsetExists($offset) {
113
+        return isset($this->data[$offset]);
114
+    }
115
+
116
+    public function offsetUnset($offset) {
117
+        unset($this->data[$offset]);
118
+    }
119
+
120
+    public function offsetGet($offset) {
121
+        if ($offset === 'type') {
122
+            return $this->getType();
123
+        } else if ($offset === 'etag') {
124
+            return $this->getEtag();
125
+        } else if ($offset === 'size') {
126
+            return $this->getSize();
127
+        } else if ($offset === 'mtime') {
128
+            return $this->getMTime();
129
+        } elseif ($offset === 'permissions') {
130
+            return $this->getPermissions();
131
+        } elseif (isset($this->data[$offset])) {
132
+            return $this->data[$offset];
133
+        } else {
134
+            return null;
135
+        }
136
+    }
137
+
138
+    /**
139
+     * @return string
140
+     */
141
+    public function getPath() {
142
+        return $this->path;
143
+    }
144
+
145
+    /**
146
+     * @return \OCP\Files\Storage
147
+     */
148
+    public function getStorage() {
149
+        return $this->storage;
150
+    }
151
+
152
+    /**
153
+     * @return string
154
+     */
155
+    public function getInternalPath() {
156
+        return $this->internalPath;
157
+    }
158
+
159
+    /**
160
+     * Get FileInfo ID or null in case of part file
161
+     *
162
+     * @return int|null
163
+     */
164
+    public function getId() {
165
+        return isset($this->data['fileid']) ? (int)  $this->data['fileid'] : null;
166
+    }
167
+
168
+    /**
169
+     * @return string
170
+     */
171
+    public function getMimetype() {
172
+        return $this->data['mimetype'];
173
+    }
174
+
175
+    /**
176
+     * @return string
177
+     */
178
+    public function getMimePart() {
179
+        return $this->data['mimepart'];
180
+    }
181
+
182
+    /**
183
+     * @return string
184
+     */
185
+    public function getName() {
186
+        return isset($this->data['name']) ? $this->data['name'] : basename($this->getPath());
187
+    }
188
+
189
+    /**
190
+     * @return string
191
+     */
192
+    public function getEtag() {
193
+        $this->updateEntryfromSubMounts();
194
+        if (count($this->childEtags) > 0) {
195
+            $combinedEtag = $this->data['etag'] . '::' . implode('::', $this->childEtags);
196
+            return md5($combinedEtag);
197
+        } else {
198
+            return $this->data['etag'];
199
+        }
200
+    }
201
+
202
+    /**
203
+     * @return int
204
+     */
205
+    public function getSize($includeMounts = true) {
206
+        if ($includeMounts) {
207
+            $this->updateEntryfromSubMounts();
208
+            return isset($this->data['size']) ? 0 + $this->data['size'] : 0;
209
+        } else {
210
+            return $this->rawSize;
211
+        }
212
+    }
213
+
214
+    /**
215
+     * @return int
216
+     */
217
+    public function getMTime() {
218
+        $this->updateEntryfromSubMounts();
219
+        return (int) $this->data['mtime'];
220
+    }
221
+
222
+    /**
223
+     * @return bool
224
+     */
225
+    public function isEncrypted() {
226
+        return $this->data['encrypted'];
227
+    }
228
+
229
+    /**
230
+     * Return the currently version used for the HMAC in the encryption app
231
+     *
232
+     * @return int
233
+     */
234
+    public function getEncryptedVersion() {
235
+        return isset($this->data['encryptedVersion']) ? (int) $this->data['encryptedVersion'] : 1;
236
+    }
237
+
238
+    /**
239
+     * @return int
240
+     */
241
+    public function getPermissions() {
242
+        $perms = (int) $this->data['permissions'];
243
+        if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
244
+            $perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
245
+        }
246
+        return (int) $perms;
247
+    }
248
+
249
+    /**
250
+     * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
251
+     */
252
+    public function getType() {
253
+        if (!isset($this->data['type'])) {
254
+            $this->data['type'] = ($this->getMimetype() === 'httpd/unix-directory') ? self::TYPE_FOLDER : self::TYPE_FILE;
255
+        }
256
+        return $this->data['type'];
257
+    }
258
+
259
+    public function getData() {
260
+        return $this->data;
261
+    }
262
+
263
+    /**
264
+     * @param int $permissions
265
+     * @return bool
266
+     */
267
+    protected function checkPermissions($permissions) {
268
+        return ($this->getPermissions() & $permissions) === $permissions;
269
+    }
270
+
271
+    /**
272
+     * @return bool
273
+     */
274
+    public function isReadable() {
275
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
276
+    }
277
+
278
+    /**
279
+     * @return bool
280
+     */
281
+    public function isUpdateable() {
282
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
283
+    }
284
+
285
+    /**
286
+     * Check whether new files or folders can be created inside this folder
287
+     *
288
+     * @return bool
289
+     */
290
+    public function isCreatable() {
291
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
292
+    }
293
+
294
+    /**
295
+     * @return bool
296
+     */
297
+    public function isDeletable() {
298
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
299
+    }
300
+
301
+    /**
302
+     * @return bool
303
+     */
304
+    public function isShareable() {
305
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
306
+    }
307
+
308
+    /**
309
+     * Check if a file or folder is shared
310
+     *
311
+     * @return bool
312
+     */
313
+    public function isShared() {
314
+        $sid = $this->getStorage()->getId();
315
+        if (!is_null($sid)) {
316
+            $sid = explode(':', $sid);
317
+            return ($sid[0] === 'shared');
318
+        }
319
+
320
+        return false;
321
+    }
322
+
323
+    public function isMounted() {
324
+        $storage = $this->getStorage();
325
+        if ($storage->instanceOfStorage('\OCP\Files\IHomeStorage')) {
326
+            return false;
327
+        }
328
+        $sid = $storage->getId();
329
+        if (!is_null($sid)) {
330
+            $sid = explode(':', $sid);
331
+            return ($sid[0] !== 'home' and $sid[0] !== 'shared');
332
+        }
333
+
334
+        return false;
335
+    }
336
+
337
+    /**
338
+     * Get the mountpoint the file belongs to
339
+     *
340
+     * @return \OCP\Files\Mount\IMountPoint
341
+     */
342
+    public function getMountPoint() {
343
+        return $this->mount;
344
+    }
345
+
346
+    /**
347
+     * Get the owner of the file
348
+     *
349
+     * @return \OCP\IUser
350
+     */
351
+    public function getOwner() {
352
+        return $this->owner;
353
+    }
354
+
355
+    /**
356
+     * @param IMountPoint[] $mounts
357
+     */
358
+    public function setSubMounts(array $mounts) {
359
+        $this->subMounts = $mounts;
360
+    }
361
+
362
+    private function updateEntryfromSubMounts() {
363
+        if ($this->subMountsUsed) {
364
+            return;
365
+        }
366
+        $this->subMountsUsed = true;
367
+        foreach ($this->subMounts as $mount) {
368
+            $subStorage = $mount->getStorage();
369
+            if ($subStorage) {
370
+                $subCache = $subStorage->getCache('');
371
+                $rootEntry = $subCache->get('');
372
+                $this->addSubEntry($rootEntry, $mount->getMountPoint());
373
+            }
374
+        }
375
+    }
376
+
377
+    /**
378
+     * Add a cache entry which is the child of this folder
379
+     *
380
+     * Sets the size, etag and size to for cross-storage childs
381
+     *
382
+     * @param array|ICacheEntry $data cache entry for the child
383
+     * @param string $entryPath full path of the child entry
384
+     */
385
+    public function addSubEntry($data, $entryPath) {
386
+        $this->data['size'] += isset($data['size']) ? $data['size'] : 0;
387
+        if (isset($data['mtime'])) {
388
+            $this->data['mtime'] = max($this->data['mtime'], $data['mtime']);
389
+        }
390
+        if (isset($data['etag'])) {
391
+            // prefix the etag with the relative path of the subentry to propagate etag on mount moves
392
+            $relativeEntryPath = substr($entryPath, strlen($this->getPath()));
393
+            // attach the permissions to propagate etag on permision changes of submounts
394
+            $permissions = isset($data['permissions']) ? $data['permissions'] : 0;
395
+            $this->childEtags[] = $relativeEntryPath . '/' . $data['etag'] . $permissions;
396
+        }
397
+    }
398
+
399
+    /**
400
+     * @inheritdoc
401
+     */
402
+    public function getChecksum() {
403
+        return $this->data['checksum'];
404
+    }
405
+
406
+    public function getExtension(): string {
407
+        return pathinfo($this->getName(), PATHINFO_EXTENSION);
408
+    }
409 409
 }
Please login to merge, or discard this patch.
lib/private/Files/Node/NonExistingFile.php 1 patch
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -26,119 +26,119 @@
 block discarded – undo
26 26
 use OCP\Files\NotFoundException;
27 27
 
28 28
 class NonExistingFile extends File {
29
-	/**
30
-	 * @param string $newPath
31
-	 * @throws \OCP\Files\NotFoundException
32
-	 */
33
-	public function rename($newPath) {
34
-		throw new NotFoundException();
35
-	}
36
-
37
-	public function delete() {
38
-		throw new NotFoundException();
39
-	}
40
-
41
-	public function copy($newPath) {
42
-		throw new NotFoundException();
43
-	}
44
-
45
-	public function touch($mtime = null) {
46
-		throw new NotFoundException();
47
-	}
48
-
49
-	public function getId() {
50
-		if ($this->fileInfo) {
51
-			return parent::getId();
52
-		} else {
53
-			throw new NotFoundException();
54
-		}
55
-	}
56
-
57
-	public function stat() {
58
-		throw new NotFoundException();
59
-	}
60
-
61
-	public function getMTime() {
62
-		if ($this->fileInfo) {
63
-			return parent::getMTime();
64
-		} else {
65
-			throw new NotFoundException();
66
-		}
67
-	}
68
-
69
-	public function getSize($includeMounts = true) {
70
-		if ($this->fileInfo) {
71
-			return parent::getSize($includeMounts);
72
-		} else {
73
-			throw new NotFoundException();
74
-		}
75
-	}
76
-
77
-	public function getEtag() {
78
-		if ($this->fileInfo) {
79
-			return parent::getEtag();
80
-		} else {
81
-			throw new NotFoundException();
82
-		}
83
-	}
84
-
85
-	public function getPermissions() {
86
-		if ($this->fileInfo) {
87
-			return parent::getPermissions();
88
-		} else {
89
-			throw new NotFoundException();
90
-		}
91
-	}
92
-
93
-	public function isReadable() {
94
-		if ($this->fileInfo) {
95
-			return parent::isReadable();
96
-		} else {
97
-			throw new NotFoundException();
98
-		}
99
-	}
100
-
101
-	public function isUpdateable() {
102
-		if ($this->fileInfo) {
103
-			return parent::isUpdateable();
104
-		} else {
105
-			throw new NotFoundException();
106
-		}
107
-	}
108
-
109
-	public function isDeletable() {
110
-		if ($this->fileInfo) {
111
-			return parent::isDeletable();
112
-		} else {
113
-			throw new NotFoundException();
114
-		}
115
-	}
116
-
117
-	public function isShareable() {
118
-		if ($this->fileInfo) {
119
-			return parent::isShareable();
120
-		} else {
121
-			throw new NotFoundException();
122
-		}
123
-	}
124
-
125
-	public function getContent() {
126
-		throw new NotFoundException();
127
-	}
128
-
129
-	public function putContent($data) {
130
-		throw new NotFoundException();
131
-	}
132
-
133
-	public function getMimeType() {
134
-		if ($this->fileInfo) {
135
-			return parent::getMimeType();
136
-		} else {
137
-			throw new NotFoundException();
138
-		}
139
-	}
140
-
141
-	public function fopen($mode) {
142
-		throw new NotFoundException();
143
-	}
29
+    /**
30
+     * @param string $newPath
31
+     * @throws \OCP\Files\NotFoundException
32
+     */
33
+    public function rename($newPath) {
34
+        throw new NotFoundException();
35
+    }
36
+
37
+    public function delete() {
38
+        throw new NotFoundException();
39
+    }
40
+
41
+    public function copy($newPath) {
42
+        throw new NotFoundException();
43
+    }
44
+
45
+    public function touch($mtime = null) {
46
+        throw new NotFoundException();
47
+    }
48
+
49
+    public function getId() {
50
+        if ($this->fileInfo) {
51
+            return parent::getId();
52
+        } else {
53
+            throw new NotFoundException();
54
+        }
55
+    }
56
+
57
+    public function stat() {
58
+        throw new NotFoundException();
59
+    }
60
+
61
+    public function getMTime() {
62
+        if ($this->fileInfo) {
63
+            return parent::getMTime();
64
+        } else {
65
+            throw new NotFoundException();
66
+        }
67
+    }
68
+
69
+    public function getSize($includeMounts = true) {
70
+        if ($this->fileInfo) {
71
+            return parent::getSize($includeMounts);
72
+        } else {
73
+            throw new NotFoundException();
74
+        }
75
+    }
76
+
77
+    public function getEtag() {
78
+        if ($this->fileInfo) {
79
+            return parent::getEtag();
80
+        } else {
81
+            throw new NotFoundException();
82
+        }
83
+    }
84
+
85
+    public function getPermissions() {
86
+        if ($this->fileInfo) {
87
+            return parent::getPermissions();
88
+        } else {
89
+            throw new NotFoundException();
90
+        }
91
+    }
92
+
93
+    public function isReadable() {
94
+        if ($this->fileInfo) {
95
+            return parent::isReadable();
96
+        } else {
97
+            throw new NotFoundException();
98
+        }
99
+    }
100
+
101
+    public function isUpdateable() {
102
+        if ($this->fileInfo) {
103
+            return parent::isUpdateable();
104
+        } else {
105
+            throw new NotFoundException();
106
+        }
107
+    }
108
+
109
+    public function isDeletable() {
110
+        if ($this->fileInfo) {
111
+            return parent::isDeletable();
112
+        } else {
113
+            throw new NotFoundException();
114
+        }
115
+    }
116
+
117
+    public function isShareable() {
118
+        if ($this->fileInfo) {
119
+            return parent::isShareable();
120
+        } else {
121
+            throw new NotFoundException();
122
+        }
123
+    }
124
+
125
+    public function getContent() {
126
+        throw new NotFoundException();
127
+    }
128
+
129
+    public function putContent($data) {
130
+        throw new NotFoundException();
131
+    }
132
+
133
+    public function getMimeType() {
134
+        if ($this->fileInfo) {
135
+            return parent::getMimeType();
136
+        } else {
137
+            throw new NotFoundException();
138
+        }
139
+    }
140
+
141
+    public function fopen($mode) {
142
+        throw new NotFoundException();
143
+    }
144 144
 }
Please login to merge, or discard this patch.
lib/private/Files/Node/Root.php 1 patch
Indentation   +335 added lines, -335 removed lines patch added patch discarded remove patch
@@ -61,339 +61,339 @@
 block discarded – undo
61 61
  * @package OC\Files\Node
62 62
  */
63 63
 class Root extends Folder implements IRootFolder {
64
-	/** @var Manager */
65
-	private $mountManager;
66
-	/** @var PublicEmitter */
67
-	private $emitter;
68
-	/** @var null|\OC\User\User */
69
-	private $user;
70
-	/** @var CappedMemoryCache */
71
-	private $userFolderCache;
72
-	/** @var IUserMountCache */
73
-	private $userMountCache;
74
-	/** @var ILogger */
75
-	private $logger;
76
-	/** @var IUserManager */
77
-	private $userManager;
78
-
79
-	/**
80
-	 * @param \OC\Files\Mount\Manager $manager
81
-	 * @param \OC\Files\View $view
82
-	 * @param \OC\User\User|null $user
83
-	 * @param IUserMountCache $userMountCache
84
-	 * @param ILogger $logger
85
-	 * @param IUserManager $userManager
86
-	 */
87
-	public function __construct($manager,
88
-								$view,
89
-								$user,
90
-								IUserMountCache $userMountCache,
91
-								ILogger $logger,
92
-								IUserManager $userManager) {
93
-		parent::__construct($this, $view, '');
94
-		$this->mountManager = $manager;
95
-		$this->user = $user;
96
-		$this->emitter = new PublicEmitter();
97
-		$this->userFolderCache = new CappedMemoryCache();
98
-		$this->userMountCache = $userMountCache;
99
-		$this->logger = $logger;
100
-		$this->userManager = $userManager;
101
-	}
102
-
103
-	/**
104
-	 * Get the user for which the filesystem is setup
105
-	 *
106
-	 * @return \OC\User\User
107
-	 */
108
-	public function getUser() {
109
-		return $this->user;
110
-	}
111
-
112
-	/**
113
-	 * @param string $scope
114
-	 * @param string $method
115
-	 * @param callable $callback
116
-	 */
117
-	public function listen($scope, $method, callable $callback) {
118
-		$this->emitter->listen($scope, $method, $callback);
119
-	}
120
-
121
-	/**
122
-	 * @param string $scope optional
123
-	 * @param string $method optional
124
-	 * @param callable $callback optional
125
-	 */
126
-	public function removeListener($scope = null, $method = null, callable $callback = null) {
127
-		$this->emitter->removeListener($scope, $method, $callback);
128
-	}
129
-
130
-	/**
131
-	 * @param string $scope
132
-	 * @param string $method
133
-	 * @param Node[] $arguments
134
-	 */
135
-	public function emit($scope, $method, $arguments = array()) {
136
-		$this->emitter->emit($scope, $method, $arguments);
137
-	}
138
-
139
-	/**
140
-	 * @param \OC\Files\Storage\Storage $storage
141
-	 * @param string $mountPoint
142
-	 * @param array $arguments
143
-	 */
144
-	public function mount($storage, $mountPoint, $arguments = array()) {
145
-		$mount = new MountPoint($storage, $mountPoint, $arguments);
146
-		$this->mountManager->addMount($mount);
147
-	}
148
-
149
-	/**
150
-	 * @param string $mountPoint
151
-	 * @return \OC\Files\Mount\MountPoint
152
-	 */
153
-	public function getMount($mountPoint) {
154
-		return $this->mountManager->find($mountPoint);
155
-	}
156
-
157
-	/**
158
-	 * @param string $mountPoint
159
-	 * @return \OC\Files\Mount\MountPoint[]
160
-	 */
161
-	public function getMountsIn($mountPoint) {
162
-		return $this->mountManager->findIn($mountPoint);
163
-	}
164
-
165
-	/**
166
-	 * @param string $storageId
167
-	 * @return \OC\Files\Mount\MountPoint[]
168
-	 */
169
-	public function getMountByStorageId($storageId) {
170
-		return $this->mountManager->findByStorageId($storageId);
171
-	}
172
-
173
-	/**
174
-	 * @param int $numericId
175
-	 * @return MountPoint[]
176
-	 */
177
-	public function getMountByNumericStorageId($numericId) {
178
-		return $this->mountManager->findByNumericId($numericId);
179
-	}
180
-
181
-	/**
182
-	 * @param \OC\Files\Mount\MountPoint $mount
183
-	 */
184
-	public function unMount($mount) {
185
-		$this->mountManager->remove($mount);
186
-	}
187
-
188
-	/**
189
-	 * @param string $path
190
-	 * @throws \OCP\Files\NotFoundException
191
-	 * @throws \OCP\Files\NotPermittedException
192
-	 * @return string
193
-	 */
194
-	public function get($path) {
195
-		$path = $this->normalizePath($path);
196
-		if ($this->isValidPath($path)) {
197
-			$fullPath = $this->getFullPath($path);
198
-			$fileInfo = $this->view->getFileInfo($fullPath);
199
-			if ($fileInfo) {
200
-				return $this->createNode($fullPath, $fileInfo);
201
-			} else {
202
-				throw new NotFoundException($path);
203
-			}
204
-		} else {
205
-			throw new NotPermittedException();
206
-		}
207
-	}
208
-
209
-	//most operations can't be done on the root
210
-
211
-	/**
212
-	 * @param string $targetPath
213
-	 * @throws \OCP\Files\NotPermittedException
214
-	 * @return \OC\Files\Node\Node
215
-	 */
216
-	public function rename($targetPath) {
217
-		throw new NotPermittedException();
218
-	}
219
-
220
-	public function delete() {
221
-		throw new NotPermittedException();
222
-	}
223
-
224
-	/**
225
-	 * @param string $targetPath
226
-	 * @throws \OCP\Files\NotPermittedException
227
-	 * @return \OC\Files\Node\Node
228
-	 */
229
-	public function copy($targetPath) {
230
-		throw new NotPermittedException();
231
-	}
232
-
233
-	/**
234
-	 * @param int $mtime
235
-	 * @throws \OCP\Files\NotPermittedException
236
-	 */
237
-	public function touch($mtime = null) {
238
-		throw new NotPermittedException();
239
-	}
240
-
241
-	/**
242
-	 * @return \OC\Files\Storage\Storage
243
-	 * @throws \OCP\Files\NotFoundException
244
-	 */
245
-	public function getStorage() {
246
-		throw new NotFoundException();
247
-	}
248
-
249
-	/**
250
-	 * @return string
251
-	 */
252
-	public function getPath() {
253
-		return '/';
254
-	}
255
-
256
-	/**
257
-	 * @return string
258
-	 */
259
-	public function getInternalPath() {
260
-		return '';
261
-	}
262
-
263
-	/**
264
-	 * @return int
265
-	 */
266
-	public function getId() {
267
-		return null;
268
-	}
269
-
270
-	/**
271
-	 * @return array
272
-	 */
273
-	public function stat() {
274
-		return null;
275
-	}
276
-
277
-	/**
278
-	 * @return int
279
-	 */
280
-	public function getMTime() {
281
-		return null;
282
-	}
283
-
284
-	/**
285
-	 * @param bool $includeMounts
286
-	 * @return int
287
-	 */
288
-	public function getSize($includeMounts = true) {
289
-		return null;
290
-	}
291
-
292
-	/**
293
-	 * @return string
294
-	 */
295
-	public function getEtag() {
296
-		return null;
297
-	}
298
-
299
-	/**
300
-	 * @return int
301
-	 */
302
-	public function getPermissions() {
303
-		return \OCP\Constants::PERMISSION_CREATE;
304
-	}
305
-
306
-	/**
307
-	 * @return bool
308
-	 */
309
-	public function isReadable() {
310
-		return false;
311
-	}
312
-
313
-	/**
314
-	 * @return bool
315
-	 */
316
-	public function isUpdateable() {
317
-		return false;
318
-	}
319
-
320
-	/**
321
-	 * @return bool
322
-	 */
323
-	public function isDeletable() {
324
-		return false;
325
-	}
326
-
327
-	/**
328
-	 * @return bool
329
-	 */
330
-	public function isShareable() {
331
-		return false;
332
-	}
333
-
334
-	/**
335
-	 * @return Node
336
-	 * @throws \OCP\Files\NotFoundException
337
-	 */
338
-	public function getParent() {
339
-		throw new NotFoundException();
340
-	}
341
-
342
-	/**
343
-	 * @return string
344
-	 */
345
-	public function getName() {
346
-		return '';
347
-	}
348
-
349
-	/**
350
-	 * Returns a view to user's files folder
351
-	 *
352
-	 * @param string $userId user ID
353
-	 * @return \OCP\Files\Folder
354
-	 * @throws \OC\User\NoUserException
355
-	 */
356
-	public function getUserFolder($userId) {
357
-		$userObject = $this->userManager->get($userId);
358
-
359
-		if (is_null($userObject)) {
360
-			$this->logger->error(
361
-				sprintf(
362
-					'Backends provided no user object for %s',
363
-					$userId
364
-				),
365
-				[
366
-					'app' => 'files',
367
-				]
368
-			);
369
-			throw new \OC\User\NoUserException('Backends provided no user object');
370
-		}
371
-
372
-		$userId = $userObject->getUID();
373
-
374
-		if (!$this->userFolderCache->hasKey($userId)) {
375
-			\OC\Files\Filesystem::initMountPoints($userId);
376
-
377
-			try {
378
-				$folder = $this->get('/' . $userId . '/files');
379
-			} catch (NotFoundException $e) {
380
-				if (!$this->nodeExists('/' . $userId)) {
381
-					$this->newFolder('/' . $userId);
382
-				}
383
-				$folder = $this->newFolder('/' . $userId . '/files');
384
-			}
385
-
386
-			$this->userFolderCache->set($userId, $folder);
387
-		}
388
-
389
-		return $this->userFolderCache->get($userId);
390
-	}
391
-
392
-	public function clearCache() {
393
-		$this->userFolderCache = new CappedMemoryCache();
394
-	}
395
-
396
-	public function getUserMountCache() {
397
-		return $this->userMountCache;
398
-	}
64
+    /** @var Manager */
65
+    private $mountManager;
66
+    /** @var PublicEmitter */
67
+    private $emitter;
68
+    /** @var null|\OC\User\User */
69
+    private $user;
70
+    /** @var CappedMemoryCache */
71
+    private $userFolderCache;
72
+    /** @var IUserMountCache */
73
+    private $userMountCache;
74
+    /** @var ILogger */
75
+    private $logger;
76
+    /** @var IUserManager */
77
+    private $userManager;
78
+
79
+    /**
80
+     * @param \OC\Files\Mount\Manager $manager
81
+     * @param \OC\Files\View $view
82
+     * @param \OC\User\User|null $user
83
+     * @param IUserMountCache $userMountCache
84
+     * @param ILogger $logger
85
+     * @param IUserManager $userManager
86
+     */
87
+    public function __construct($manager,
88
+                                $view,
89
+                                $user,
90
+                                IUserMountCache $userMountCache,
91
+                                ILogger $logger,
92
+                                IUserManager $userManager) {
93
+        parent::__construct($this, $view, '');
94
+        $this->mountManager = $manager;
95
+        $this->user = $user;
96
+        $this->emitter = new PublicEmitter();
97
+        $this->userFolderCache = new CappedMemoryCache();
98
+        $this->userMountCache = $userMountCache;
99
+        $this->logger = $logger;
100
+        $this->userManager = $userManager;
101
+    }
102
+
103
+    /**
104
+     * Get the user for which the filesystem is setup
105
+     *
106
+     * @return \OC\User\User
107
+     */
108
+    public function getUser() {
109
+        return $this->user;
110
+    }
111
+
112
+    /**
113
+     * @param string $scope
114
+     * @param string $method
115
+     * @param callable $callback
116
+     */
117
+    public function listen($scope, $method, callable $callback) {
118
+        $this->emitter->listen($scope, $method, $callback);
119
+    }
120
+
121
+    /**
122
+     * @param string $scope optional
123
+     * @param string $method optional
124
+     * @param callable $callback optional
125
+     */
126
+    public function removeListener($scope = null, $method = null, callable $callback = null) {
127
+        $this->emitter->removeListener($scope, $method, $callback);
128
+    }
129
+
130
+    /**
131
+     * @param string $scope
132
+     * @param string $method
133
+     * @param Node[] $arguments
134
+     */
135
+    public function emit($scope, $method, $arguments = array()) {
136
+        $this->emitter->emit($scope, $method, $arguments);
137
+    }
138
+
139
+    /**
140
+     * @param \OC\Files\Storage\Storage $storage
141
+     * @param string $mountPoint
142
+     * @param array $arguments
143
+     */
144
+    public function mount($storage, $mountPoint, $arguments = array()) {
145
+        $mount = new MountPoint($storage, $mountPoint, $arguments);
146
+        $this->mountManager->addMount($mount);
147
+    }
148
+
149
+    /**
150
+     * @param string $mountPoint
151
+     * @return \OC\Files\Mount\MountPoint
152
+     */
153
+    public function getMount($mountPoint) {
154
+        return $this->mountManager->find($mountPoint);
155
+    }
156
+
157
+    /**
158
+     * @param string $mountPoint
159
+     * @return \OC\Files\Mount\MountPoint[]
160
+     */
161
+    public function getMountsIn($mountPoint) {
162
+        return $this->mountManager->findIn($mountPoint);
163
+    }
164
+
165
+    /**
166
+     * @param string $storageId
167
+     * @return \OC\Files\Mount\MountPoint[]
168
+     */
169
+    public function getMountByStorageId($storageId) {
170
+        return $this->mountManager->findByStorageId($storageId);
171
+    }
172
+
173
+    /**
174
+     * @param int $numericId
175
+     * @return MountPoint[]
176
+     */
177
+    public function getMountByNumericStorageId($numericId) {
178
+        return $this->mountManager->findByNumericId($numericId);
179
+    }
180
+
181
+    /**
182
+     * @param \OC\Files\Mount\MountPoint $mount
183
+     */
184
+    public function unMount($mount) {
185
+        $this->mountManager->remove($mount);
186
+    }
187
+
188
+    /**
189
+     * @param string $path
190
+     * @throws \OCP\Files\NotFoundException
191
+     * @throws \OCP\Files\NotPermittedException
192
+     * @return string
193
+     */
194
+    public function get($path) {
195
+        $path = $this->normalizePath($path);
196
+        if ($this->isValidPath($path)) {
197
+            $fullPath = $this->getFullPath($path);
198
+            $fileInfo = $this->view->getFileInfo($fullPath);
199
+            if ($fileInfo) {
200
+                return $this->createNode($fullPath, $fileInfo);
201
+            } else {
202
+                throw new NotFoundException($path);
203
+            }
204
+        } else {
205
+            throw new NotPermittedException();
206
+        }
207
+    }
208
+
209
+    //most operations can't be done on the root
210
+
211
+    /**
212
+     * @param string $targetPath
213
+     * @throws \OCP\Files\NotPermittedException
214
+     * @return \OC\Files\Node\Node
215
+     */
216
+    public function rename($targetPath) {
217
+        throw new NotPermittedException();
218
+    }
219
+
220
+    public function delete() {
221
+        throw new NotPermittedException();
222
+    }
223
+
224
+    /**
225
+     * @param string $targetPath
226
+     * @throws \OCP\Files\NotPermittedException
227
+     * @return \OC\Files\Node\Node
228
+     */
229
+    public function copy($targetPath) {
230
+        throw new NotPermittedException();
231
+    }
232
+
233
+    /**
234
+     * @param int $mtime
235
+     * @throws \OCP\Files\NotPermittedException
236
+     */
237
+    public function touch($mtime = null) {
238
+        throw new NotPermittedException();
239
+    }
240
+
241
+    /**
242
+     * @return \OC\Files\Storage\Storage
243
+     * @throws \OCP\Files\NotFoundException
244
+     */
245
+    public function getStorage() {
246
+        throw new NotFoundException();
247
+    }
248
+
249
+    /**
250
+     * @return string
251
+     */
252
+    public function getPath() {
253
+        return '/';
254
+    }
255
+
256
+    /**
257
+     * @return string
258
+     */
259
+    public function getInternalPath() {
260
+        return '';
261
+    }
262
+
263
+    /**
264
+     * @return int
265
+     */
266
+    public function getId() {
267
+        return null;
268
+    }
269
+
270
+    /**
271
+     * @return array
272
+     */
273
+    public function stat() {
274
+        return null;
275
+    }
276
+
277
+    /**
278
+     * @return int
279
+     */
280
+    public function getMTime() {
281
+        return null;
282
+    }
283
+
284
+    /**
285
+     * @param bool $includeMounts
286
+     * @return int
287
+     */
288
+    public function getSize($includeMounts = true) {
289
+        return null;
290
+    }
291
+
292
+    /**
293
+     * @return string
294
+     */
295
+    public function getEtag() {
296
+        return null;
297
+    }
298
+
299
+    /**
300
+     * @return int
301
+     */
302
+    public function getPermissions() {
303
+        return \OCP\Constants::PERMISSION_CREATE;
304
+    }
305
+
306
+    /**
307
+     * @return bool
308
+     */
309
+    public function isReadable() {
310
+        return false;
311
+    }
312
+
313
+    /**
314
+     * @return bool
315
+     */
316
+    public function isUpdateable() {
317
+        return false;
318
+    }
319
+
320
+    /**
321
+     * @return bool
322
+     */
323
+    public function isDeletable() {
324
+        return false;
325
+    }
326
+
327
+    /**
328
+     * @return bool
329
+     */
330
+    public function isShareable() {
331
+        return false;
332
+    }
333
+
334
+    /**
335
+     * @return Node
336
+     * @throws \OCP\Files\NotFoundException
337
+     */
338
+    public function getParent() {
339
+        throw new NotFoundException();
340
+    }
341
+
342
+    /**
343
+     * @return string
344
+     */
345
+    public function getName() {
346
+        return '';
347
+    }
348
+
349
+    /**
350
+     * Returns a view to user's files folder
351
+     *
352
+     * @param string $userId user ID
353
+     * @return \OCP\Files\Folder
354
+     * @throws \OC\User\NoUserException
355
+     */
356
+    public function getUserFolder($userId) {
357
+        $userObject = $this->userManager->get($userId);
358
+
359
+        if (is_null($userObject)) {
360
+            $this->logger->error(
361
+                sprintf(
362
+                    'Backends provided no user object for %s',
363
+                    $userId
364
+                ),
365
+                [
366
+                    'app' => 'files',
367
+                ]
368
+            );
369
+            throw new \OC\User\NoUserException('Backends provided no user object');
370
+        }
371
+
372
+        $userId = $userObject->getUID();
373
+
374
+        if (!$this->userFolderCache->hasKey($userId)) {
375
+            \OC\Files\Filesystem::initMountPoints($userId);
376
+
377
+            try {
378
+                $folder = $this->get('/' . $userId . '/files');
379
+            } catch (NotFoundException $e) {
380
+                if (!$this->nodeExists('/' . $userId)) {
381
+                    $this->newFolder('/' . $userId);
382
+                }
383
+                $folder = $this->newFolder('/' . $userId . '/files');
384
+            }
385
+
386
+            $this->userFolderCache->set($userId, $folder);
387
+        }
388
+
389
+        return $this->userFolderCache->get($userId);
390
+    }
391
+
392
+    public function clearCache() {
393
+        $this->userFolderCache = new CappedMemoryCache();
394
+    }
395
+
396
+    public function getUserMountCache() {
397
+        return $this->userMountCache;
398
+    }
399 399
 }
Please login to merge, or discard this patch.
lib/private/Files/Node/Node.php 1 patch
Indentation   +396 added lines, -396 removed lines patch added patch discarded remove patch
@@ -35,401 +35,401 @@
 block discarded – undo
35 35
 
36 36
 // FIXME: this class really should be abstract
37 37
 class Node implements \OCP\Files\Node {
38
-	/**
39
-	 * @var \OC\Files\View $view
40
-	 */
41
-	protected $view;
42
-
43
-	/**
44
-	 * @var \OC\Files\Node\Root $root
45
-	 */
46
-	protected $root;
47
-
48
-	/**
49
-	 * @var string $path
50
-	 */
51
-	protected $path;
52
-
53
-	/**
54
-	 * @var \OCP\Files\FileInfo
55
-	 */
56
-	protected $fileInfo;
57
-
58
-	/**
59
-	 * @param \OC\Files\View $view
60
-	 * @param \OCP\Files\IRootFolder $root
61
-	 * @param string $path
62
-	 * @param FileInfo $fileInfo
63
-	 */
64
-	public function __construct($root, $view, $path, $fileInfo = null) {
65
-		$this->view = $view;
66
-		$this->root = $root;
67
-		$this->path = $path;
68
-		$this->fileInfo = $fileInfo;
69
-	}
70
-
71
-	/**
72
-	 * Creates a Node of the same type that represents a non-existing path
73
-	 *
74
-	 * @param string $path path
75
-	 * @return string non-existing node class
76
-	 */
77
-	protected function createNonExistingNode($path) {
78
-		throw new \Exception('Must be implemented by subclasses');
79
-	}
80
-
81
-	/**
82
-	 * Returns the matching file info
83
-	 *
84
-	 * @return FileInfo
85
-	 * @throws InvalidPathException
86
-	 * @throws NotFoundException
87
-	 */
88
-	public function getFileInfo() {
89
-		if (!Filesystem::isValidPath($this->path)) {
90
-			throw new InvalidPathException();
91
-		}
92
-		if (!$this->fileInfo) {
93
-			$fileInfo = $this->view->getFileInfo($this->path);
94
-			if ($fileInfo instanceof FileInfo) {
95
-				$this->fileInfo = $fileInfo;
96
-			} else {
97
-				throw new NotFoundException();
98
-			}
99
-		}
100
-		return $this->fileInfo;
101
-	}
102
-
103
-	/**
104
-	 * @param string[] $hooks
105
-	 */
106
-	protected function sendHooks($hooks) {
107
-		foreach ($hooks as $hook) {
108
-			$this->root->emit('\OC\Files', $hook, array($this));
109
-		}
110
-	}
111
-
112
-	/**
113
-	 * @param int $permissions
114
-	 * @return bool
115
-	 */
116
-	protected function checkPermissions($permissions) {
117
-		return ($this->getPermissions() & $permissions) === $permissions;
118
-	}
119
-
120
-	public function delete() {
121
-	}
122
-
123
-	/**
124
-	 * @param int $mtime
125
-	 * @throws \OCP\Files\NotPermittedException
126
-	 */
127
-	public function touch($mtime = null) {
128
-		if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
129
-			$this->sendHooks(array('preTouch'));
130
-			$this->view->touch($this->path, $mtime);
131
-			$this->sendHooks(array('postTouch'));
132
-			if ($this->fileInfo) {
133
-				if (is_null($mtime)) {
134
-					$mtime = time();
135
-				}
136
-				$this->fileInfo['mtime'] = $mtime;
137
-			}
138
-		} else {
139
-			throw new NotPermittedException();
140
-		}
141
-	}
142
-
143
-	/**
144
-	 * @return \OC\Files\Storage\Storage
145
-	 * @throws \OCP\Files\NotFoundException
146
-	 */
147
-	public function getStorage() {
148
-		list($storage,) = $this->view->resolvePath($this->path);
149
-		return $storage;
150
-	}
151
-
152
-	/**
153
-	 * @return string
154
-	 */
155
-	public function getPath() {
156
-		return $this->path;
157
-	}
158
-
159
-	/**
160
-	 * @return string
161
-	 */
162
-	public function getInternalPath() {
163
-		list(, $internalPath) = $this->view->resolvePath($this->path);
164
-		return $internalPath;
165
-	}
166
-
167
-	/**
168
-	 * @return int
169
-	 * @throws InvalidPathException
170
-	 * @throws NotFoundException
171
-	 */
172
-	public function getId() {
173
-		return $this->getFileInfo()->getId();
174
-	}
175
-
176
-	/**
177
-	 * @return array
178
-	 */
179
-	public function stat() {
180
-		return $this->view->stat($this->path);
181
-	}
182
-
183
-	/**
184
-	 * @return int
185
-	 * @throws InvalidPathException
186
-	 * @throws NotFoundException
187
-	 */
188
-	public function getMTime() {
189
-		return $this->getFileInfo()->getMTime();
190
-	}
191
-
192
-	/**
193
-	 * @param bool $includeMounts
194
-	 * @return int
195
-	 * @throws InvalidPathException
196
-	 * @throws NotFoundException
197
-	 */
198
-	public function getSize($includeMounts = true) {
199
-		return $this->getFileInfo()->getSize($includeMounts);
200
-	}
201
-
202
-	/**
203
-	 * @return string
204
-	 * @throws InvalidPathException
205
-	 * @throws NotFoundException
206
-	 */
207
-	public function getEtag() {
208
-		return $this->getFileInfo()->getEtag();
209
-	}
210
-
211
-	/**
212
-	 * @return int
213
-	 * @throws InvalidPathException
214
-	 * @throws NotFoundException
215
-	 */
216
-	public function getPermissions() {
217
-		return $this->getFileInfo()->getPermissions();
218
-	}
219
-
220
-	/**
221
-	 * @return bool
222
-	 * @throws InvalidPathException
223
-	 * @throws NotFoundException
224
-	 */
225
-	public function isReadable() {
226
-		return $this->getFileInfo()->isReadable();
227
-	}
228
-
229
-	/**
230
-	 * @return bool
231
-	 * @throws InvalidPathException
232
-	 * @throws NotFoundException
233
-	 */
234
-	public function isUpdateable() {
235
-		return $this->getFileInfo()->isUpdateable();
236
-	}
237
-
238
-	/**
239
-	 * @return bool
240
-	 * @throws InvalidPathException
241
-	 * @throws NotFoundException
242
-	 */
243
-	public function isDeletable() {
244
-		return $this->getFileInfo()->isDeletable();
245
-	}
246
-
247
-	/**
248
-	 * @return bool
249
-	 * @throws InvalidPathException
250
-	 * @throws NotFoundException
251
-	 */
252
-	public function isShareable() {
253
-		return $this->getFileInfo()->isShareable();
254
-	}
255
-
256
-	/**
257
-	 * @return bool
258
-	 * @throws InvalidPathException
259
-	 * @throws NotFoundException
260
-	 */
261
-	public function isCreatable() {
262
-		return $this->getFileInfo()->isCreatable();
263
-	}
264
-
265
-	/**
266
-	 * @return Node
267
-	 */
268
-	public function getParent() {
269
-		$newPath = dirname($this->path);
270
-		if ($newPath === '' || $newPath === '.' || $newPath === '/') {
271
-			return $this->root;
272
-		}
273
-		return $this->root->get($newPath);
274
-	}
275
-
276
-	/**
277
-	 * @return string
278
-	 */
279
-	public function getName() {
280
-		return basename($this->path);
281
-	}
282
-
283
-	/**
284
-	 * @param string $path
285
-	 * @return string
286
-	 */
287
-	protected function normalizePath($path) {
288
-		if ($path === '' or $path === '/') {
289
-			return '/';
290
-		}
291
-		//no windows style slashes
292
-		$path = str_replace('\\', '/', $path);
293
-		//add leading slash
294
-		if ($path[0] !== '/') {
295
-			$path = '/' . $path;
296
-		}
297
-		//remove duplicate slashes
298
-		while (strpos($path, '//') !== false) {
299
-			$path = str_replace('//', '/', $path);
300
-		}
301
-		//remove trailing slash
302
-		$path = rtrim($path, '/');
303
-
304
-		return $path;
305
-	}
306
-
307
-	/**
308
-	 * check if the requested path is valid
309
-	 *
310
-	 * @param string $path
311
-	 * @return bool
312
-	 */
313
-	public function isValidPath($path) {
314
-		if (!$path || $path[0] !== '/') {
315
-			$path = '/' . $path;
316
-		}
317
-		if (strstr($path, '/../') || strrchr($path, '/') === '/..') {
318
-			return false;
319
-		}
320
-		return true;
321
-	}
322
-
323
-	public function isMounted() {
324
-		return $this->getFileInfo()->isMounted();
325
-	}
326
-
327
-	public function isShared() {
328
-		return $this->getFileInfo()->isShared();
329
-	}
330
-
331
-	public function getMimeType() {
332
-		return $this->getFileInfo()->getMimetype();
333
-	}
334
-
335
-	public function getMimePart() {
336
-		return $this->getFileInfo()->getMimePart();
337
-	}
338
-
339
-	public function getType() {
340
-		return $this->getFileInfo()->getType();
341
-	}
342
-
343
-	public function isEncrypted() {
344
-		return $this->getFileInfo()->isEncrypted();
345
-	}
346
-
347
-	public function getMountPoint() {
348
-		return $this->getFileInfo()->getMountPoint();
349
-	}
350
-
351
-	public function getOwner() {
352
-		return $this->getFileInfo()->getOwner();
353
-	}
354
-
355
-	public function getChecksum() {
356
-	}
357
-
358
-	public function getExtension(): string {
359
-		return $this->getFileInfo()->getExtension();
360
-	}
361
-
362
-	/**
363
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
364
-	 * @throws \OCP\Lock\LockedException
365
-	 */
366
-	public function lock($type) {
367
-		$this->view->lockFile($this->path, $type);
368
-	}
369
-
370
-	/**
371
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
372
-	 * @throws \OCP\Lock\LockedException
373
-	 */
374
-	public function changeLock($type) {
375
-		$this->view->changeLock($this->path, $type);
376
-	}
377
-
378
-	/**
379
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
380
-	 * @throws \OCP\Lock\LockedException
381
-	 */
382
-	public function unlock($type) {
383
-		$this->view->unlockFile($this->path, $type);
384
-	}
385
-
386
-	/**
387
-	 * @param string $targetPath
388
-	 * @throws \OCP\Files\NotPermittedException if copy not allowed or failed
389
-	 * @return \OC\Files\Node\Node
390
-	 */
391
-	public function copy($targetPath) {
392
-		$targetPath = $this->normalizePath($targetPath);
393
-		$parent = $this->root->get(dirname($targetPath));
394
-		if ($parent instanceof Folder and $this->isValidPath($targetPath) and $parent->isCreatable()) {
395
-			$nonExisting = $this->createNonExistingNode($targetPath);
396
-			$this->root->emit('\OC\Files', 'preCopy', [$this, $nonExisting]);
397
-			$this->root->emit('\OC\Files', 'preWrite', [$nonExisting]);
398
-			if (!$this->view->copy($this->path, $targetPath)) {
399
-				throw new NotPermittedException('Could not copy ' . $this->path . ' to ' . $targetPath);
400
-			}
401
-			$targetNode = $this->root->get($targetPath);
402
-			$this->root->emit('\OC\Files', 'postCopy', [$this, $targetNode]);
403
-			$this->root->emit('\OC\Files', 'postWrite', [$targetNode]);
404
-			return $targetNode;
405
-		} else {
406
-			throw new NotPermittedException('No permission to copy to path ' . $targetPath);
407
-		}
408
-	}
409
-
410
-	/**
411
-	 * @param string $targetPath
412
-	 * @throws \OCP\Files\NotPermittedException if move not allowed or failed
413
-	 * @return \OC\Files\Node\Node
414
-	 */
415
-	public function move($targetPath) {
416
-		$targetPath = $this->normalizePath($targetPath);
417
-		$parent = $this->root->get(dirname($targetPath));
418
-		if ($parent instanceof Folder and $this->isValidPath($targetPath) and $parent->isCreatable()) {
419
-			$nonExisting = $this->createNonExistingNode($targetPath);
420
-			$this->root->emit('\OC\Files', 'preRename', [$this, $nonExisting]);
421
-			$this->root->emit('\OC\Files', 'preWrite', [$nonExisting]);
422
-			if (!$this->view->rename($this->path, $targetPath)) {
423
-				throw new NotPermittedException('Could not move ' . $this->path . ' to ' . $targetPath);
424
-			}
425
-			$targetNode = $this->root->get($targetPath);
426
-			$this->root->emit('\OC\Files', 'postRename', [$this, $targetNode]);
427
-			$this->root->emit('\OC\Files', 'postWrite', [$targetNode]);
428
-			$this->path = $targetPath;
429
-			return $targetNode;
430
-		} else {
431
-			throw new NotPermittedException('No permission to move to path ' . $targetPath);
432
-		}
433
-	}
38
+    /**
39
+     * @var \OC\Files\View $view
40
+     */
41
+    protected $view;
42
+
43
+    /**
44
+     * @var \OC\Files\Node\Root $root
45
+     */
46
+    protected $root;
47
+
48
+    /**
49
+     * @var string $path
50
+     */
51
+    protected $path;
52
+
53
+    /**
54
+     * @var \OCP\Files\FileInfo
55
+     */
56
+    protected $fileInfo;
57
+
58
+    /**
59
+     * @param \OC\Files\View $view
60
+     * @param \OCP\Files\IRootFolder $root
61
+     * @param string $path
62
+     * @param FileInfo $fileInfo
63
+     */
64
+    public function __construct($root, $view, $path, $fileInfo = null) {
65
+        $this->view = $view;
66
+        $this->root = $root;
67
+        $this->path = $path;
68
+        $this->fileInfo = $fileInfo;
69
+    }
70
+
71
+    /**
72
+     * Creates a Node of the same type that represents a non-existing path
73
+     *
74
+     * @param string $path path
75
+     * @return string non-existing node class
76
+     */
77
+    protected function createNonExistingNode($path) {
78
+        throw new \Exception('Must be implemented by subclasses');
79
+    }
80
+
81
+    /**
82
+     * Returns the matching file info
83
+     *
84
+     * @return FileInfo
85
+     * @throws InvalidPathException
86
+     * @throws NotFoundException
87
+     */
88
+    public function getFileInfo() {
89
+        if (!Filesystem::isValidPath($this->path)) {
90
+            throw new InvalidPathException();
91
+        }
92
+        if (!$this->fileInfo) {
93
+            $fileInfo = $this->view->getFileInfo($this->path);
94
+            if ($fileInfo instanceof FileInfo) {
95
+                $this->fileInfo = $fileInfo;
96
+            } else {
97
+                throw new NotFoundException();
98
+            }
99
+        }
100
+        return $this->fileInfo;
101
+    }
102
+
103
+    /**
104
+     * @param string[] $hooks
105
+     */
106
+    protected function sendHooks($hooks) {
107
+        foreach ($hooks as $hook) {
108
+            $this->root->emit('\OC\Files', $hook, array($this));
109
+        }
110
+    }
111
+
112
+    /**
113
+     * @param int $permissions
114
+     * @return bool
115
+     */
116
+    protected function checkPermissions($permissions) {
117
+        return ($this->getPermissions() & $permissions) === $permissions;
118
+    }
119
+
120
+    public function delete() {
121
+    }
122
+
123
+    /**
124
+     * @param int $mtime
125
+     * @throws \OCP\Files\NotPermittedException
126
+     */
127
+    public function touch($mtime = null) {
128
+        if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
129
+            $this->sendHooks(array('preTouch'));
130
+            $this->view->touch($this->path, $mtime);
131
+            $this->sendHooks(array('postTouch'));
132
+            if ($this->fileInfo) {
133
+                if (is_null($mtime)) {
134
+                    $mtime = time();
135
+                }
136
+                $this->fileInfo['mtime'] = $mtime;
137
+            }
138
+        } else {
139
+            throw new NotPermittedException();
140
+        }
141
+    }
142
+
143
+    /**
144
+     * @return \OC\Files\Storage\Storage
145
+     * @throws \OCP\Files\NotFoundException
146
+     */
147
+    public function getStorage() {
148
+        list($storage,) = $this->view->resolvePath($this->path);
149
+        return $storage;
150
+    }
151
+
152
+    /**
153
+     * @return string
154
+     */
155
+    public function getPath() {
156
+        return $this->path;
157
+    }
158
+
159
+    /**
160
+     * @return string
161
+     */
162
+    public function getInternalPath() {
163
+        list(, $internalPath) = $this->view->resolvePath($this->path);
164
+        return $internalPath;
165
+    }
166
+
167
+    /**
168
+     * @return int
169
+     * @throws InvalidPathException
170
+     * @throws NotFoundException
171
+     */
172
+    public function getId() {
173
+        return $this->getFileInfo()->getId();
174
+    }
175
+
176
+    /**
177
+     * @return array
178
+     */
179
+    public function stat() {
180
+        return $this->view->stat($this->path);
181
+    }
182
+
183
+    /**
184
+     * @return int
185
+     * @throws InvalidPathException
186
+     * @throws NotFoundException
187
+     */
188
+    public function getMTime() {
189
+        return $this->getFileInfo()->getMTime();
190
+    }
191
+
192
+    /**
193
+     * @param bool $includeMounts
194
+     * @return int
195
+     * @throws InvalidPathException
196
+     * @throws NotFoundException
197
+     */
198
+    public function getSize($includeMounts = true) {
199
+        return $this->getFileInfo()->getSize($includeMounts);
200
+    }
201
+
202
+    /**
203
+     * @return string
204
+     * @throws InvalidPathException
205
+     * @throws NotFoundException
206
+     */
207
+    public function getEtag() {
208
+        return $this->getFileInfo()->getEtag();
209
+    }
210
+
211
+    /**
212
+     * @return int
213
+     * @throws InvalidPathException
214
+     * @throws NotFoundException
215
+     */
216
+    public function getPermissions() {
217
+        return $this->getFileInfo()->getPermissions();
218
+    }
219
+
220
+    /**
221
+     * @return bool
222
+     * @throws InvalidPathException
223
+     * @throws NotFoundException
224
+     */
225
+    public function isReadable() {
226
+        return $this->getFileInfo()->isReadable();
227
+    }
228
+
229
+    /**
230
+     * @return bool
231
+     * @throws InvalidPathException
232
+     * @throws NotFoundException
233
+     */
234
+    public function isUpdateable() {
235
+        return $this->getFileInfo()->isUpdateable();
236
+    }
237
+
238
+    /**
239
+     * @return bool
240
+     * @throws InvalidPathException
241
+     * @throws NotFoundException
242
+     */
243
+    public function isDeletable() {
244
+        return $this->getFileInfo()->isDeletable();
245
+    }
246
+
247
+    /**
248
+     * @return bool
249
+     * @throws InvalidPathException
250
+     * @throws NotFoundException
251
+     */
252
+    public function isShareable() {
253
+        return $this->getFileInfo()->isShareable();
254
+    }
255
+
256
+    /**
257
+     * @return bool
258
+     * @throws InvalidPathException
259
+     * @throws NotFoundException
260
+     */
261
+    public function isCreatable() {
262
+        return $this->getFileInfo()->isCreatable();
263
+    }
264
+
265
+    /**
266
+     * @return Node
267
+     */
268
+    public function getParent() {
269
+        $newPath = dirname($this->path);
270
+        if ($newPath === '' || $newPath === '.' || $newPath === '/') {
271
+            return $this->root;
272
+        }
273
+        return $this->root->get($newPath);
274
+    }
275
+
276
+    /**
277
+     * @return string
278
+     */
279
+    public function getName() {
280
+        return basename($this->path);
281
+    }
282
+
283
+    /**
284
+     * @param string $path
285
+     * @return string
286
+     */
287
+    protected function normalizePath($path) {
288
+        if ($path === '' or $path === '/') {
289
+            return '/';
290
+        }
291
+        //no windows style slashes
292
+        $path = str_replace('\\', '/', $path);
293
+        //add leading slash
294
+        if ($path[0] !== '/') {
295
+            $path = '/' . $path;
296
+        }
297
+        //remove duplicate slashes
298
+        while (strpos($path, '//') !== false) {
299
+            $path = str_replace('//', '/', $path);
300
+        }
301
+        //remove trailing slash
302
+        $path = rtrim($path, '/');
303
+
304
+        return $path;
305
+    }
306
+
307
+    /**
308
+     * check if the requested path is valid
309
+     *
310
+     * @param string $path
311
+     * @return bool
312
+     */
313
+    public function isValidPath($path) {
314
+        if (!$path || $path[0] !== '/') {
315
+            $path = '/' . $path;
316
+        }
317
+        if (strstr($path, '/../') || strrchr($path, '/') === '/..') {
318
+            return false;
319
+        }
320
+        return true;
321
+    }
322
+
323
+    public function isMounted() {
324
+        return $this->getFileInfo()->isMounted();
325
+    }
326
+
327
+    public function isShared() {
328
+        return $this->getFileInfo()->isShared();
329
+    }
330
+
331
+    public function getMimeType() {
332
+        return $this->getFileInfo()->getMimetype();
333
+    }
334
+
335
+    public function getMimePart() {
336
+        return $this->getFileInfo()->getMimePart();
337
+    }
338
+
339
+    public function getType() {
340
+        return $this->getFileInfo()->getType();
341
+    }
342
+
343
+    public function isEncrypted() {
344
+        return $this->getFileInfo()->isEncrypted();
345
+    }
346
+
347
+    public function getMountPoint() {
348
+        return $this->getFileInfo()->getMountPoint();
349
+    }
350
+
351
+    public function getOwner() {
352
+        return $this->getFileInfo()->getOwner();
353
+    }
354
+
355
+    public function getChecksum() {
356
+    }
357
+
358
+    public function getExtension(): string {
359
+        return $this->getFileInfo()->getExtension();
360
+    }
361
+
362
+    /**
363
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
364
+     * @throws \OCP\Lock\LockedException
365
+     */
366
+    public function lock($type) {
367
+        $this->view->lockFile($this->path, $type);
368
+    }
369
+
370
+    /**
371
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
372
+     * @throws \OCP\Lock\LockedException
373
+     */
374
+    public function changeLock($type) {
375
+        $this->view->changeLock($this->path, $type);
376
+    }
377
+
378
+    /**
379
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
380
+     * @throws \OCP\Lock\LockedException
381
+     */
382
+    public function unlock($type) {
383
+        $this->view->unlockFile($this->path, $type);
384
+    }
385
+
386
+    /**
387
+     * @param string $targetPath
388
+     * @throws \OCP\Files\NotPermittedException if copy not allowed or failed
389
+     * @return \OC\Files\Node\Node
390
+     */
391
+    public function copy($targetPath) {
392
+        $targetPath = $this->normalizePath($targetPath);
393
+        $parent = $this->root->get(dirname($targetPath));
394
+        if ($parent instanceof Folder and $this->isValidPath($targetPath) and $parent->isCreatable()) {
395
+            $nonExisting = $this->createNonExistingNode($targetPath);
396
+            $this->root->emit('\OC\Files', 'preCopy', [$this, $nonExisting]);
397
+            $this->root->emit('\OC\Files', 'preWrite', [$nonExisting]);
398
+            if (!$this->view->copy($this->path, $targetPath)) {
399
+                throw new NotPermittedException('Could not copy ' . $this->path . ' to ' . $targetPath);
400
+            }
401
+            $targetNode = $this->root->get($targetPath);
402
+            $this->root->emit('\OC\Files', 'postCopy', [$this, $targetNode]);
403
+            $this->root->emit('\OC\Files', 'postWrite', [$targetNode]);
404
+            return $targetNode;
405
+        } else {
406
+            throw new NotPermittedException('No permission to copy to path ' . $targetPath);
407
+        }
408
+    }
409
+
410
+    /**
411
+     * @param string $targetPath
412
+     * @throws \OCP\Files\NotPermittedException if move not allowed or failed
413
+     * @return \OC\Files\Node\Node
414
+     */
415
+    public function move($targetPath) {
416
+        $targetPath = $this->normalizePath($targetPath);
417
+        $parent = $this->root->get(dirname($targetPath));
418
+        if ($parent instanceof Folder and $this->isValidPath($targetPath) and $parent->isCreatable()) {
419
+            $nonExisting = $this->createNonExistingNode($targetPath);
420
+            $this->root->emit('\OC\Files', 'preRename', [$this, $nonExisting]);
421
+            $this->root->emit('\OC\Files', 'preWrite', [$nonExisting]);
422
+            if (!$this->view->rename($this->path, $targetPath)) {
423
+                throw new NotPermittedException('Could not move ' . $this->path . ' to ' . $targetPath);
424
+            }
425
+            $targetNode = $this->root->get($targetPath);
426
+            $this->root->emit('\OC\Files', 'postRename', [$this, $targetNode]);
427
+            $this->root->emit('\OC\Files', 'postWrite', [$targetNode]);
428
+            $this->path = $targetPath;
429
+            return $targetNode;
430
+        } else {
431
+            throw new NotPermittedException('No permission to move to path ' . $targetPath);
432
+        }
433
+    }
434 434
 
435 435
 }
Please login to merge, or discard this patch.
lib/private/Files/Node/LazyRoot.php 1 patch
Indentation   +447 added lines, -447 removed lines patch added patch discarded remove patch
@@ -33,451 +33,451 @@
 block discarded – undo
33 33
  * @package OC\Files\Node
34 34
  */
35 35
 class LazyRoot implements IRootFolder {
36
-	/** @var \Closure */
37
-	private $rootFolderClosure;
38
-
39
-	/** @var IRootFolder */
40
-	private $rootFolder;
41
-
42
-	/**
43
-	 * LazyRoot constructor.
44
-	 *
45
-	 * @param \Closure $rootFolderClosure
46
-	 */
47
-	public function __construct(\Closure $rootFolderClosure) {
48
-		$this->rootFolderClosure = $rootFolderClosure;
49
-	}
50
-
51
-	/**
52
-	 * Magic method to first get the real rootFolder and then
53
-	 * call $method with $args on it
54
-	 *
55
-	 * @param $method
56
-	 * @param $args
57
-	 * @return mixed
58
-	 */
59
-	public function __call($method, $args) {
60
-		if ($this->rootFolder === null) {
61
-			$this->rootFolder = call_user_func($this->rootFolderClosure);
62
-		}
63
-
64
-		return call_user_func_array([$this->rootFolder, $method], $args);
65
-	}
66
-
67
-	/**
68
-	 * @inheritDoc
69
-	 */
70
-	public function getUser() {
71
-		return $this->__call(__FUNCTION__, func_get_args());
72
-	}
73
-
74
-	/**
75
-	 * @inheritDoc
76
-	 */
77
-	public function listen($scope, $method, callable $callback) {
78
-		$this->__call(__FUNCTION__, func_get_args());
79
-	}
80
-
81
-	/**
82
-	 * @inheritDoc
83
-	 */
84
-	public function removeListener($scope = null, $method = null, callable $callback = null) {
85
-		$this->__call(__FUNCTION__, func_get_args());
86
-	}
87
-
88
-	/**
89
-	 * @inheritDoc
90
-	 */
91
-	public function emit($scope, $method, $arguments = array()) {
92
-		$this->__call(__FUNCTION__, func_get_args());
93
-	}
94
-
95
-	/**
96
-	 * @inheritDoc
97
-	 */
98
-	public function mount($storage, $mountPoint, $arguments = array()) {
99
-		$this->__call(__FUNCTION__, func_get_args());
100
-	}
101
-
102
-	/**
103
-	 * @inheritDoc
104
-	 */
105
-	public function getMount($mountPoint) {
106
-		return $this->__call(__FUNCTION__, func_get_args());
107
-	}
108
-
109
-	/**
110
-	 * @inheritDoc
111
-	 */
112
-	public function getMountsIn($mountPoint) {
113
-		return $this->__call(__FUNCTION__, func_get_args());
114
-	}
115
-
116
-	/**
117
-	 * @inheritDoc
118
-	 */
119
-	public function getMountByStorageId($storageId) {
120
-		return $this->__call(__FUNCTION__, func_get_args());
121
-	}
122
-
123
-	/**
124
-	 * @inheritDoc
125
-	 */
126
-	public function getMountByNumericStorageId($numericId) {
127
-		return $this->__call(__FUNCTION__, func_get_args());
128
-	}
129
-
130
-	/**
131
-	 * @inheritDoc
132
-	 */
133
-	public function unMount($mount) {
134
-		$this->__call(__FUNCTION__, func_get_args());
135
-	}
136
-
137
-	/**
138
-	 * @inheritDoc
139
-	 */
140
-	public function get($path) {
141
-		return $this->__call(__FUNCTION__, func_get_args());
142
-	}
143
-
144
-	/**
145
-	 * @inheritDoc
146
-	 */
147
-	public function rename($targetPath) {
148
-		return $this->__call(__FUNCTION__, func_get_args());
149
-	}
150
-
151
-	/**
152
-	 * @inheritDoc
153
-	 */
154
-	public function delete() {
155
-		return $this->__call(__FUNCTION__, func_get_args());
156
-	}
157
-
158
-	/**
159
-	 * @inheritDoc
160
-	 */
161
-	public function copy($targetPath) {
162
-		return $this->__call(__FUNCTION__, func_get_args());
163
-	}
164
-
165
-	/**
166
-	 * @inheritDoc
167
-	 */
168
-	public function touch($mtime = null) {
169
-		$this->__call(__FUNCTION__, func_get_args());
170
-	}
171
-
172
-	/**
173
-	 * @inheritDoc
174
-	 */
175
-	public function getStorage() {
176
-		return $this->__call(__FUNCTION__, func_get_args());
177
-	}
178
-
179
-	/**
180
-	 * @inheritDoc
181
-	 */
182
-	public function getPath() {
183
-		return $this->__call(__FUNCTION__, func_get_args());
184
-	}
185
-
186
-	/**
187
-	 * @inheritDoc
188
-	 */
189
-	public function getInternalPath() {
190
-		return $this->__call(__FUNCTION__, func_get_args());
191
-	}
192
-
193
-	/**
194
-	 * @inheritDoc
195
-	 */
196
-	public function getId() {
197
-		return $this->__call(__FUNCTION__, func_get_args());
198
-	}
199
-
200
-	/**
201
-	 * @inheritDoc
202
-	 */
203
-	public function stat() {
204
-		return $this->__call(__FUNCTION__, func_get_args());
205
-	}
206
-
207
-	/**
208
-	 * @inheritDoc
209
-	 */
210
-	public function getMTime() {
211
-		return $this->__call(__FUNCTION__, func_get_args());
212
-	}
213
-
214
-	/**
215
-	 * @inheritDoc
216
-	 */
217
-	public function getSize($includeMounts = true) {
218
-		return $this->__call(__FUNCTION__, func_get_args());
219
-	}
220
-
221
-	/**
222
-	 * @inheritDoc
223
-	 */
224
-	public function getEtag() {
225
-		return $this->__call(__FUNCTION__, func_get_args());
226
-	}
227
-
228
-	/**
229
-	 * @inheritDoc
230
-	 */
231
-	public function getPermissions() {
232
-		return $this->__call(__FUNCTION__, func_get_args());
233
-	}
234
-
235
-	/**
236
-	 * @inheritDoc
237
-	 */
238
-	public function isReadable() {
239
-		return $this->__call(__FUNCTION__, func_get_args());
240
-	}
241
-
242
-	/**
243
-	 * @inheritDoc
244
-	 */
245
-	public function isUpdateable() {
246
-		return $this->__call(__FUNCTION__, func_get_args());
247
-	}
248
-
249
-	/**
250
-	 * @inheritDoc
251
-	 */
252
-	public function isDeletable() {
253
-		return $this->__call(__FUNCTION__, func_get_args());
254
-	}
255
-
256
-	/**
257
-	 * @inheritDoc
258
-	 */
259
-	public function isShareable() {
260
-		return $this->__call(__FUNCTION__, func_get_args());
261
-	}
262
-
263
-	/**
264
-	 * @inheritDoc
265
-	 */
266
-	public function getParent() {
267
-		return $this->__call(__FUNCTION__, func_get_args());
268
-	}
269
-
270
-	/**
271
-	 * @inheritDoc
272
-	 */
273
-	public function getName() {
274
-		return $this->__call(__FUNCTION__, func_get_args());
275
-	}
276
-
277
-	/**
278
-	 * @inheritDoc
279
-	 */
280
-	public function getUserFolder($userId) {
281
-		return $this->__call(__FUNCTION__, func_get_args());
282
-	}
283
-
284
-	/**
285
-	 * @inheritDoc
286
-	 */
287
-	public function getMimetype() {
288
-		return $this->__call(__FUNCTION__, func_get_args());
289
-	}
290
-
291
-	/**
292
-	 * @inheritDoc
293
-	 */
294
-	public function getMimePart() {
295
-		return $this->__call(__FUNCTION__, func_get_args());
296
-	}
297
-
298
-	/**
299
-	 * @inheritDoc
300
-	 */
301
-	public function isEncrypted() {
302
-		return $this->__call(__FUNCTION__, func_get_args());
303
-	}
304
-
305
-	/**
306
-	 * @inheritDoc
307
-	 */
308
-	public function getType() {
309
-		return $this->__call(__FUNCTION__, func_get_args());
310
-	}
311
-
312
-	/**
313
-	 * @inheritDoc
314
-	 */
315
-	public function isShared() {
316
-		return $this->__call(__FUNCTION__, func_get_args());
317
-	}
318
-
319
-	/**
320
-	 * @inheritDoc
321
-	 */
322
-	public function isMounted() {
323
-		return $this->__call(__FUNCTION__, func_get_args());
324
-	}
325
-
326
-	/**
327
-	 * @inheritDoc
328
-	 */
329
-	public function getMountPoint() {
330
-		return $this->__call(__FUNCTION__, func_get_args());
331
-	}
332
-
333
-	/**
334
-	 * @inheritDoc
335
-	 */
336
-	public function getOwner() {
337
-		return $this->__call(__FUNCTION__, func_get_args());
338
-	}
339
-
340
-	/**
341
-	 * @inheritDoc
342
-	 */
343
-	public function getChecksum() {
344
-		return $this->__call(__FUNCTION__, func_get_args());
345
-	}
346
-
347
-	public function getExtension(): string {
348
-		return $this->__call(__FUNCTION__, func_get_args());
349
-	}
350
-
351
-	/**
352
-	 * @inheritDoc
353
-	 */
354
-	public function getFullPath($path) {
355
-		return $this->__call(__FUNCTION__, func_get_args());
356
-	}
357
-
358
-	/**
359
-	 * @inheritDoc
360
-	 */
361
-	public function getRelativePath($path) {
362
-		return $this->__call(__FUNCTION__, func_get_args());
363
-	}
364
-
365
-	/**
366
-	 * @inheritDoc
367
-	 */
368
-	public function isSubNode($node) {
369
-		return $this->__call(__FUNCTION__, func_get_args());
370
-	}
371
-
372
-	/**
373
-	 * @inheritDoc
374
-	 */
375
-	public function getDirectoryListing() {
376
-		return $this->__call(__FUNCTION__, func_get_args());
377
-	}
378
-
379
-	/**
380
-	 * @inheritDoc
381
-	 */
382
-	public function nodeExists($path) {
383
-		return $this->__call(__FUNCTION__, func_get_args());
384
-	}
385
-
386
-	/**
387
-	 * @inheritDoc
388
-	 */
389
-	public function newFolder($path) {
390
-		return $this->__call(__FUNCTION__, func_get_args());
391
-	}
392
-
393
-	/**
394
-	 * @inheritDoc
395
-	 */
396
-	public function newFile($path) {
397
-		return $this->__call(__FUNCTION__, func_get_args());
398
-	}
399
-
400
-	/**
401
-	 * @inheritDoc
402
-	 */
403
-	public function search($query) {
404
-		return $this->__call(__FUNCTION__, func_get_args());
405
-	}
406
-
407
-	/**
408
-	 * @inheritDoc
409
-	 */
410
-	public function searchByMime($mimetype) {
411
-		return $this->__call(__FUNCTION__, func_get_args());
412
-	}
413
-
414
-	/**
415
-	 * @inheritDoc
416
-	 */
417
-	public function searchByTag($tag, $userId) {
418
-		return $this->__call(__FUNCTION__, func_get_args());
419
-	}
420
-
421
-	/**
422
-	 * @inheritDoc
423
-	 */
424
-	public function getById($id) {
425
-		return $this->__call(__FUNCTION__, func_get_args());
426
-	}
427
-
428
-	/**
429
-	 * @inheritDoc
430
-	 */
431
-	public function getFreeSpace() {
432
-		return $this->__call(__FUNCTION__, func_get_args());
433
-	}
434
-
435
-	/**
436
-	 * @inheritDoc
437
-	 */
438
-	public function isCreatable() {
439
-		return $this->__call(__FUNCTION__, func_get_args());
440
-	}
441
-
442
-	/**
443
-	 * @inheritDoc
444
-	 */
445
-	public function getNonExistingName($name) {
446
-		return $this->__call(__FUNCTION__, func_get_args());
447
-	}
448
-
449
-	/**
450
-	 * @inheritDoc
451
-	 */
452
-	public function move($targetPath) {
453
-		return $this->__call(__FUNCTION__, func_get_args());
454
-	}
455
-
456
-	/**
457
-	 * @inheritDoc
458
-	 */
459
-	public function lock($type) {
460
-		return $this->__call(__FUNCTION__, func_get_args());
461
-	}
462
-
463
-	/**
464
-	 * @inheritDoc
465
-	 */
466
-	public function changeLock($targetType) {
467
-		return $this->__call(__FUNCTION__, func_get_args());
468
-	}
469
-
470
-	/**
471
-	 * @inheritDoc
472
-	 */
473
-	public function unlock($type) {
474
-		return $this->__call(__FUNCTION__, func_get_args());
475
-	}
476
-
477
-	/**
478
-	 * @inheritDoc
479
-	 */
480
-	public function getRecent($limit, $offset = 0) {
481
-		return $this->__call(__FUNCTION__, func_get_args());
482
-	}
36
+    /** @var \Closure */
37
+    private $rootFolderClosure;
38
+
39
+    /** @var IRootFolder */
40
+    private $rootFolder;
41
+
42
+    /**
43
+     * LazyRoot constructor.
44
+     *
45
+     * @param \Closure $rootFolderClosure
46
+     */
47
+    public function __construct(\Closure $rootFolderClosure) {
48
+        $this->rootFolderClosure = $rootFolderClosure;
49
+    }
50
+
51
+    /**
52
+     * Magic method to first get the real rootFolder and then
53
+     * call $method with $args on it
54
+     *
55
+     * @param $method
56
+     * @param $args
57
+     * @return mixed
58
+     */
59
+    public function __call($method, $args) {
60
+        if ($this->rootFolder === null) {
61
+            $this->rootFolder = call_user_func($this->rootFolderClosure);
62
+        }
63
+
64
+        return call_user_func_array([$this->rootFolder, $method], $args);
65
+    }
66
+
67
+    /**
68
+     * @inheritDoc
69
+     */
70
+    public function getUser() {
71
+        return $this->__call(__FUNCTION__, func_get_args());
72
+    }
73
+
74
+    /**
75
+     * @inheritDoc
76
+     */
77
+    public function listen($scope, $method, callable $callback) {
78
+        $this->__call(__FUNCTION__, func_get_args());
79
+    }
80
+
81
+    /**
82
+     * @inheritDoc
83
+     */
84
+    public function removeListener($scope = null, $method = null, callable $callback = null) {
85
+        $this->__call(__FUNCTION__, func_get_args());
86
+    }
87
+
88
+    /**
89
+     * @inheritDoc
90
+     */
91
+    public function emit($scope, $method, $arguments = array()) {
92
+        $this->__call(__FUNCTION__, func_get_args());
93
+    }
94
+
95
+    /**
96
+     * @inheritDoc
97
+     */
98
+    public function mount($storage, $mountPoint, $arguments = array()) {
99
+        $this->__call(__FUNCTION__, func_get_args());
100
+    }
101
+
102
+    /**
103
+     * @inheritDoc
104
+     */
105
+    public function getMount($mountPoint) {
106
+        return $this->__call(__FUNCTION__, func_get_args());
107
+    }
108
+
109
+    /**
110
+     * @inheritDoc
111
+     */
112
+    public function getMountsIn($mountPoint) {
113
+        return $this->__call(__FUNCTION__, func_get_args());
114
+    }
115
+
116
+    /**
117
+     * @inheritDoc
118
+     */
119
+    public function getMountByStorageId($storageId) {
120
+        return $this->__call(__FUNCTION__, func_get_args());
121
+    }
122
+
123
+    /**
124
+     * @inheritDoc
125
+     */
126
+    public function getMountByNumericStorageId($numericId) {
127
+        return $this->__call(__FUNCTION__, func_get_args());
128
+    }
129
+
130
+    /**
131
+     * @inheritDoc
132
+     */
133
+    public function unMount($mount) {
134
+        $this->__call(__FUNCTION__, func_get_args());
135
+    }
136
+
137
+    /**
138
+     * @inheritDoc
139
+     */
140
+    public function get($path) {
141
+        return $this->__call(__FUNCTION__, func_get_args());
142
+    }
143
+
144
+    /**
145
+     * @inheritDoc
146
+     */
147
+    public function rename($targetPath) {
148
+        return $this->__call(__FUNCTION__, func_get_args());
149
+    }
150
+
151
+    /**
152
+     * @inheritDoc
153
+     */
154
+    public function delete() {
155
+        return $this->__call(__FUNCTION__, func_get_args());
156
+    }
157
+
158
+    /**
159
+     * @inheritDoc
160
+     */
161
+    public function copy($targetPath) {
162
+        return $this->__call(__FUNCTION__, func_get_args());
163
+    }
164
+
165
+    /**
166
+     * @inheritDoc
167
+     */
168
+    public function touch($mtime = null) {
169
+        $this->__call(__FUNCTION__, func_get_args());
170
+    }
171
+
172
+    /**
173
+     * @inheritDoc
174
+     */
175
+    public function getStorage() {
176
+        return $this->__call(__FUNCTION__, func_get_args());
177
+    }
178
+
179
+    /**
180
+     * @inheritDoc
181
+     */
182
+    public function getPath() {
183
+        return $this->__call(__FUNCTION__, func_get_args());
184
+    }
185
+
186
+    /**
187
+     * @inheritDoc
188
+     */
189
+    public function getInternalPath() {
190
+        return $this->__call(__FUNCTION__, func_get_args());
191
+    }
192
+
193
+    /**
194
+     * @inheritDoc
195
+     */
196
+    public function getId() {
197
+        return $this->__call(__FUNCTION__, func_get_args());
198
+    }
199
+
200
+    /**
201
+     * @inheritDoc
202
+     */
203
+    public function stat() {
204
+        return $this->__call(__FUNCTION__, func_get_args());
205
+    }
206
+
207
+    /**
208
+     * @inheritDoc
209
+     */
210
+    public function getMTime() {
211
+        return $this->__call(__FUNCTION__, func_get_args());
212
+    }
213
+
214
+    /**
215
+     * @inheritDoc
216
+     */
217
+    public function getSize($includeMounts = true) {
218
+        return $this->__call(__FUNCTION__, func_get_args());
219
+    }
220
+
221
+    /**
222
+     * @inheritDoc
223
+     */
224
+    public function getEtag() {
225
+        return $this->__call(__FUNCTION__, func_get_args());
226
+    }
227
+
228
+    /**
229
+     * @inheritDoc
230
+     */
231
+    public function getPermissions() {
232
+        return $this->__call(__FUNCTION__, func_get_args());
233
+    }
234
+
235
+    /**
236
+     * @inheritDoc
237
+     */
238
+    public function isReadable() {
239
+        return $this->__call(__FUNCTION__, func_get_args());
240
+    }
241
+
242
+    /**
243
+     * @inheritDoc
244
+     */
245
+    public function isUpdateable() {
246
+        return $this->__call(__FUNCTION__, func_get_args());
247
+    }
248
+
249
+    /**
250
+     * @inheritDoc
251
+     */
252
+    public function isDeletable() {
253
+        return $this->__call(__FUNCTION__, func_get_args());
254
+    }
255
+
256
+    /**
257
+     * @inheritDoc
258
+     */
259
+    public function isShareable() {
260
+        return $this->__call(__FUNCTION__, func_get_args());
261
+    }
262
+
263
+    /**
264
+     * @inheritDoc
265
+     */
266
+    public function getParent() {
267
+        return $this->__call(__FUNCTION__, func_get_args());
268
+    }
269
+
270
+    /**
271
+     * @inheritDoc
272
+     */
273
+    public function getName() {
274
+        return $this->__call(__FUNCTION__, func_get_args());
275
+    }
276
+
277
+    /**
278
+     * @inheritDoc
279
+     */
280
+    public function getUserFolder($userId) {
281
+        return $this->__call(__FUNCTION__, func_get_args());
282
+    }
283
+
284
+    /**
285
+     * @inheritDoc
286
+     */
287
+    public function getMimetype() {
288
+        return $this->__call(__FUNCTION__, func_get_args());
289
+    }
290
+
291
+    /**
292
+     * @inheritDoc
293
+     */
294
+    public function getMimePart() {
295
+        return $this->__call(__FUNCTION__, func_get_args());
296
+    }
297
+
298
+    /**
299
+     * @inheritDoc
300
+     */
301
+    public function isEncrypted() {
302
+        return $this->__call(__FUNCTION__, func_get_args());
303
+    }
304
+
305
+    /**
306
+     * @inheritDoc
307
+     */
308
+    public function getType() {
309
+        return $this->__call(__FUNCTION__, func_get_args());
310
+    }
311
+
312
+    /**
313
+     * @inheritDoc
314
+     */
315
+    public function isShared() {
316
+        return $this->__call(__FUNCTION__, func_get_args());
317
+    }
318
+
319
+    /**
320
+     * @inheritDoc
321
+     */
322
+    public function isMounted() {
323
+        return $this->__call(__FUNCTION__, func_get_args());
324
+    }
325
+
326
+    /**
327
+     * @inheritDoc
328
+     */
329
+    public function getMountPoint() {
330
+        return $this->__call(__FUNCTION__, func_get_args());
331
+    }
332
+
333
+    /**
334
+     * @inheritDoc
335
+     */
336
+    public function getOwner() {
337
+        return $this->__call(__FUNCTION__, func_get_args());
338
+    }
339
+
340
+    /**
341
+     * @inheritDoc
342
+     */
343
+    public function getChecksum() {
344
+        return $this->__call(__FUNCTION__, func_get_args());
345
+    }
346
+
347
+    public function getExtension(): string {
348
+        return $this->__call(__FUNCTION__, func_get_args());
349
+    }
350
+
351
+    /**
352
+     * @inheritDoc
353
+     */
354
+    public function getFullPath($path) {
355
+        return $this->__call(__FUNCTION__, func_get_args());
356
+    }
357
+
358
+    /**
359
+     * @inheritDoc
360
+     */
361
+    public function getRelativePath($path) {
362
+        return $this->__call(__FUNCTION__, func_get_args());
363
+    }
364
+
365
+    /**
366
+     * @inheritDoc
367
+     */
368
+    public function isSubNode($node) {
369
+        return $this->__call(__FUNCTION__, func_get_args());
370
+    }
371
+
372
+    /**
373
+     * @inheritDoc
374
+     */
375
+    public function getDirectoryListing() {
376
+        return $this->__call(__FUNCTION__, func_get_args());
377
+    }
378
+
379
+    /**
380
+     * @inheritDoc
381
+     */
382
+    public function nodeExists($path) {
383
+        return $this->__call(__FUNCTION__, func_get_args());
384
+    }
385
+
386
+    /**
387
+     * @inheritDoc
388
+     */
389
+    public function newFolder($path) {
390
+        return $this->__call(__FUNCTION__, func_get_args());
391
+    }
392
+
393
+    /**
394
+     * @inheritDoc
395
+     */
396
+    public function newFile($path) {
397
+        return $this->__call(__FUNCTION__, func_get_args());
398
+    }
399
+
400
+    /**
401
+     * @inheritDoc
402
+     */
403
+    public function search($query) {
404
+        return $this->__call(__FUNCTION__, func_get_args());
405
+    }
406
+
407
+    /**
408
+     * @inheritDoc
409
+     */
410
+    public function searchByMime($mimetype) {
411
+        return $this->__call(__FUNCTION__, func_get_args());
412
+    }
413
+
414
+    /**
415
+     * @inheritDoc
416
+     */
417
+    public function searchByTag($tag, $userId) {
418
+        return $this->__call(__FUNCTION__, func_get_args());
419
+    }
420
+
421
+    /**
422
+     * @inheritDoc
423
+     */
424
+    public function getById($id) {
425
+        return $this->__call(__FUNCTION__, func_get_args());
426
+    }
427
+
428
+    /**
429
+     * @inheritDoc
430
+     */
431
+    public function getFreeSpace() {
432
+        return $this->__call(__FUNCTION__, func_get_args());
433
+    }
434
+
435
+    /**
436
+     * @inheritDoc
437
+     */
438
+    public function isCreatable() {
439
+        return $this->__call(__FUNCTION__, func_get_args());
440
+    }
441
+
442
+    /**
443
+     * @inheritDoc
444
+     */
445
+    public function getNonExistingName($name) {
446
+        return $this->__call(__FUNCTION__, func_get_args());
447
+    }
448
+
449
+    /**
450
+     * @inheritDoc
451
+     */
452
+    public function move($targetPath) {
453
+        return $this->__call(__FUNCTION__, func_get_args());
454
+    }
455
+
456
+    /**
457
+     * @inheritDoc
458
+     */
459
+    public function lock($type) {
460
+        return $this->__call(__FUNCTION__, func_get_args());
461
+    }
462
+
463
+    /**
464
+     * @inheritDoc
465
+     */
466
+    public function changeLock($targetType) {
467
+        return $this->__call(__FUNCTION__, func_get_args());
468
+    }
469
+
470
+    /**
471
+     * @inheritDoc
472
+     */
473
+    public function unlock($type) {
474
+        return $this->__call(__FUNCTION__, func_get_args());
475
+    }
476
+
477
+    /**
478
+     * @inheritDoc
479
+     */
480
+    public function getRecent($limit, $offset = 0) {
481
+        return $this->__call(__FUNCTION__, func_get_args());
482
+    }
483 483
 }
Please login to merge, or discard this patch.
lib/private/Files/Node/NonExistingFolder.php 1 patch
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -27,147 +27,147 @@
 block discarded – undo
27 27
 use OCP\Files\NotFoundException;
28 28
 
29 29
 class NonExistingFolder extends Folder {
30
-	/**
31
-	 * @param string $newPath
32
-	 * @throws \OCP\Files\NotFoundException
33
-	 */
34
-	public function rename($newPath) {
35
-		throw new NotFoundException();
36
-	}
37
-
38
-	public function delete() {
39
-		throw new NotFoundException();
40
-	}
41
-
42
-	public function copy($newPath) {
43
-		throw new NotFoundException();
44
-	}
45
-
46
-	public function touch($mtime = null) {
47
-		throw new NotFoundException();
48
-	}
49
-
50
-	public function getId() {
51
-		if ($this->fileInfo) {
52
-			return parent::getId();
53
-		} else {
54
-			throw new NotFoundException();
55
-		}
56
-	}
57
-
58
-	public function stat() {
59
-		throw new NotFoundException();
60
-	}
61
-
62
-	public function getMTime() {
63
-		if ($this->fileInfo) {
64
-			return parent::getMTime();
65
-		} else {
66
-			throw new NotFoundException();
67
-		}
68
-	}
69
-
70
-	public function getSize($includeMounts = true) {
71
-		if ($this->fileInfo) {
72
-			return parent::getSize($includeMounts);
73
-		} else {
74
-			throw new NotFoundException();
75
-		}
76
-	}
77
-
78
-	public function getEtag() {
79
-		if ($this->fileInfo) {
80
-			return parent::getEtag();
81
-		} else {
82
-			throw new NotFoundException();
83
-		}
84
-	}
85
-
86
-	public function getPermissions() {
87
-		if ($this->fileInfo) {
88
-			return parent::getPermissions();
89
-		} else {
90
-			throw new NotFoundException();
91
-		}
92
-	}
93
-
94
-	public function isReadable() {
95
-		if ($this->fileInfo) {
96
-			return parent::isReadable();
97
-		} else {
98
-			throw new NotFoundException();
99
-		}
100
-	}
101
-
102
-	public function isUpdateable() {
103
-		if ($this->fileInfo) {
104
-			return parent::isUpdateable();
105
-		} else {
106
-			throw new NotFoundException();
107
-		}
108
-	}
109
-
110
-	public function isDeletable() {
111
-		if ($this->fileInfo) {
112
-			return parent::isDeletable();
113
-		} else {
114
-			throw new NotFoundException();
115
-		}
116
-	}
117
-
118
-	public function isShareable() {
119
-		if ($this->fileInfo) {
120
-			return parent::isShareable();
121
-		} else {
122
-			throw new NotFoundException();
123
-		}
124
-	}
125
-
126
-	public function get($path) {
127
-		throw new NotFoundException();
128
-	}
129
-
130
-	public function getDirectoryListing() {
131
-		throw new NotFoundException();
132
-	}
133
-
134
-	public function nodeExists($path) {
135
-		return false;
136
-	}
137
-
138
-	public function newFolder($path) {
139
-		throw new NotFoundException();
140
-	}
141
-
142
-	public function newFile($path) {
143
-		throw new NotFoundException();
144
-	}
145
-
146
-	public function search($pattern) {
147
-		throw new NotFoundException();
148
-	}
149
-
150
-	public function searchByMime($mime) {
151
-		throw new NotFoundException();
152
-	}
153
-
154
-	public function searchByTag($tag, $userId) {
155
-		throw new NotFoundException();
156
-	}
157
-
158
-	public function getById($id) {
159
-		throw new NotFoundException();
160
-	}
161
-
162
-	public function getFreeSpace() {
163
-		throw new NotFoundException();
164
-	}
165
-
166
-	public function isCreatable() {
167
-		if ($this->fileInfo) {
168
-			return parent::isCreatable();
169
-		} else {
170
-			throw new NotFoundException();
171
-		}
172
-	}
30
+    /**
31
+     * @param string $newPath
32
+     * @throws \OCP\Files\NotFoundException
33
+     */
34
+    public function rename($newPath) {
35
+        throw new NotFoundException();
36
+    }
37
+
38
+    public function delete() {
39
+        throw new NotFoundException();
40
+    }
41
+
42
+    public function copy($newPath) {
43
+        throw new NotFoundException();
44
+    }
45
+
46
+    public function touch($mtime = null) {
47
+        throw new NotFoundException();
48
+    }
49
+
50
+    public function getId() {
51
+        if ($this->fileInfo) {
52
+            return parent::getId();
53
+        } else {
54
+            throw new NotFoundException();
55
+        }
56
+    }
57
+
58
+    public function stat() {
59
+        throw new NotFoundException();
60
+    }
61
+
62
+    public function getMTime() {
63
+        if ($this->fileInfo) {
64
+            return parent::getMTime();
65
+        } else {
66
+            throw new NotFoundException();
67
+        }
68
+    }
69
+
70
+    public function getSize($includeMounts = true) {
71
+        if ($this->fileInfo) {
72
+            return parent::getSize($includeMounts);
73
+        } else {
74
+            throw new NotFoundException();
75
+        }
76
+    }
77
+
78
+    public function getEtag() {
79
+        if ($this->fileInfo) {
80
+            return parent::getEtag();
81
+        } else {
82
+            throw new NotFoundException();
83
+        }
84
+    }
85
+
86
+    public function getPermissions() {
87
+        if ($this->fileInfo) {
88
+            return parent::getPermissions();
89
+        } else {
90
+            throw new NotFoundException();
91
+        }
92
+    }
93
+
94
+    public function isReadable() {
95
+        if ($this->fileInfo) {
96
+            return parent::isReadable();
97
+        } else {
98
+            throw new NotFoundException();
99
+        }
100
+    }
101
+
102
+    public function isUpdateable() {
103
+        if ($this->fileInfo) {
104
+            return parent::isUpdateable();
105
+        } else {
106
+            throw new NotFoundException();
107
+        }
108
+    }
109
+
110
+    public function isDeletable() {
111
+        if ($this->fileInfo) {
112
+            return parent::isDeletable();
113
+        } else {
114
+            throw new NotFoundException();
115
+        }
116
+    }
117
+
118
+    public function isShareable() {
119
+        if ($this->fileInfo) {
120
+            return parent::isShareable();
121
+        } else {
122
+            throw new NotFoundException();
123
+        }
124
+    }
125
+
126
+    public function get($path) {
127
+        throw new NotFoundException();
128
+    }
129
+
130
+    public function getDirectoryListing() {
131
+        throw new NotFoundException();
132
+    }
133
+
134
+    public function nodeExists($path) {
135
+        return false;
136
+    }
137
+
138
+    public function newFolder($path) {
139
+        throw new NotFoundException();
140
+    }
141
+
142
+    public function newFile($path) {
143
+        throw new NotFoundException();
144
+    }
145
+
146
+    public function search($pattern) {
147
+        throw new NotFoundException();
148
+    }
149
+
150
+    public function searchByMime($mime) {
151
+        throw new NotFoundException();
152
+    }
153
+
154
+    public function searchByTag($tag, $userId) {
155
+        throw new NotFoundException();
156
+    }
157
+
158
+    public function getById($id) {
159
+        throw new NotFoundException();
160
+    }
161
+
162
+    public function getFreeSpace() {
163
+        throw new NotFoundException();
164
+    }
165
+
166
+    public function isCreatable() {
167
+        if ($this->fileInfo) {
168
+            return parent::isCreatable();
169
+        } else {
170
+            throw new NotFoundException();
171
+        }
172
+    }
173 173
 }
Please login to merge, or discard this patch.
lib/public/Files/FileInfo.php 1 patch
Indentation   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -34,238 +34,238 @@
 block discarded – undo
34 34
  * @since 7.0.0
35 35
  */
36 36
 interface FileInfo {
37
-	/**
38
-	 * @since 7.0.0
39
-	 */
40
-	const TYPE_FILE = 'file';
41
-	/**
42
-	 * @since 7.0.0
43
-	 */
44
-	const TYPE_FOLDER = 'dir';
37
+    /**
38
+     * @since 7.0.0
39
+     */
40
+    const TYPE_FILE = 'file';
41
+    /**
42
+     * @since 7.0.0
43
+     */
44
+    const TYPE_FOLDER = 'dir';
45 45
 
46
-	/**
47
-	 * @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value
48
-	 * @since 8.0.0
49
-	 */
50
-	const SPACE_NOT_COMPUTED = -1;
51
-	/**
52
-	 * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value
53
-	 * @since 8.0.0
54
-	 */
55
-	const SPACE_UNKNOWN = -2;
56
-	/**
57
-	 * @const \OCP\Files\FileInfo::SPACE_UNLIMITED Return value for unlimited space
58
-	 * @since 8.0.0
59
-	 */
60
-	const SPACE_UNLIMITED = -3;
46
+    /**
47
+     * @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value
48
+     * @since 8.0.0
49
+     */
50
+    const SPACE_NOT_COMPUTED = -1;
51
+    /**
52
+     * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value
53
+     * @since 8.0.0
54
+     */
55
+    const SPACE_UNKNOWN = -2;
56
+    /**
57
+     * @const \OCP\Files\FileInfo::SPACE_UNLIMITED Return value for unlimited space
58
+     * @since 8.0.0
59
+     */
60
+    const SPACE_UNLIMITED = -3;
61 61
 
62
-	/**
63
-	 * @since 9.1.0
64
-	 */
65
-	const MIMETYPE_FOLDER = 'httpd/unix-directory';
62
+    /**
63
+     * @since 9.1.0
64
+     */
65
+    const MIMETYPE_FOLDER = 'httpd/unix-directory';
66 66
 
67
-	/**
68
-	 * @const \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX Return regular expression to test filenames against (blacklisting)
69
-	 * @since 12.0.0
70
-	 */
71
-	const BLACKLIST_FILES_REGEX = '\.(part|filepart)$';
67
+    /**
68
+     * @const \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX Return regular expression to test filenames against (blacklisting)
69
+     * @since 12.0.0
70
+     */
71
+    const BLACKLIST_FILES_REGEX = '\.(part|filepart)$';
72 72
 
73
-	/**
74
-	 * Get the Etag of the file or folder
75
-	 *
76
-	 * @return string
77
-	 * @since 7.0.0
78
-	 */
79
-	public function getEtag();
73
+    /**
74
+     * Get the Etag of the file or folder
75
+     *
76
+     * @return string
77
+     * @since 7.0.0
78
+     */
79
+    public function getEtag();
80 80
 
81
-	/**
82
-	 * Get the size in bytes for the file or folder
83
-	 *
84
-	 * @param bool $includeMounts whether or not to include the size of any sub mounts, since 16.0.0
85
-	 * @return int
86
-	 * @since 7.0.0
87
-	 */
88
-	public function getSize($includeMounts = true);
81
+    /**
82
+     * Get the size in bytes for the file or folder
83
+     *
84
+     * @param bool $includeMounts whether or not to include the size of any sub mounts, since 16.0.0
85
+     * @return int
86
+     * @since 7.0.0
87
+     */
88
+    public function getSize($includeMounts = true);
89 89
 
90
-	/**
91
-	 * Get the last modified date as timestamp for the file or folder
92
-	 *
93
-	 * @return int
94
-	 * @since 7.0.0
95
-	 */
96
-	public function getMtime();
90
+    /**
91
+     * Get the last modified date as timestamp for the file or folder
92
+     *
93
+     * @return int
94
+     * @since 7.0.0
95
+     */
96
+    public function getMtime();
97 97
 
98
-	/**
99
-	 * Get the name of the file or folder
100
-	 *
101
-	 * @return string
102
-	 * @since 7.0.0
103
-	 */
104
-	public function getName();
98
+    /**
99
+     * Get the name of the file or folder
100
+     *
101
+     * @return string
102
+     * @since 7.0.0
103
+     */
104
+    public function getName();
105 105
 
106
-	/**
107
-	 * Get the path relative to the storage
108
-	 *
109
-	 * @return string
110
-	 * @since 7.0.0
111
-	 */
112
-	public function getInternalPath();
106
+    /**
107
+     * Get the path relative to the storage
108
+     *
109
+     * @return string
110
+     * @since 7.0.0
111
+     */
112
+    public function getInternalPath();
113 113
 
114
-	/**
115
-	 * Get the absolute path
116
-	 *
117
-	 * @return string
118
-	 * @since 7.0.0
119
-	 */
120
-	public function getPath();
114
+    /**
115
+     * Get the absolute path
116
+     *
117
+     * @return string
118
+     * @since 7.0.0
119
+     */
120
+    public function getPath();
121 121
 
122
-	/**
123
-	 * Get the full mimetype of the file or folder i.e. 'image/png'
124
-	 *
125
-	 * @return string
126
-	 * @since 7.0.0
127
-	 */
128
-	public function getMimetype();
122
+    /**
123
+     * Get the full mimetype of the file or folder i.e. 'image/png'
124
+     *
125
+     * @return string
126
+     * @since 7.0.0
127
+     */
128
+    public function getMimetype();
129 129
 
130
-	/**
131
-	 * Get the first part of the mimetype of the file or folder i.e. 'image'
132
-	 *
133
-	 * @return string
134
-	 * @since 7.0.0
135
-	 */
136
-	public function getMimePart();
130
+    /**
131
+     * Get the first part of the mimetype of the file or folder i.e. 'image'
132
+     *
133
+     * @return string
134
+     * @since 7.0.0
135
+     */
136
+    public function getMimePart();
137 137
 
138
-	/**
139
-	 * Get the storage the file or folder is storage on
140
-	 *
141
-	 * @return \OCP\Files\Storage
142
-	 * @since 7.0.0
143
-	 */
144
-	public function getStorage();
138
+    /**
139
+     * Get the storage the file or folder is storage on
140
+     *
141
+     * @return \OCP\Files\Storage
142
+     * @since 7.0.0
143
+     */
144
+    public function getStorage();
145 145
 
146
-	/**
147
-	 * Get the file id of the file or folder
148
-	 *
149
-	 * @return int|null
150
-	 * @since 7.0.0
151
-	 */
152
-	public function getId();
146
+    /**
147
+     * Get the file id of the file or folder
148
+     *
149
+     * @return int|null
150
+     * @since 7.0.0
151
+     */
152
+    public function getId();
153 153
 
154
-	/**
155
-	 * Check whether the file is encrypted
156
-	 *
157
-	 * @return bool
158
-	 * @since 7.0.0
159
-	 */
160
-	public function isEncrypted();
154
+    /**
155
+     * Check whether the file is encrypted
156
+     *
157
+     * @return bool
158
+     * @since 7.0.0
159
+     */
160
+    public function isEncrypted();
161 161
 
162
-	/**
163
-	 * Get the permissions of the file or folder as bitmasked combination of the following constants
164
-	 * \OCP\Constants::PERMISSION_CREATE
165
-	 * \OCP\Constants::PERMISSION_READ
166
-	 * \OCP\Constants::PERMISSION_UPDATE
167
-	 * \OCP\Constants::PERMISSION_DELETE
168
-	 * \OCP\Constants::PERMISSION_SHARE
169
-	 * \OCP\Constants::PERMISSION_ALL
170
-	 *
171
-	 * @return int
172
-	 * @since 7.0.0 - namespace of constants has changed in 8.0.0
173
-	 */
174
-	public function getPermissions();
162
+    /**
163
+     * Get the permissions of the file or folder as bitmasked combination of the following constants
164
+     * \OCP\Constants::PERMISSION_CREATE
165
+     * \OCP\Constants::PERMISSION_READ
166
+     * \OCP\Constants::PERMISSION_UPDATE
167
+     * \OCP\Constants::PERMISSION_DELETE
168
+     * \OCP\Constants::PERMISSION_SHARE
169
+     * \OCP\Constants::PERMISSION_ALL
170
+     *
171
+     * @return int
172
+     * @since 7.0.0 - namespace of constants has changed in 8.0.0
173
+     */
174
+    public function getPermissions();
175 175
 
176
-	/**
177
-	 * Check whether this is a file or a folder
178
-	 *
179
-	 * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
180
-	 * @since 7.0.0
181
-	 */
182
-	public function getType();
176
+    /**
177
+     * Check whether this is a file or a folder
178
+     *
179
+     * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
180
+     * @since 7.0.0
181
+     */
182
+    public function getType();
183 183
 
184
-	/**
185
-	 * Check if the file or folder is readable
186
-	 *
187
-	 * @return bool
188
-	 * @since 7.0.0
189
-	 */
190
-	public function isReadable();
184
+    /**
185
+     * Check if the file or folder is readable
186
+     *
187
+     * @return bool
188
+     * @since 7.0.0
189
+     */
190
+    public function isReadable();
191 191
 
192
-	/**
193
-	 * Check if a file is writable
194
-	 *
195
-	 * @return bool
196
-	 * @since 7.0.0
197
-	 */
198
-	public function isUpdateable();
192
+    /**
193
+     * Check if a file is writable
194
+     *
195
+     * @return bool
196
+     * @since 7.0.0
197
+     */
198
+    public function isUpdateable();
199 199
 
200
-	/**
201
-	 * Check whether new files or folders can be created inside this folder
202
-	 *
203
-	 * @return bool
204
-	 * @since 8.0.0
205
-	 */
206
-	public function isCreatable();
200
+    /**
201
+     * Check whether new files or folders can be created inside this folder
202
+     *
203
+     * @return bool
204
+     * @since 8.0.0
205
+     */
206
+    public function isCreatable();
207 207
 
208
-	/**
209
-	 * Check if a file or folder can be deleted
210
-	 *
211
-	 * @return bool
212
-	 * @since 7.0.0
213
-	 */
214
-	public function isDeletable();
208
+    /**
209
+     * Check if a file or folder can be deleted
210
+     *
211
+     * @return bool
212
+     * @since 7.0.0
213
+     */
214
+    public function isDeletable();
215 215
 
216
-	/**
217
-	 * Check if a file or folder can be shared
218
-	 *
219
-	 * @return bool
220
-	 * @since 7.0.0
221
-	 */
222
-	public function isShareable();
216
+    /**
217
+     * Check if a file or folder can be shared
218
+     *
219
+     * @return bool
220
+     * @since 7.0.0
221
+     */
222
+    public function isShareable();
223 223
 
224
-	/**
225
-	 * Check if a file or folder is shared
226
-	 *
227
-	 * @return bool
228
-	 * @since 7.0.0
229
-	 */
230
-	public function isShared();
224
+    /**
225
+     * Check if a file or folder is shared
226
+     *
227
+     * @return bool
228
+     * @since 7.0.0
229
+     */
230
+    public function isShared();
231 231
 
232
-	/**
233
-	 * Check if a file or folder is mounted
234
-	 *
235
-	 * @return bool
236
-	 * @since 7.0.0
237
-	 */
238
-	public function isMounted();
232
+    /**
233
+     * Check if a file or folder is mounted
234
+     *
235
+     * @return bool
236
+     * @since 7.0.0
237
+     */
238
+    public function isMounted();
239 239
 
240
-	/**
241
-	 * Get the mountpoint the file belongs to
242
-	 *
243
-	 * @return \OCP\Files\Mount\IMountPoint
244
-	 * @since 8.0.0
245
-	 */
246
-	public function getMountPoint();
240
+    /**
241
+     * Get the mountpoint the file belongs to
242
+     *
243
+     * @return \OCP\Files\Mount\IMountPoint
244
+     * @since 8.0.0
245
+     */
246
+    public function getMountPoint();
247 247
 
248
-	/**
249
-	 * Get the owner of the file
250
-	 *
251
-	 * @return \OCP\IUser
252
-	 * @since 9.0.0
253
-	 */
254
-	public function getOwner();
248
+    /**
249
+     * Get the owner of the file
250
+     *
251
+     * @return \OCP\IUser
252
+     * @since 9.0.0
253
+     */
254
+    public function getOwner();
255 255
 
256
-	/**
257
-	 * Get the stored checksum for this file
258
-	 *
259
-	 * @return string
260
-	 * @since 9.0.0
261
-	 */
262
-	public function getChecksum();
256
+    /**
257
+     * Get the stored checksum for this file
258
+     *
259
+     * @return string
260
+     * @since 9.0.0
261
+     */
262
+    public function getChecksum();
263 263
 
264
-	/**
265
-	 * Get the extension of the file
266
-	 *
267
-	 * @return string
268
-	 * @since 15.0.0
269
-	 */
270
-	public function getExtension(): string;
264
+    /**
265
+     * Get the extension of the file
266
+     *
267
+     * @return string
268
+     * @since 15.0.0
269
+     */
270
+    public function getExtension(): string;
271 271
 }
Please login to merge, or discard this patch.
lib/public/Files/Node.php 1 patch
Indentation   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -40,242 +40,242 @@
 block discarded – undo
40 40
  * @since 6.0.0 - extends FileInfo was added in 8.0.0
41 41
  */
42 42
 interface Node extends FileInfo {
43
-	/**
44
-	 * Move the file or folder to a new location
45
-	 *
46
-	 * @param string $targetPath the absolute target path
47
-	 * @throws \OCP\Files\NotPermittedException
48
-	 * @return \OCP\Files\Node
49
-	 * @since 6.0.0
50
-	 */
51
-	public function move($targetPath);
43
+    /**
44
+     * Move the file or folder to a new location
45
+     *
46
+     * @param string $targetPath the absolute target path
47
+     * @throws \OCP\Files\NotPermittedException
48
+     * @return \OCP\Files\Node
49
+     * @since 6.0.0
50
+     */
51
+    public function move($targetPath);
52 52
 
53
-	/**
54
-	 * Delete the file or folder
55
-	 * @return void
56
-	 * @since 6.0.0
57
-	 */
58
-	public function delete();
53
+    /**
54
+     * Delete the file or folder
55
+     * @return void
56
+     * @since 6.0.0
57
+     */
58
+    public function delete();
59 59
 
60
-	/**
61
-	 * Cope the file or folder to a new location
62
-	 *
63
-	 * @param string $targetPath the absolute target path
64
-	 * @return \OCP\Files\Node
65
-	 * @since 6.0.0
66
-	 */
67
-	public function copy($targetPath);
60
+    /**
61
+     * Cope the file or folder to a new location
62
+     *
63
+     * @param string $targetPath the absolute target path
64
+     * @return \OCP\Files\Node
65
+     * @since 6.0.0
66
+     */
67
+    public function copy($targetPath);
68 68
 
69
-	/**
70
-	 * Change the modified date of the file or folder
71
-	 * If $mtime is omitted the current time will be used
72
-	 *
73
-	 * @param int $mtime (optional) modified date as unix timestamp
74
-	 * @throws \OCP\Files\NotPermittedException
75
-	 * @return void
76
-	 * @since 6.0.0
77
-	 */
78
-	public function touch($mtime = null);
69
+    /**
70
+     * Change the modified date of the file or folder
71
+     * If $mtime is omitted the current time will be used
72
+     *
73
+     * @param int $mtime (optional) modified date as unix timestamp
74
+     * @throws \OCP\Files\NotPermittedException
75
+     * @return void
76
+     * @since 6.0.0
77
+     */
78
+    public function touch($mtime = null);
79 79
 
80
-	/**
81
-	 * Get the storage backend the file or folder is stored on
82
-	 *
83
-	 * @return \OCP\Files\Storage
84
-	 * @throws \OCP\Files\NotFoundException
85
-	 * @since 6.0.0
86
-	 */
87
-	public function getStorage();
80
+    /**
81
+     * Get the storage backend the file or folder is stored on
82
+     *
83
+     * @return \OCP\Files\Storage
84
+     * @throws \OCP\Files\NotFoundException
85
+     * @since 6.0.0
86
+     */
87
+    public function getStorage();
88 88
 
89
-	/**
90
-	 * Get the full path of the file or folder
91
-	 *
92
-	 * @return string
93
-	 * @since 6.0.0
94
-	 */
95
-	public function getPath();
89
+    /**
90
+     * Get the full path of the file or folder
91
+     *
92
+     * @return string
93
+     * @since 6.0.0
94
+     */
95
+    public function getPath();
96 96
 
97
-	/**
98
-	 * Get the path of the file or folder relative to the mountpoint of it's storage
99
-	 *
100
-	 * @return string
101
-	 * @since 6.0.0
102
-	 */
103
-	public function getInternalPath();
97
+    /**
98
+     * Get the path of the file or folder relative to the mountpoint of it's storage
99
+     *
100
+     * @return string
101
+     * @since 6.0.0
102
+     */
103
+    public function getInternalPath();
104 104
 
105
-	/**
106
-	 * Get the internal file id for the file or folder
107
-	 *
108
-	 * @return int
109
-	 * @throws InvalidPathException
110
-	 * @throws NotFoundException
111
-	 * @since 6.0.0
112
-	 */
113
-	public function getId();
105
+    /**
106
+     * Get the internal file id for the file or folder
107
+     *
108
+     * @return int
109
+     * @throws InvalidPathException
110
+     * @throws NotFoundException
111
+     * @since 6.0.0
112
+     */
113
+    public function getId();
114 114
 
115
-	/**
116
-	 * Get metadata of the file or folder
117
-	 * The returned array contains the following values:
118
-	 *  - mtime
119
-	 *  - size
120
-	 *
121
-	 * @return array
122
-	 * @since 6.0.0
123
-	 */
124
-	public function stat();
115
+    /**
116
+     * Get metadata of the file or folder
117
+     * The returned array contains the following values:
118
+     *  - mtime
119
+     *  - size
120
+     *
121
+     * @return array
122
+     * @since 6.0.0
123
+     */
124
+    public function stat();
125 125
 
126
-	/**
127
-	 * Get the modified date of the file or folder as unix timestamp
128
-	 *
129
-	 * @return int
130
-	 * @throws InvalidPathException
131
-	 * @throws NotFoundException
132
-	 * @since 6.0.0
133
-	 */
134
-	public function getMTime();
126
+    /**
127
+     * Get the modified date of the file or folder as unix timestamp
128
+     *
129
+     * @return int
130
+     * @throws InvalidPathException
131
+     * @throws NotFoundException
132
+     * @since 6.0.0
133
+     */
134
+    public function getMTime();
135 135
 
136
-	/**
137
-	 * Get the size of the file or folder in bytes
138
-	 *
139
-	 * @param bool $includeMounts
140
-	 * @return int
141
-	 * @throws InvalidPathException
142
-	 * @throws NotFoundException
143
-	 * @since 6.0.0
144
-	 */
145
-	public function getSize($includeMounts = true);
136
+    /**
137
+     * Get the size of the file or folder in bytes
138
+     *
139
+     * @param bool $includeMounts
140
+     * @return int
141
+     * @throws InvalidPathException
142
+     * @throws NotFoundException
143
+     * @since 6.0.0
144
+     */
145
+    public function getSize($includeMounts = true);
146 146
 
147
-	/**
148
-	 * Get the Etag of the file or folder
149
-	 * The Etag is an string id used to detect changes to a file or folder,
150
-	 * every time the file or folder is changed the Etag will change to
151
-	 *
152
-	 * @return string
153
-	 * @throws InvalidPathException
154
-	 * @throws NotFoundException
155
-	 * @since 6.0.0
156
-	 */
157
-	public function getEtag();
147
+    /**
148
+     * Get the Etag of the file or folder
149
+     * The Etag is an string id used to detect changes to a file or folder,
150
+     * every time the file or folder is changed the Etag will change to
151
+     *
152
+     * @return string
153
+     * @throws InvalidPathException
154
+     * @throws NotFoundException
155
+     * @since 6.0.0
156
+     */
157
+    public function getEtag();
158 158
 
159 159
 
160
-	/**
161
-	 * Get the permissions of the file or folder as a combination of one or more of the following constants:
162
-	 *  - \OCP\Constants::PERMISSION_READ
163
-	 *  - \OCP\Constants::PERMISSION_UPDATE
164
-	 *  - \OCP\Constants::PERMISSION_CREATE
165
-	 *  - \OCP\Constants::PERMISSION_DELETE
166
-	 *  - \OCP\Constants::PERMISSION_SHARE
167
-	 *
168
-	 * @return int
169
-	 * @throws InvalidPathException
170
-	 * @throws NotFoundException
171
-	 * @since 6.0.0 - namespace of constants has changed in 8.0.0
172
-	 */
173
-	public function getPermissions();
160
+    /**
161
+     * Get the permissions of the file or folder as a combination of one or more of the following constants:
162
+     *  - \OCP\Constants::PERMISSION_READ
163
+     *  - \OCP\Constants::PERMISSION_UPDATE
164
+     *  - \OCP\Constants::PERMISSION_CREATE
165
+     *  - \OCP\Constants::PERMISSION_DELETE
166
+     *  - \OCP\Constants::PERMISSION_SHARE
167
+     *
168
+     * @return int
169
+     * @throws InvalidPathException
170
+     * @throws NotFoundException
171
+     * @since 6.0.0 - namespace of constants has changed in 8.0.0
172
+     */
173
+    public function getPermissions();
174 174
 
175
-	/**
176
-	 * Check if the file or folder is readable
177
-	 *
178
-	 * @return bool
179
-	 * @throws InvalidPathException
180
-	 * @throws NotFoundException
181
-	 * @since 6.0.0
182
-	 */
183
-	public function isReadable();
175
+    /**
176
+     * Check if the file or folder is readable
177
+     *
178
+     * @return bool
179
+     * @throws InvalidPathException
180
+     * @throws NotFoundException
181
+     * @since 6.0.0
182
+     */
183
+    public function isReadable();
184 184
 
185
-	/**
186
-	 * Check if the file or folder is writable
187
-	 *
188
-	 * @return bool
189
-	 * @throws InvalidPathException
190
-	 * @throws NotFoundException
191
-	 * @since 6.0.0
192
-	 */
193
-	public function isUpdateable();
185
+    /**
186
+     * Check if the file or folder is writable
187
+     *
188
+     * @return bool
189
+     * @throws InvalidPathException
190
+     * @throws NotFoundException
191
+     * @since 6.0.0
192
+     */
193
+    public function isUpdateable();
194 194
 
195
-	/**
196
-	 * Check if the file or folder is deletable
197
-	 *
198
-	 * @return bool
199
-	 * @throws InvalidPathException
200
-	 * @throws NotFoundException
201
-	 * @since 6.0.0
202
-	 */
203
-	public function isDeletable();
195
+    /**
196
+     * Check if the file or folder is deletable
197
+     *
198
+     * @return bool
199
+     * @throws InvalidPathException
200
+     * @throws NotFoundException
201
+     * @since 6.0.0
202
+     */
203
+    public function isDeletable();
204 204
 
205
-	/**
206
-	 * Check if the file or folder is shareable
207
-	 *
208
-	 * @return bool
209
-	 * @throws InvalidPathException
210
-	 * @throws NotFoundException
211
-	 * @since 6.0.0
212
-	 */
213
-	public function isShareable();
205
+    /**
206
+     * Check if the file or folder is shareable
207
+     *
208
+     * @return bool
209
+     * @throws InvalidPathException
210
+     * @throws NotFoundException
211
+     * @since 6.0.0
212
+     */
213
+    public function isShareable();
214 214
 
215
-	/**
216
-	 * Get the parent folder of the file or folder
217
-	 *
218
-	 * @return Folder
219
-	 * @since 6.0.0
220
-	 */
221
-	public function getParent();
215
+    /**
216
+     * Get the parent folder of the file or folder
217
+     *
218
+     * @return Folder
219
+     * @since 6.0.0
220
+     */
221
+    public function getParent();
222 222
 
223
-	/**
224
-	 * Get the filename of the file or folder
225
-	 *
226
-	 * @return string
227
-	 * @since 6.0.0
228
-	 */
229
-	public function getName();
223
+    /**
224
+     * Get the filename of the file or folder
225
+     *
226
+     * @return string
227
+     * @since 6.0.0
228
+     */
229
+    public function getName();
230 230
 
231
-	/**
232
-	 * Acquire a lock on this file or folder.
233
-	 *
234
-	 * A shared (read) lock will prevent any exclusive (write) locks from being created but any number of shared locks
235
-	 * can be active at the same time.
236
-	 * An exclusive lock will prevent any other lock from being created (both shared and exclusive).
237
-	 *
238
-	 * A locked exception will be thrown if any conflicting lock already exists
239
-	 *
240
-	 * Note that this uses mandatory locking, if you acquire an exclusive lock on a file it will block *all*
241
-	 * other operations for that file, even within the same php process.
242
-	 *
243
-	 * Acquiring any lock on a file will also create a shared lock on all parent folders of that file.
244
-	 *
245
-	 * Note that in most cases you won't need to manually manage the locks for any files you're working with,
246
-	 * any filesystem operation will automatically acquire the relevant locks for that operation.
247
-	 *
248
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
249
-	 * @throws \OCP\Lock\LockedException
250
-	 * @since 9.1.0
251
-	 */
252
-	public function lock($type);
231
+    /**
232
+     * Acquire a lock on this file or folder.
233
+     *
234
+     * A shared (read) lock will prevent any exclusive (write) locks from being created but any number of shared locks
235
+     * can be active at the same time.
236
+     * An exclusive lock will prevent any other lock from being created (both shared and exclusive).
237
+     *
238
+     * A locked exception will be thrown if any conflicting lock already exists
239
+     *
240
+     * Note that this uses mandatory locking, if you acquire an exclusive lock on a file it will block *all*
241
+     * other operations for that file, even within the same php process.
242
+     *
243
+     * Acquiring any lock on a file will also create a shared lock on all parent folders of that file.
244
+     *
245
+     * Note that in most cases you won't need to manually manage the locks for any files you're working with,
246
+     * any filesystem operation will automatically acquire the relevant locks for that operation.
247
+     *
248
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
249
+     * @throws \OCP\Lock\LockedException
250
+     * @since 9.1.0
251
+     */
252
+    public function lock($type);
253 253
 
254
-	/**
255
-	 * Check the type of an existing lock.
256
-	 *
257
-	 * A shared lock can be changed to an exclusive lock is there is exactly one shared lock on the file,
258
-	 * an exclusive lock can always be changed to a shared lock since there can only be one exclusive lock int he first place.
259
-	 *
260
-	 * A locked exception will be thrown when these preconditions are not met.
261
-	 * Note that this is also the case if no existing lock exists for the file.
262
-	 *
263
-	 * @param int $targetType \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
264
-	 * @throws \OCP\Lock\LockedException
265
-	 * @since 9.1.0
266
-	 */
267
-	public function changeLock($targetType);
254
+    /**
255
+     * Check the type of an existing lock.
256
+     *
257
+     * A shared lock can be changed to an exclusive lock is there is exactly one shared lock on the file,
258
+     * an exclusive lock can always be changed to a shared lock since there can only be one exclusive lock int he first place.
259
+     *
260
+     * A locked exception will be thrown when these preconditions are not met.
261
+     * Note that this is also the case if no existing lock exists for the file.
262
+     *
263
+     * @param int $targetType \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
264
+     * @throws \OCP\Lock\LockedException
265
+     * @since 9.1.0
266
+     */
267
+    public function changeLock($targetType);
268 268
 
269
-	/**
270
-	 * Release an existing lock.
271
-	 *
272
-	 * This will also free up the shared locks on any parent folder that were automatically acquired when locking the file.
273
-	 *
274
-	 * Note that this method will not give any sort of error when trying to free a lock that doesn't exist.
275
-	 *
276
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
277
-	 * @throws \OCP\Lock\LockedException
278
-	 * @since 9.1.0
279
-	 */
280
-	public function unlock($type);
269
+    /**
270
+     * Release an existing lock.
271
+     *
272
+     * This will also free up the shared locks on any parent folder that were automatically acquired when locking the file.
273
+     *
274
+     * Note that this method will not give any sort of error when trying to free a lock that doesn't exist.
275
+     *
276
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
277
+     * @throws \OCP\Lock\LockedException
278
+     * @since 9.1.0
279
+     */
280
+    public function unlock($type);
281 281
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Trash/TrashItem.php 1 patch
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -25,152 +25,152 @@
 block discarded – undo
25 25
 use OCP\IUser;
26 26
 
27 27
 class TrashItem implements ITrashItem {
28
-	/** @var ITrashBackend */
29
-	private $backend;
30
-	/** @var string */
31
-	private $orignalLocation;
32
-	/** @var int */
33
-	private $deletedTime;
34
-	/** @var string */
35
-	private $trashPath;
36
-	/** @var FileInfo */
37
-	private $fileInfo;
38
-	/** @var IUser */
39
-	private $user;
40
-
41
-	public function __construct(
42
-		ITrashBackend $backend,
43
-		string $originalLocation,
44
-		int $deletedTime,
45
-		string $trashPath,
46
-		FileInfo $fileInfo,
47
-		IUser $user
48
-	) {
49
-		$this->backend = $backend;
50
-		$this->orignalLocation = $originalLocation;
51
-		$this->deletedTime = $deletedTime;
52
-		$this->trashPath = $trashPath;
53
-		$this->fileInfo = $fileInfo;
54
-		$this->user = $user;
55
-	}
56
-
57
-	public function getTrashBackend(): ITrashBackend {
58
-		return $this->backend;
59
-	}
60
-
61
-	public function getOriginalLocation(): string {
62
-		return $this->orignalLocation;
63
-	}
64
-
65
-	public function getDeletedTime(): int {
66
-		return $this->deletedTime;
67
-	}
68
-
69
-	public function getTrashPath(): string {
70
-		return $this->trashPath;
71
-	}
72
-
73
-	public function isRootItem(): bool {
74
-		return substr_count($this->getTrashPath(), '/') === 1;
75
-	}
76
-
77
-	public function getUser(): IUser {
78
-		return $this->user;
79
-	}
80
-
81
-	public function getEtag() {
82
-		return $this->fileInfo->getEtag();
83
-	}
84
-
85
-	public function getSize($includeMounts = true) {
86
-		return $this->fileInfo->getSize($includeMounts);
87
-	}
88
-
89
-	public function getMtime() {
90
-		return $this->fileInfo->getMtime();
91
-	}
92
-
93
-	public function getName() {
94
-		return $this->fileInfo->getName();
95
-	}
96
-
97
-	public function getInternalPath() {
98
-		return $this->fileInfo->getInternalPath();
99
-	}
100
-
101
-	public function getPath() {
102
-		return $this->fileInfo->getPath();
103
-	}
104
-
105
-	public function getMimetype() {
106
-		return $this->fileInfo->getMimetype();
107
-	}
108
-
109
-	public function getMimePart() {
110
-		return $this->fileInfo->getMimePart();
111
-	}
112
-
113
-	public function getStorage() {
114
-		return $this->fileInfo->getStorage();
115
-	}
116
-
117
-	public function getId() {
118
-		return $this->fileInfo->getId();
119
-	}
120
-
121
-	public function isEncrypted() {
122
-		return $this->fileInfo->isEncrypted();
123
-	}
124
-
125
-	public function getPermissions() {
126
-		return $this->fileInfo->getPermissions();
127
-	}
128
-
129
-	public function getType() {
130
-		return $this->fileInfo->getType();
131
-	}
132
-
133
-	public function isReadable() {
134
-		return $this->fileInfo->isReadable();
135
-	}
136
-
137
-	public function isUpdateable() {
138
-		return $this->fileInfo->isUpdateable();
139
-	}
140
-
141
-	public function isCreatable() {
142
-		return $this->fileInfo->isCreatable();
143
-	}
144
-
145
-	public function isDeletable() {
146
-		return $this->fileInfo->isDeletable();
147
-	}
148
-
149
-	public function isShareable() {
150
-		return $this->fileInfo->isShareable();
151
-	}
152
-
153
-	public function isShared() {
154
-		return $this->fileInfo->isShared();
155
-	}
28
+    /** @var ITrashBackend */
29
+    private $backend;
30
+    /** @var string */
31
+    private $orignalLocation;
32
+    /** @var int */
33
+    private $deletedTime;
34
+    /** @var string */
35
+    private $trashPath;
36
+    /** @var FileInfo */
37
+    private $fileInfo;
38
+    /** @var IUser */
39
+    private $user;
40
+
41
+    public function __construct(
42
+        ITrashBackend $backend,
43
+        string $originalLocation,
44
+        int $deletedTime,
45
+        string $trashPath,
46
+        FileInfo $fileInfo,
47
+        IUser $user
48
+    ) {
49
+        $this->backend = $backend;
50
+        $this->orignalLocation = $originalLocation;
51
+        $this->deletedTime = $deletedTime;
52
+        $this->trashPath = $trashPath;
53
+        $this->fileInfo = $fileInfo;
54
+        $this->user = $user;
55
+    }
56
+
57
+    public function getTrashBackend(): ITrashBackend {
58
+        return $this->backend;
59
+    }
60
+
61
+    public function getOriginalLocation(): string {
62
+        return $this->orignalLocation;
63
+    }
64
+
65
+    public function getDeletedTime(): int {
66
+        return $this->deletedTime;
67
+    }
68
+
69
+    public function getTrashPath(): string {
70
+        return $this->trashPath;
71
+    }
72
+
73
+    public function isRootItem(): bool {
74
+        return substr_count($this->getTrashPath(), '/') === 1;
75
+    }
76
+
77
+    public function getUser(): IUser {
78
+        return $this->user;
79
+    }
80
+
81
+    public function getEtag() {
82
+        return $this->fileInfo->getEtag();
83
+    }
84
+
85
+    public function getSize($includeMounts = true) {
86
+        return $this->fileInfo->getSize($includeMounts);
87
+    }
88
+
89
+    public function getMtime() {
90
+        return $this->fileInfo->getMtime();
91
+    }
92
+
93
+    public function getName() {
94
+        return $this->fileInfo->getName();
95
+    }
96
+
97
+    public function getInternalPath() {
98
+        return $this->fileInfo->getInternalPath();
99
+    }
100
+
101
+    public function getPath() {
102
+        return $this->fileInfo->getPath();
103
+    }
104
+
105
+    public function getMimetype() {
106
+        return $this->fileInfo->getMimetype();
107
+    }
108
+
109
+    public function getMimePart() {
110
+        return $this->fileInfo->getMimePart();
111
+    }
112
+
113
+    public function getStorage() {
114
+        return $this->fileInfo->getStorage();
115
+    }
116
+
117
+    public function getId() {
118
+        return $this->fileInfo->getId();
119
+    }
120
+
121
+    public function isEncrypted() {
122
+        return $this->fileInfo->isEncrypted();
123
+    }
124
+
125
+    public function getPermissions() {
126
+        return $this->fileInfo->getPermissions();
127
+    }
128
+
129
+    public function getType() {
130
+        return $this->fileInfo->getType();
131
+    }
132
+
133
+    public function isReadable() {
134
+        return $this->fileInfo->isReadable();
135
+    }
136
+
137
+    public function isUpdateable() {
138
+        return $this->fileInfo->isUpdateable();
139
+    }
140
+
141
+    public function isCreatable() {
142
+        return $this->fileInfo->isCreatable();
143
+    }
144
+
145
+    public function isDeletable() {
146
+        return $this->fileInfo->isDeletable();
147
+    }
148
+
149
+    public function isShareable() {
150
+        return $this->fileInfo->isShareable();
151
+    }
152
+
153
+    public function isShared() {
154
+        return $this->fileInfo->isShared();
155
+    }
156 156
 
157
-	public function isMounted() {
158
-		return $this->fileInfo->isMounted();
159
-	}
157
+    public function isMounted() {
158
+        return $this->fileInfo->isMounted();
159
+    }
160 160
 
161
-	public function getMountPoint() {
162
-		return $this->fileInfo->getMountPoint();
163
-	}
161
+    public function getMountPoint() {
162
+        return $this->fileInfo->getMountPoint();
163
+    }
164 164
 
165
-	public function getOwner() {
166
-		return $this->fileInfo->getOwner();
167
-	}
165
+    public function getOwner() {
166
+        return $this->fileInfo->getOwner();
167
+    }
168 168
 
169
-	public function getChecksum() {
170
-		return $this->fileInfo->getChecksum();
171
-	}
169
+    public function getChecksum() {
170
+        return $this->fileInfo->getChecksum();
171
+    }
172 172
 
173
-	public function getExtension(): string {
174
-		return $this->fileInfo->getExtension();
175
-	}
173
+    public function getExtension(): string {
174
+        return $this->fileInfo->getExtension();
175
+    }
176 176
 }
Please login to merge, or discard this patch.