/**
* Returns a list of Sabre\DAV\Locks\LockInfo objects
*
* This method should return all the locks for a particular uri, including
* locks that might be set on a parent uri.
*
* If returnChildLocks is set to true, this method should also look for
* any locks in the subtree of the uri for locks.
*
* @param string $uri
* @param bool $returnChildLocks
* @return array
*/
public function getLocks($uri, $returnChildLocks)
{
list($app) = explode('/', $uri);
try {
// @todo use $returnChildLocks when we implemented sub-tree
// searching in Horde_Lock
$locks = $this->_lock->getLocks($app, $uri);
} catch (Horde_Lock_Exception $e) {
throw new DAV\Exception($e->getMessage(), $e->getCode(), $e);
}
$infos = array();
foreach ($locks as $lock) {
$info = new Locks\LockInfo();
$info->owner = $lock['lock_owner'];
$info->token = $lock['lock_id'];
$info->timeout = $lock['lock_expiry_timestamp'];
$info->created = $lock['lock_origin_timestamp'];
$info->scope = $lock['lock_type'] == Horde_Lock::TYPE_EXCLUSIVE ? Locks\LockInfo::EXCLUSIVE : Locks\LockInfo::SHARED;
$info->uri = $lock['lock_principal'];
$infos[] = $info;
}
return $infos;
}