Exemplo n.º 1
0
 /**
  * Locks a uri
  *
  * All the locking information is supplied in the lockInfo object. The object has a suggested timeout, but this can be safely ignored
  * It is important that if the existing timeout is ignored, the property is overwritten, as this needs to be sent back to the client
  *
  * @param string $uri
  * @param Sabre_DAV_Locks_LockInfo $lockInfo
  * @return bool
  */
 public function lockNode($uri, Sabre_DAV_Locks_LockInfo $lockInfo)
 {
     if (!$this->server->broadcastEvent('beforeLock', array($uri, $lockInfo))) {
         return;
     }
     if ($this->locksBackend) {
         return $this->locksBackend->lock($uri, $lockInfo);
     }
     throw new Sabre_DAV_Exception_MethodNotAllowed('Locking support is not enabled for this resource. No Locking backend was found so if you didn\'t expect this error, please check your configuration.');
 }
Exemplo n.º 2
0
 /**
  * Locks a uri
  *
  * All the locking information is supplied in the lockInfo object. The object has a suggested timeout, but this can be safely ignored
  * It is important that if the existing timeout is ignored, the property is overwritten, as this needs to be sent back to the client
  * 
  * @param string $uri 
  * @param Sabre_DAV_Locks_LockInfo $lockInfo 
  * @return void
  */
 public function lockNode($uri, Sabre_DAV_Locks_LockInfo $lockInfo)
 {
     if (!$this->server->broadcastEvent('beforeLock', array($uri, $lockInfo))) {
         return;
     }
     try {
         $node = $this->server->tree->getNodeForPath($uri);
         if ($node instanceof Sabre_DAV_ILockable) {
             return $node->lock($lockInfo);
         }
     } catch (Sabre_DAV_Exception_FileNotFound $e) {
         // In case the node didn't exist, this could be a lock-null request
     }
     if ($this->locksBackend) {
         return $this->locksBackend->lock($uri, $lockInfo);
     }
     throw new Sabre_DAV_Exception_MethodNotAllowed('Locking support is not enabled for this resource. No Locking backend was found so if you didn\'t expect this error, please check your configuration.');
 }