109 if ($rootId ===
null) {
111 foreach ($this->storage->getFileMounts() as $fileMount) {
112 if ($this->storage->isWithinFolder($fileMount[
'folder'], $this)) {
113 $rootId = $fileMount[
'folder']->getIdentifier();
117 if ($rootId ===
null) {
118 $rootId = $this->storage->getRootLevelFolder()->getIdentifier();
122 if ($this->identifier !== $rootId) {
125 }
catch (Exception\InsufficientFolderAccessPermissionsException $e) {
130 return $readablePath . ($this->name ? $this->name .
'/' :
'');
173 return $this->storage->hashFileIdentifier($this->identifier);
196 public function getPublicUrl($relativeToCurrentScript =
false)
219 public function getFiles($start = 0, $numberOfItems = 0, $filterMode = self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, $recursive =
false, $sort =
'', $sortRev =
false)
222 if ($filterMode ===
false) {
224 $backedUpFilters = [];
229 $fileObjects = $this->storage->getFilesInFolder($this, $start, $numberOfItems, $useFilters, $recursive, $sort, $sortRev);
244 public function searchFiles(FileSearchDemand $searchDemand,
int $filterMode = self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS): FileSearchResultInterface
247 $searchResult = $this->storage->searchFiles($searchDemand, $this, $useFilters);
250 return $searchResult;
262 public function getFileCount(array $filterMethods = [], $recursive =
false)
264 return $this->storage->countFilesInFolder($this,
true, $recursive);
276 if (!$this->storage->hasFolderInFolder(
$name, $this)) {
277 throw new \InvalidArgumentException(
'Folder "' .
$name .
'" does not exist in "' . $this->identifier .
'"', 1329836110);
279 return $this->storage->getFolderInFolder(
$name, $this);
291 public function getSubfolders($start = 0, $numberOfItems = 0, $filterMode = self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, $recursive =
false)
294 $folderObjects = $this->storage->getFoldersInFolder($this, $start, $numberOfItems, $useFilters, $recursive);
296 return $folderObjects;
311 return $this->storage->addFile($localFilePath, $this, $fileName, $conflictMode);
323 return $this->storage->addUploadedFile($uploadedFileData, $this, $uploadedFileData[
'name'], $conflictMode);
332 public function rename($newName)
334 return $this->storage->renameFolder($this, $newName);
343 public function delete($deleteRecursively =
true)
345 return $this->storage->deleteFolder($this, $deleteRecursively);
356 return $this->storage->createFile($fileName, $this);
404 return $this->storage->hasFileInFolder(
$name, $this);
415 return $this->storage->hasFolderInFolder(
$name, $this);
428 }
catch (Exception\ResourcePermissionsUnavailableException $e) {
444 if (isset($properties[
'identifier'])) {
445 $this->identifier = $properties[
'identifier'];
447 if (isset($properties[
'name'])) {
448 $this->name = $properties[
'name'];
460 $backedUpFilters =
null;
463 switch ($filterMode) {
465 $backedUpFilters = $this->storage->getFileAndFolderNameFilters();
466 $this->storage->setFileAndFolderNameFilters($this->fileAndFolderNameFilters);
471 if (!empty($this->fileAndFolderNameFilters)) {
472 $backedUpFilters = $this->storage->getFileAndFolderNameFilters();
473 foreach ($this->fileAndFolderNameFilters as $filter) {
474 $this->storage->addFileAndFolderNameFilter($filter);
490 return [$backedUpFilters, $useFilters];
502 if ($backedUpFilters !==
null) {
503 $this->storage->setFileAndFolderNameFilters($backedUpFilters);
515 $this->fileAndFolderNameFilters = $filters;
525 return $this->storage->getRole($this);
549 return $this->storage->getFolderInfo($this)[
'mtime'];
559 return $this->storage->getFolderInfo($this)[
'ctime'];