mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-03-12 14:09:19 +01:00
Some modifications required by CalDAV
This commit is contained in:
parent
d2e9143213
commit
6587e340fc
@ -968,7 +968,7 @@ class egw_vfs extends vfs_stream_wrapper
|
|||||||
* lock a ressource/path
|
* lock a ressource/path
|
||||||
*
|
*
|
||||||
* @param string $path path or url
|
* @param string $path path or url
|
||||||
* @param string $token
|
* @param string &$token
|
||||||
* @param int &$timeout
|
* @param int &$timeout
|
||||||
* @param string &$owner
|
* @param string &$owner
|
||||||
* @param string &$scope
|
* @param string &$scope
|
||||||
@ -977,7 +977,7 @@ class egw_vfs extends vfs_stream_wrapper
|
|||||||
* @param boolean $check_writable=true should we check if the ressource is writable, before granting locks, default yes
|
* @param boolean $check_writable=true should we check if the ressource is writable, before granting locks, default yes
|
||||||
* @return boolean true on success
|
* @return boolean true on success
|
||||||
*/
|
*/
|
||||||
function lock($path,$token,&$timeout,&$owner,&$scope,&$type,$update=false,$check_writable=true)
|
static function lock($path,&$token,&$timeout,&$owner,&$scope,&$type,$update=false,$check_writable=true)
|
||||||
{
|
{
|
||||||
// we require write rights to lock/unlock a resource
|
// we require write rights to lock/unlock a resource
|
||||||
if (!$path || $update && !$token || $check_writable && !egw_vfs::is_writable($path))
|
if (!$path || $update && !$token || $check_writable && !egw_vfs::is_writable($path))
|
||||||
@ -987,6 +987,11 @@ class egw_vfs extends vfs_stream_wrapper
|
|||||||
// remove the lock info evtl. set in the cache
|
// remove the lock info evtl. set in the cache
|
||||||
unset(self::$lock_cache[$path]);
|
unset(self::$lock_cache[$path]);
|
||||||
|
|
||||||
|
if ($timeout < 1000000) // < 1000000 is a relative timestamp, so we add the current time
|
||||||
|
{
|
||||||
|
$timeout += time();
|
||||||
|
}
|
||||||
|
|
||||||
if ($update) // Lock Update
|
if ($update) // Lock Update
|
||||||
{
|
{
|
||||||
if (($ret = (boolean)($row = self::$db->select(self::LOCK_TABLE,array('lock_owner','lock_exclusive','lock_write'),array(
|
if (($ret = (boolean)($row = self::$db->select(self::LOCK_TABLE,array('lock_owner','lock_exclusive','lock_write'),array(
|
||||||
@ -1021,6 +1026,7 @@ class egw_vfs extends vfs_stream_wrapper
|
|||||||
}
|
}
|
||||||
if (!$token)
|
if (!$token)
|
||||||
{
|
{
|
||||||
|
require_once('HTTP/WebDAV/Server.php');
|
||||||
$token = HTTP_WebDAV_Server::_new_locktoken();
|
$token = HTTP_WebDAV_Server::_new_locktoken();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -1052,7 +1058,7 @@ class egw_vfs extends vfs_stream_wrapper
|
|||||||
* @param boolean $check_writable=true should we check if the ressource is writable, before granting locks, default yes
|
* @param boolean $check_writable=true should we check if the ressource is writable, before granting locks, default yes
|
||||||
* @return boolean true on success
|
* @return boolean true on success
|
||||||
*/
|
*/
|
||||||
function unlock($path,$token,$check_writable=true)
|
static function unlock($path,$token,$check_writable=true)
|
||||||
{
|
{
|
||||||
// we require write rights to lock/unlock a resource
|
// we require write rights to lock/unlock a resource
|
||||||
if ($check_writable && !egw_vfs::is_writable($path))
|
if ($check_writable && !egw_vfs::is_writable($path))
|
||||||
@ -1077,7 +1083,7 @@ class egw_vfs extends vfs_stream_wrapper
|
|||||||
* @param string resource path to check for locks
|
* @param string resource path to check for locks
|
||||||
* @return array|boolean false if there's no lock, else array with lock info
|
* @return array|boolean false if there's no lock, else array with lock info
|
||||||
*/
|
*/
|
||||||
function checkLock($path)
|
static function checkLock($path)
|
||||||
{
|
{
|
||||||
if (isset(self::$lock_cache[$path]))
|
if (isset(self::$lock_cache[$path]))
|
||||||
{
|
{
|
||||||
@ -1109,6 +1115,18 @@ class egw_vfs extends vfs_stream_wrapper
|
|||||||
return self::$lock_cache[$path] = $result;
|
return self::$lock_cache[$path] = $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapps entries of applications to a path for the locking
|
||||||
|
*
|
||||||
|
* @param string $app
|
||||||
|
* @param int|string $id
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
static function app_entry_lock_path($app,$id)
|
||||||
|
{
|
||||||
|
return "/apps/$app/entry/$id";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise our static vars
|
* Initialise our static vars
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user