summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib/trashbin.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-03-02 12:48:08 +0100
committerVincent Petry <pvince81@owncloud.com>2015-03-02 12:59:38 +0100
commit7432c73f5c2871a708dd8c51487197f12eb2458a (patch)
tree03e6678da8b778f223a6f178d4e03422b8362aec /apps/files_trashbin/lib/trashbin.php
parent9c79b1fc6dd74c701adc20a867c5e4816c3accc4 (diff)
downloadnextcloud-server-7432c73f5c2871a708dd8c51487197f12eb2458a.tar.gz
nextcloud-server-7432c73f5c2871a708dd8c51487197f12eb2458a.zip
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.
Diffstat (limited to 'apps/files_trashbin/lib/trashbin.php')
-rw-r--r--apps/files_trashbin/lib/trashbin.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php
index 8ce6d668d66..f30d61542fa 100644
--- a/apps/files_trashbin/lib/trashbin.php
+++ b/apps/files_trashbin/lib/trashbin.php
@@ -32,6 +32,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);
@@ -825,9 +832,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