コード例 #1
0
ファイル: Plugin.php プロジェクト: ngocanh/pimcore
 /**
  * Returns all lock information on a particular uri 
  * 
  * This function should return an array with Sabre_DAV_Locks_LockInfo objects. If there are no locks on a file, return an empty array.
  *
  * Additionally there is also the possibility of locks on parent nodes, so we'll need to traverse every part of the tree 
  *
  * @param string $uri 
  * @return array 
  */
 public function getLocks($uri)
 {
     $lockList = array();
     $currentPath = '';
     foreach (explode('/', $uri) as $uriPart) {
         $uriLocks = array();
         if ($currentPath) {
             $currentPath .= '/';
         }
         $currentPath .= $uriPart;
         try {
             $node = $this->server->tree->getNodeForPath($currentPath);
             if ($node instanceof Sabre_DAV_ILockable) {
                 $uriLocks = $node->getLocks();
             }
         } catch (Sabre_DAV_Exception_FileNotFound $e) {
             // In case the node didn't exist, this could be a lock-null request
         }
         foreach ($uriLocks as $uriLock) {
             // Unless we're on the leaf of the uri-tree we should ingore locks with depth 0
             if ($uri == $currentPath || $uriLock->depth != 0) {
                 $uriLock->uri = $currentPath;
                 $lockList[] = $uriLock;
             }
         }
     }
     if ($this->locksBackend) {
         $lockList = array_merge($lockList, $this->locksBackend->getLocks($uri));
     }
     return $lockList;
 }
コード例 #2
0
ファイル: Plugin.php プロジェクト: omusico/isle-web-framework
 /**
  * Returns all lock information on a particular uri
  *
  * This function should return an array with Sabre_DAV_Locks_LockInfo objects. If there are no locks on a file, return an empty array.
  *
  * Additionally there is also the possibility of locks on parent nodes, so we'll need to traverse every part of the tree
  * If the $returnChildLocks argument is set to true, we'll also traverse all the children of the object
  * for any possible locks and return those as well.
  *
  * @param string $uri
  * @param bool $returnChildLocks
  * @return array
  */
 public function getLocks($uri, $returnChildLocks = false)
 {
     $lockList = array();
     if ($this->locksBackend) {
         $lockList = array_merge($lockList, $this->locksBackend->getLocks($uri, $returnChildLocks));
     }
     return $lockList;
 }