コード例 #1
0
 public static function fromStorageRow(array $row, $obj = null)
 {
     /** @var $obj AbstractSummary */
     $obj = parent::fromStorageRow($row, $obj);
     $obj->summaryTargetId = UUID::create($row['rev_type_id']);
     return $obj;
 }
コード例 #2
0
ファイル: DavImpl.class.php プロジェクト: Gamepay/xp-contrib
 /**
  * Set lock for URI
  *
  * @param   org.webdav.WebdavLock lock   The lock object
  * @param   string[]               tokens Optional lock-tokens to overwrite lock
  * @return  org.webdav.WebdavLock
  * @throws  org.webdav.OperationNotAllowedException
  */
 public function setLockInfo($lock, $tokens = array())
 {
     $lockinfo = $this->getLockInfo($lock->getURI());
     // There's already lock
     if ($lockinfo !== NULL) {
         // We have s/some lock token, so check if we can overwrite the lock
         if (sizeof($tokens)) {
             if (!in_array($lockinfo->getLockToken(), $tokens)) {
                 throw new OperationNotAllowedException('Can not refresh lock on ' . $lock->getURI() . ' with owner ' . $lock->getOwner());
             }
         } else {
             if ($lock->getLockToken() != $lockinfo->getLockToken()) {
                 throw new OperationNotAllowedException('LOCK failed - invalid Token given ' . $lock->getLockToken());
             }
         }
     }
     $newOwner = $lock->getOwner();
     // We can't set a lock where owner is empty
     if (empty($newOwner)) {
         throw new OperationNotAllowedException('Can not set lock with empty owner');
     }
     // Check token
     if (empty($token)) {
         $t = new OpaqueLockTocken(UUID::create());
     }
     // Set lock
     $lock->setLockToken($t->toString());
     $this->propStorage->setLock($lock->getURI(), $lock);
     return $lock;
 }