forked from extern/egroupware
some long running operations, eg. merge-print, run into situation that DB closes our separate sqlfs connection, we try now to reconnect once
This commit is contained in:
parent
0f37c16cd8
commit
48fd2113f3
@ -1570,6 +1570,14 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper
|
||||
*/
|
||||
public static $case_sensitive_equal = '=';
|
||||
|
||||
/**
|
||||
* Reconnect to database
|
||||
*/
|
||||
static public function reconnect()
|
||||
{
|
||||
self::$pdo = self::_pdo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create pdo object / connection, as long as pdo is not generally used in eGW
|
||||
*
|
||||
|
@ -873,13 +873,15 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
* @param boolean $check_symlink_components=true check if path contains symlinks in path components other then the last one
|
||||
* @return array
|
||||
*/
|
||||
static function url_stat ( $path, $flags, $try_create_home=false, $check_symlink_components=true, $check_symlink_depth=self::MAX_SYMLINK_DEPTH )
|
||||
static function url_stat ( $path, $flags, $try_create_home=false, $check_symlink_components=true, $check_symlink_depth=self::MAX_SYMLINK_DEPTH, $try_reconnect=true )
|
||||
{
|
||||
if (!($url = self::resolve_url($path,!($flags & STREAM_URL_STAT_LINK), $check_symlink_components)))
|
||||
{
|
||||
if (self::LOG_LEVEL > 0) error_log(__METHOD__."('$path',$flags) can NOT resolve path!");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
if ($flags & STREAM_URL_STAT_LINK)
|
||||
{
|
||||
$stat = @lstat($url); // suppressed the stat failed warnings
|
||||
@ -912,6 +914,20 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (egw_exception_db $e) {
|
||||
// some long running operations, eg. merge-print, run into situation that DB closes our separate sqlfs connection
|
||||
// we try now to reconnect sqlfs_stream_wrapper once
|
||||
// it's done here in vfs_stream_wrapper as situation can happen in sqlfs, links, stylite.links or stylite.versioning
|
||||
if ($try_reconnect)
|
||||
{
|
||||
// reconnect to db
|
||||
sqlfs_stream_wrapper::reconnect();
|
||||
return self::url_stat($path, $flags, $try_create_home, $check_symlink_components, $check_symlink_depth, false);
|
||||
}
|
||||
// if numer of tries is exceeded, re-throw exception
|
||||
throw $e;
|
||||
}
|
||||
// check if a failed url_stat was for a home dir, in that case silently create it
|
||||
if (!$stat && $try_create_home && egw_vfs::dirname(parse_url($path,PHP_URL_PATH)) == '/home' &&
|
||||
($id = $GLOBALS['egw']->accounts->name2id(basename($path))) &&
|
||||
|
Loading…
Reference in New Issue
Block a user