mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 09:53:20 +01:00
fix IDE warnings
This commit is contained in:
parent
223455b7aa
commit
8787fe6774
@ -139,18 +139,19 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
/**
|
||||
* Resolve the given path according to our fstab AND symlinks
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $_path
|
||||
* @param boolean $file_exists =true true if file needs to exists, false if not
|
||||
* @param boolean $resolve_last_symlink =true
|
||||
* @param array|boolean &$stat=null on return: stat of existing file or false for non-existing files
|
||||
* @return string|boolean false if the url cant be resolved, should not happen if fstab has a root entry
|
||||
*/
|
||||
static function resolve_url_symlinks($path,$file_exists=true,$resolve_last_symlink=true,&$stat=null)
|
||||
static function resolve_url_symlinks($_path,$file_exists=true,$resolve_last_symlink=true,&$stat=null)
|
||||
{
|
||||
$path = self::get_path($path);
|
||||
$path = self::get_path($_path);
|
||||
|
||||
if (!($stat = self::url_stat($path,$resolve_last_symlink?0:STREAM_URL_STAT_LINK)) && !$file_exists)
|
||||
{
|
||||
$url = null;
|
||||
$stat = self::check_symlink_components($path,0,$url);
|
||||
if (self::LOG_LEVEL > 1) $log = " (check_symlink_components('$path',0,'$url') = $stat)";
|
||||
}
|
||||
@ -170,17 +171,17 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
/**
|
||||
* Resolve the given path according to our fstab
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $_path
|
||||
* @param boolean $do_symlink =true is a direct match allowed, default yes (must be false for a lstat or readlink!)
|
||||
* @param boolean $use_symlinkcache =true
|
||||
* @param boolean $replace_user_pass_host =true replace $user,$pass,$host in url, default true, if false result is not cached
|
||||
* @return string|boolean false if the url cant be resolved, should not happen if fstab has a root entry
|
||||
*/
|
||||
static function resolve_url($path,$do_symlink=true,$use_symlinkcache=true,$replace_user_pass_host=true)
|
||||
static function resolve_url($_path,$do_symlink=true,$use_symlinkcache=true,$replace_user_pass_host=true)
|
||||
{
|
||||
static $cache = array();
|
||||
|
||||
$path = self::get_path($path);
|
||||
$path = self::get_path($_path);
|
||||
|
||||
// we do some caching here
|
||||
if (isset($cache[$path]) && $replace_user_pass_host)
|
||||
@ -194,7 +195,7 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
$path = self::symlinkCache_resolve($path,$do_symlink);
|
||||
}
|
||||
// setting default user, passwd and domain, if it's not contained int the url
|
||||
static $defaults;
|
||||
static $defaults=null;
|
||||
if (is_null($defaults))
|
||||
{
|
||||
$defaults = array(
|
||||
@ -252,7 +253,7 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
*/
|
||||
static function mount_url($fullurl)
|
||||
{
|
||||
foreach(array_reverse(self::$fstab) as $mounted => $url)
|
||||
foreach(array_reverse(self::$fstab) as $url)
|
||||
{
|
||||
list($url_no_query) = explode('?',$url);
|
||||
if (substr($fullurl,0,1+strlen($url_no_query)) === $url_no_query.'/')
|
||||
@ -284,8 +285,10 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
*/
|
||||
function stream_open ( $path, $mode, $options, &$opened_path )
|
||||
{
|
||||
unset($opened_path); // not used but required by function signature
|
||||
$this->opened_stream = null;
|
||||
|
||||
$stat = null;
|
||||
if (!($url = self::resolve_url_symlinks($path,$mode[0]=='r',true,$stat)))
|
||||
{
|
||||
return false;
|
||||
@ -508,7 +511,7 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
$ret = stream_copy_to_stream($from,$to) !== false;
|
||||
fclose($from);
|
||||
fclose($to);
|
||||
if ($ret) $ru = self::unlink($path_from);
|
||||
if ($ret) self::unlink($path_from);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -575,6 +578,7 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
*/
|
||||
static function rmdir ( $path, $options )
|
||||
{
|
||||
unset($options); // not uses but required by function signature
|
||||
if (!($url = self::resolve_url_symlinks($path)))
|
||||
{
|
||||
return false;
|
||||
@ -661,6 +665,7 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
}
|
||||
else
|
||||
{
|
||||
$time = null;
|
||||
return $name($url,$time);
|
||||
}
|
||||
}
|
||||
@ -831,7 +836,7 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
$this->opened_dir_writable = egw_vfs::check_access($this->opened_dir_url,egw_vfs::WRITABLE);
|
||||
// check our fstab if we need to add some of the mountpoints
|
||||
$basepath = self::parse_url($path,PHP_URL_PATH);
|
||||
foreach(self::$fstab as $mounted => $url)
|
||||
foreach(array_keys(self::$fstab) as $mounted)
|
||||
{
|
||||
if (((egw_vfs::dirname($mounted) == $basepath || egw_vfs::dirname($mounted).'/' == $basepath) && $mounted != '/') &&
|
||||
// only return children readable by the user, if dir is not writable
|
||||
@ -906,7 +911,7 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
$url = egw_vfs::PREFIX.$lpath;
|
||||
if (self::LOG_LEVEL > 1) error_log(__METHOD__."($path,$flags) symlif (substr($path,-1) == '/' && $path != '/') $path = substr($path,0,-1); // remove trailing slash eg. added by WebDAVink found and resolved to $url");
|
||||
// try reading the stat of the link
|
||||
if ($stat = self::url_stat($lpath, STREAM_URL_STAT_QUIET, false, true, $check_symlink_depth-1))
|
||||
if (($stat = self::url_stat($lpath, STREAM_URL_STAT_QUIET, false, true, $check_symlink_depth-1)))
|
||||
{
|
||||
if(isset($stat['url'])) $url = $stat['url']; // if stat returns an url use that, as there might be more links ...
|
||||
self::symlinkCache_add($path,$url);
|
||||
@ -940,7 +945,7 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
'account_name' => basename($path),
|
||||
);
|
||||
call_user_func(array('vfs_home_hooks',$hook_data['location']),$hook_data);
|
||||
$hook_data = null;
|
||||
unset($hook_data);
|
||||
$stat = self::url_stat($path,$flags,false);
|
||||
}
|
||||
if (!$stat && $check_symlink_components) // check if there's a symlink somewhere inbetween the path
|
||||
@ -956,14 +961,14 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
|
||||
return $stat;
|
||||
|
||||
// Todo: if we hide non readables, we should return false on url_stat for consitency (if dir is not writabel)
|
||||
/* Todo: if we hide non readables, we should return false on url_stat for consitency (if dir is not writabel)
|
||||
// Problem: this does NOT stop (calles itself infinit recursive)!
|
||||
if (self::HIDE_UNREADABLES && !egw_vfs::check_access($path,egw_vfs::READABLE,$stat) &&
|
||||
!egw_vfs::check_access(egw_vfs::dirname($path,egw_vfs::WRITABLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return $stat;
|
||||
return $stat;*/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1020,12 +1025,12 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
/**
|
||||
* Add a resolved symlink to cache
|
||||
*
|
||||
* @param string $path vfs path
|
||||
* @param string $_path vfs path
|
||||
* @param string $target target path
|
||||
*/
|
||||
static protected function symlinkCache_add($path,$target)
|
||||
static protected function symlinkCache_add($_path,$target)
|
||||
{
|
||||
$path = self::get_path($path);
|
||||
$path = self::get_path($_path);
|
||||
|
||||
if (isset(self::$symlink_cache[$path])) return; // nothing to do
|
||||
|
||||
@ -1041,11 +1046,11 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
/**
|
||||
* Remove a resolved symlink from cache
|
||||
*
|
||||
* @param string $path vfs path
|
||||
* @param string $_path vfs path
|
||||
*/
|
||||
static protected function symlinkCache_remove($path)
|
||||
static protected function symlinkCache_remove($_path)
|
||||
{
|
||||
$path = self::get_path($path);
|
||||
$path = self::get_path($_path);
|
||||
|
||||
unset(self::$symlink_cache[$path]);
|
||||
if (self::LOG_LEVEL > 1) error_log(__METHOD__."($path) cache now ".array2string(self::$symlink_cache));
|
||||
@ -1056,14 +1061,14 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
*
|
||||
* The cache is sorted from longer to shorter pathes.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $_path
|
||||
* @param boolean $do_symlink =true is a direct match allowed, default yes (must be false for a lstat or readlink!)
|
||||
* @return string target or path, if path not found
|
||||
*/
|
||||
static public function symlinkCache_resolve($path,$do_symlink=true)
|
||||
static public function symlinkCache_resolve($_path,$do_symlink=true)
|
||||
{
|
||||
// remove vfs scheme, but no other schemes (eg. filesystem!)
|
||||
$path = self::get_path($path);
|
||||
$path = self::get_path($_path);
|
||||
|
||||
$strlen_path = strlen($path);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user