From 51aebe851e9f1a0de21794415b58757df2c7fc54 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 23 Jan 2017 15:22:03 +0100 Subject: [PATCH] * Filemanager/PostgreSQL: shared files were not cleaned up after expiring of 100 days not accessed under PostgreSQL --- api/src/Vfs/Sharing.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/src/Vfs/Sharing.php b/api/src/Vfs/Sharing.php index bd4f206fc6..1130c1aa1f 100644 --- a/api/src/Vfs/Sharing.php +++ b/api/src/Vfs/Sharing.php @@ -488,7 +488,7 @@ class Sharing $async = new Api\Asyncservice(); if (!$async->read('egw_sharing-tmp-cleanup')) { - $async->set_timer(array('day' => 28),'egw_sharing-tmp_cleanup','egw_sharing::tmp_cleanup',null); + $async->set_timer(array('day' => 28),'egw_sharing-tmp_cleanup','EGroupware\\Api\\Vfs\\Sharing::tmp_cleanup',null); } } @@ -605,11 +605,11 @@ class Sharing ); if (($group_concat = self::$db->group_concat('share_id'))) $cols[] = $group_concat.' AS share_id'; // remove expired tmp-files unconditionally - $having = 'HAVING share_expires < '.self::$db->quote(self::$db->to_timestamp(time())).' OR '. + $having = 'HAVING MAX(share_expires) < '.self::$db->quote(self::$db->to_timestamp(time())).' OR '. // remove without expiration date, when created over 100 days ago AND - 'share_expires IS NULL AND share_created < '.self::$db->quote(self::$db->to_timestamp(time()-self::TMP_KEEP)). ' AND '. + 'MAX(share_expires) IS NULL AND MAX(share_created) < '.self::$db->quote(self::$db->to_timestamp(time()-self::TMP_KEEP)). ' AND '. // (last accessed over 100 days ago OR never) - '(share_last_accessed IS NULL OR share_last_accessed < '.self::$db->quote(self::$db->to_timestamp(time()-self::TMP_KEEP)).')'; + '(MAX(share_last_accessed) IS NULL OR MAX(share_last_accessed) < '.self::$db->quote(self::$db->to_timestamp(time()-self::TMP_KEEP)).')'; foreach(self::$db->select(self::TABLE, $cols, array( "share_path LIKE '/home/%/.tmp/%'", @@ -638,7 +638,7 @@ class Sharing } } catch (\Exception $e) { - unset($e); + _egw_log_exception($e); } Vfs::$is_root = false; }