Exemple #1
0
 /**
  * Returns the full path of this folder, from the root.
  *
  * @param string $rootId ID of the root folder, NULL to auto-detect
  *
  * @return string
  */
 public function getReadablePath($rootId = null)
 {
     if ($rootId === null) {
         // Find first matching filemount and use that as root
         foreach ($this->storage->getFileMounts() as $fileMount) {
             if ($this->storage->isWithinFolder($fileMount['folder'], $this)) {
                 $rootId = $fileMount['folder']->getIdentifier();
                 break;
             }
         }
         if ($rootId === null) {
             $rootId = $this->storage->getRootLevelFolder()->getIdentifier();
         }
     }
     $readablePath = '/';
     if ($this->identifier !== $rootId) {
         try {
             $readablePath = $this->getParentFolder()->getReadablePath($rootId);
         } catch (Exception\InsufficientFolderAccessPermissionsException $e) {
             // May no access to parent folder (e.g. because of mount point)
             $readablePath = '/';
         }
     }
     return $readablePath . ($this->name ? $this->name . '/' : '');
 }