mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
only create a temporary mount for ownCloud clients on /clientsync, thought admin can create a different permanent one
This commit is contained in:
parent
154c601157
commit
371ebda9b0
@ -3,7 +3,9 @@
|
|||||||
* FileManger - WebDAV access for ownCloud clients
|
* FileManger - WebDAV access for ownCloud clients
|
||||||
*
|
*
|
||||||
* ownCloud clients sync by default local ownCloud dir to /clientsync on server.
|
* ownCloud clients sync by default local ownCloud dir to /clientsync on server.
|
||||||
* EGroupware now automaticially mount /home/$user on /clientsync, so ownCloud clients syncs with users home-dir.
|
*
|
||||||
|
* EGroupware now temporary mounts vfs://default/home/$user on /clientsync,
|
||||||
|
* so ownCloud clients syncs with users home-dir, unless admin mounts an other directory.
|
||||||
*
|
*
|
||||||
* @link http://owncloud.org/sync-clients/
|
* @link http://owncloud.org/sync-clients/
|
||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
@ -68,15 +70,16 @@ catch (egw_exception_no_permission_app $e)
|
|||||||
}
|
}
|
||||||
//$headertime = microtime(true);
|
//$headertime = microtime(true);
|
||||||
|
|
||||||
// automatically mount ownCloud default /clientsync as /home/$user, so ownCloud dir contains users home-dir
|
// temporary mount ownCloud default /clientsync as /home/$user, if not explicitly mounted
|
||||||
|
// so ownCloud dir contains users home-dir by default
|
||||||
if (strpos($_SERVER['REQUEST_URI'],'/webdav.php/clientsync') !== false &&
|
if (strpos($_SERVER['REQUEST_URI'],'/webdav.php/clientsync') !== false &&
|
||||||
($fstab=egw_vfs::mount()) && !isset($fstab['/clientsync']))
|
($fstab=egw_vfs::mount()) && !isset($fstab['/clientsync']))
|
||||||
{
|
{
|
||||||
$is_root_backup = egw_vfs::$is_root;
|
$is_root_backup = egw_vfs::$is_root;
|
||||||
egw_vfs::$is_root = true;
|
egw_vfs::$is_root = true;
|
||||||
$ok = egw_vfs::mount($url='vfs://default/home/$user',$clientsync='/clientsync');
|
$ok = egw_vfs::mount($url='vfs://default/home/$user', $clientsync='/clientsync', null, false);
|
||||||
egw_vfs::$is_root = $is_root_backup;
|
egw_vfs::$is_root = $is_root_backup;
|
||||||
error_log("mounting ownCloud default '$clientsync' as '$url' ".($ok ? 'successful' : 'failed!'));
|
//error_log("mounting ownCloud default '$clientsync' as '$url' ".($ok ? 'successful' : 'failed!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// webdav is stateless: we dont need to keep the session open, it only blocks other calls to same basic-auth session
|
// webdav is stateless: we dont need to keep the session open, it only blocks other calls to same basic-auth session
|
||||||
|
@ -300,9 +300,10 @@ class egw_vfs extends vfs_stream_wrapper
|
|||||||
* @param string $path=null path to mount the filesystem in the vfs, eg. /
|
* @param string $path=null path to mount the filesystem in the vfs, eg. /
|
||||||
* @param boolean $check_url=null check if url is an existing directory, before mounting it
|
* @param boolean $check_url=null check if url is an existing directory, before mounting it
|
||||||
* default null only checks if url does not contain a $ as used in $user or $pass
|
* default null only checks if url does not contain a $ as used in $user or $pass
|
||||||
|
* @param boolean $persitent_mount=true create a persitent mount, or only a temprary for current request
|
||||||
* @return array|boolean array with fstab, if called without parameter or true on successful mount
|
* @return array|boolean array with fstab, if called without parameter or true on successful mount
|
||||||
*/
|
*/
|
||||||
static function mount($url=null,$path=null,$check_url=null)
|
static function mount($url=null,$path=null,$check_url=null,$persitent_mount=true)
|
||||||
{
|
{
|
||||||
if (is_null($check_url)) $check_url = strpos($url,'$') === false;
|
if (is_null($check_url)) $check_url = strpos($url,'$') === false;
|
||||||
|
|
||||||
@ -341,12 +342,15 @@ class egw_vfs extends vfs_stream_wrapper
|
|||||||
|
|
||||||
uksort(self::$fstab,create_function('$a,$b','return strlen($a)-strlen($b);'));
|
uksort(self::$fstab,create_function('$a,$b','return strlen($a)-strlen($b);'));
|
||||||
|
|
||||||
config::save_value('vfs_fstab',self::$fstab,'phpgwapi');
|
if ($persitent_mount)
|
||||||
$GLOBALS['egw_info']['server']['vfs_fstab'] = self::$fstab;
|
|
||||||
// invalidate session cache
|
|
||||||
if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) // egw object in setup is limited
|
|
||||||
{
|
{
|
||||||
$GLOBALS['egw']->invalidate_session_cache();
|
config::save_value('vfs_fstab',self::$fstab,'phpgwapi');
|
||||||
|
$GLOBALS['egw_info']['server']['vfs_fstab'] = self::$fstab;
|
||||||
|
// invalidate session cache
|
||||||
|
if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) // egw object in setup is limited
|
||||||
|
{
|
||||||
|
$GLOBALS['egw']->invalidate_session_cache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (self::LOG_LEVEL > 1) error_log(__METHOD__.'('.array2string($url).','.array2string($path).') returns true (successful new mount).');
|
if (self::LOG_LEVEL > 1) error_log(__METHOD__.'('.array2string($url).','.array2string($path).') returns true (successful new mount).');
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user