[Pkg-owncloud-commits] [owncloud] 07/20: Only rescan versions once in trashbin
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 15:57:44 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 895285ab59946c763a3ab96f18f4bd2e819feb9d
Author: Vincent Petry <pvince81 at owncloud.com>
Date: Mon Mar 2 12:48:08 2015 +0100
Only rescan versions once in trashbin
Whenever versions need to be rescanned, only do it once per PHP request.
Happens whenever multiple files need to be expired.
---
apps/files_trashbin/lib/trashbin.php | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php
index 11b4a4c..7cdb8c6 100644
--- a/apps/files_trashbin/lib/trashbin.php
+++ b/apps/files_trashbin/lib/trashbin.php
@@ -30,6 +30,13 @@ class Trashbin {
// unit: percentage; 50% of available disk space/quota
const DEFAULTMAXSIZE = 50;
+ /**
+ * Whether versions have already be rescanned during this PHP request
+ *
+ * @var bool
+ */
+ private static $scannedVersions = false;
+
public static function getUidAndFilename($filename) {
$uid = \OC\Files\Filesystem::getOwner($filename);
\OC\Files\Filesystem::initMountPoints($uid);
@@ -888,9 +895,12 @@ class Trashbin {
$versions = array();
//force rescan of versions, local storage may not have updated the cache
- /** @var \OC\Files\Storage\Storage $storage */
- list($storage, ) = $view->resolvePath('/');
- $storage->getScanner()->scan('files_trashbin');
+ if (!self::$scannedVersions) {
+ /** @var \OC\Files\Storage\Storage $storage */
+ list($storage, ) = $view->resolvePath('/');
+ $storage->getScanner()->scan('files_trashbin/versions');
+ self::$scannedVersions = true;
+ }
if ($timestamp) {
// fetch for old versions
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list