mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 10:53:39 +01:00
fix get_file_id() (sometimes) not finding the right id for shared directories or writable Collabora shares
This commit is contained in:
parent
4c0ef2020f
commit
998f7dc074
@ -1570,7 +1570,7 @@ class StreamWrapper extends Api\Db\Pdo implements Vfs\StreamWrapperIface
|
||||
* Get the lowest file id (fs_id) for a given path
|
||||
*
|
||||
* @param string $path
|
||||
* @return integer
|
||||
* @return ?integer null if path not found
|
||||
*/
|
||||
static function get_minimum_file_id($path)
|
||||
{
|
||||
@ -1582,10 +1582,21 @@ class StreamWrapper extends Api\Db\Pdo implements Vfs\StreamWrapperIface
|
||||
}
|
||||
$fs_id = $stat['ino'];
|
||||
|
||||
//error_log(__METHOD__."('$path') stat[ino]=$fs_id");
|
||||
return $fs_id ? self::get_minimum_fs_id($fs_id) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lowest file id (fs_id) for a given fs_id
|
||||
*
|
||||
* @param string $path
|
||||
* @return ?integer null if fs_id is NOT found
|
||||
*/
|
||||
static function get_minimum_fs_id($fs_id)
|
||||
{
|
||||
$query = 'SELECT MIN(B.fs_id)
|
||||
FROM ' . self::TABLE . ' as A
|
||||
JOIN ' . self::TABLE . ' AS B ON A.fs_name = B.fs_name AND A.fs_dir = B.fs_dir AND A.fs_active = ' .
|
||||
self::_pdo_boolean(true) . ' AND B.fs_active = ' . self::_pdo_boolean(false) . '
|
||||
JOIN ' . self::TABLE . ' AS B ON A.fs_name = B.fs_name AND A.fs_dir = B.fs_dir
|
||||
WHERE A.fs_id=?
|
||||
GROUP BY A.fs_id';
|
||||
if (self::LOG_LEVEL > 2)
|
||||
@ -1597,7 +1608,8 @@ GROUP BY A.fs_id';
|
||||
$stmt->execute(array($fs_id));
|
||||
$min = $stmt->fetchColumn();
|
||||
|
||||
return $min ? $min : $fs_id;
|
||||
//error_log(__METHOD__."($fs_id) returning ".($min ?: null));
|
||||
return $min ?: null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user