1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Roeland Jago Douma <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc. |
6
|
|
|
* @license AGPL-3.0 |
7
|
|
|
* |
8
|
|
|
* This code is free software: you can redistribute it and/or modify |
9
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
10
|
|
|
* as published by the Free Software Foundation. |
11
|
|
|
* |
12
|
|
|
* This program is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
|
|
|
* GNU Affero General Public License for more details. |
16
|
|
|
* |
17
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
19
|
|
|
* |
20
|
|
|
*/ |
21
|
|
|
namespace OC\Files\Node; |
22
|
|
|
|
23
|
|
|
use OC\Files\Mount\MountPoint; |
24
|
|
|
use OCP\Files\IRootFolder; |
25
|
|
|
use OCP\Files\NotPermittedException; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Class LazyRoot |
29
|
|
|
* |
30
|
|
|
* This is a lazy wrapper around the root. So only |
31
|
|
|
* once it is needed this will get initialized. |
32
|
|
|
* |
33
|
|
|
* @package OC\Files\Node |
34
|
|
|
*/ |
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
|
|
|
$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() { |
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
|
|
|
/** |
348
|
|
|
* @inheritDoc |
349
|
|
|
*/ |
350
|
|
|
public function getFullPath($path) { |
351
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
/** |
355
|
|
|
* @inheritDoc |
356
|
|
|
*/ |
357
|
|
|
public function getRelativePath($path) { |
358
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
/** |
362
|
|
|
* @inheritDoc |
363
|
|
|
*/ |
364
|
|
|
public function isSubNode($node) { |
365
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
/** |
369
|
|
|
* @inheritDoc |
370
|
|
|
*/ |
371
|
|
|
public function getDirectoryListing() { |
372
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* @inheritDoc |
377
|
|
|
*/ |
378
|
|
|
public function nodeExists($path) { |
379
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* @inheritDoc |
384
|
|
|
*/ |
385
|
|
|
public function newFolder($path) { |
386
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
/** |
390
|
|
|
* @inheritDoc |
391
|
|
|
*/ |
392
|
|
|
public function newFile($path) { |
393
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
/** |
397
|
|
|
* @inheritDoc |
398
|
|
|
*/ |
399
|
|
|
public function search($query) { |
400
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
/** |
404
|
|
|
* @inheritDoc |
405
|
|
|
*/ |
406
|
|
|
public function searchByMime($mimetype) { |
407
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
/** |
411
|
|
|
* @inheritDoc |
412
|
|
|
*/ |
413
|
|
|
public function searchByTag($tag, $userId) { |
414
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
/** |
418
|
|
|
* @inheritDoc |
419
|
|
|
*/ |
420
|
|
|
public function getById($id) { |
421
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
/** |
425
|
|
|
* @inheritDoc |
426
|
|
|
*/ |
427
|
|
|
public function getFreeSpace() { |
428
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
/** |
432
|
|
|
* @inheritDoc |
433
|
|
|
*/ |
434
|
|
|
public function isCreatable() { |
435
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
436
|
|
|
} |
437
|
|
|
|
438
|
|
|
/** |
439
|
|
|
* @inheritDoc |
440
|
|
|
*/ |
441
|
|
|
public function getNonExistingName($name) { |
442
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
443
|
|
|
} |
444
|
|
|
|
445
|
|
|
/** |
446
|
|
|
* @inheritDoc |
447
|
|
|
*/ |
448
|
|
|
public function move($targetPath) { |
449
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
/** |
453
|
|
|
* @inheritDoc |
454
|
|
|
*/ |
455
|
|
|
public function lock($type) { |
456
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
/** |
460
|
|
|
* @inheritDoc |
461
|
|
|
*/ |
462
|
|
|
public function changeLock($targetType) { |
463
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
/** |
467
|
|
|
* @inheritDoc |
468
|
|
|
*/ |
469
|
|
|
public function unlock($type) { |
470
|
|
|
return $this->__call(__FUNCTION__, func_get_args()); |
471
|
|
|
} |
472
|
|
|
|
473
|
|
|
|
474
|
|
|
} |
475
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.