From c937f50193c7e1093eeed288cc05b7c7e3adc420 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 30 Mar 2020 09:35:59 -0600 Subject: [PATCH] Make sure share cleanup job doesn't remove shares just because of access rights --- api/src/Link/Sharing.php | 4 ++++ api/src/Sharing.php | 2 +- api/src/Vfs/Sharing.php | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/api/src/Link/Sharing.php b/api/src/Link/Sharing.php index 5dd79c5dde..3fe21df22f 100644 --- a/api/src/Link/Sharing.php +++ b/api/src/Link/Sharing.php @@ -126,6 +126,10 @@ class Sharing extends \EGroupware\Api\Sharing protected static function check_path($share) { list($app, $id) = explode('::', $share['share_path']); + if(!\EGroupware\Api\Link::$app_register[$app]) + { + \EGroupware\Api\Link::init_static(); + } return (boolean) \EGroupware\Api\Link::title($app, $id); } diff --git a/api/src/Sharing.php b/api/src/Sharing.php index 8c95b43b9f..e4da76bde3 100644 --- a/api/src/Sharing.php +++ b/api/src/Sharing.php @@ -825,7 +825,7 @@ class Sharing if (!isset(self::$db)) self::$db = $GLOBALS['egw']->db; foreach(self::$db->select(self::TABLE, array( - 'share_id','share_path' + 'share_id','share_path', 'share_writable' ), array(), __LINE__, __FILE__, false) as $share) { $class = self::get_share_class($share); diff --git a/api/src/Vfs/Sharing.php b/api/src/Vfs/Sharing.php index 47f881bf1f..4d68881a7c 100644 --- a/api/src/Vfs/Sharing.php +++ b/api/src/Vfs/Sharing.php @@ -364,7 +364,10 @@ class Sharing extends \EGroupware\Api\Sharing { $share['share_path'] = Api\Vfs::parse_url($share['share_path'], PHP_URL_PATH); } - return Vfs::file_exists($share['share_path']); + Vfs::$is_root = true; + $exists = Vfs::file_exists($share['share_path']); + Vfs::$is_root = false; + return $exists; } /**