summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-08-10 17:24:57 +0200
committerGitHub <noreply@github.com>2016-08-10 17:24:57 +0200
commit67d016833d637982a197bb848836c7afcea88358 (patch)
treedac13e91d333e0dda2f756f6e26af76eb1bcd694
parent8831d1f53bf8388c14c443dd41958cf4f61889d4 (diff)
parent412b5c5407c936eb768554685c3c7fab87389c23 (diff)
downloadnextcloud-server-67d016833d637982a197bb848836c7afcea88358.tar.gz
nextcloud-server-67d016833d637982a197bb848836c7afcea88358.zip
Merge pull request #810 from nextcloud/shared-cachethepropagatorinstance
Store the shared propagator instance
-rw-r--r--apps/files_sharing/lib/sharedstorage.php7
-rw-r--r--lib/private/Files/Utils/Scanner.php10
2 files changed, 12 insertions, 5 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 8e9a0f41229..92900ccda69 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -319,10 +319,15 @@ class Shared extends \OC\Files\Storage\Wrapper\Jail implements ISharedStorage {
}
public function getPropagator($storage = null) {
+ if (isset($this->propagator)) {
+ return $this->propagator;
+ }
+
if (!$storage) {
$storage = $this;
}
- return new \OCA\Files_Sharing\SharedPropagator($storage, \OC::$server->getDatabaseConnection());
+ $this->propagator = new \OCA\Files_Sharing\SharedPropagator($storage, \OC::$server->getDatabaseConnection());
+ return $this->propagator;
}
public function getOwner($path) {
diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php
index f672cc75744..d26c601be1a 100644
--- a/lib/private/Files/Utils/Scanner.php
+++ b/lib/private/Files/Utils/Scanner.php
@@ -139,9 +139,10 @@ class Scanner extends PublicEmitter {
$this->triggerPropagator($storage, $path);
});
- $storage->getPropagator()->beginBatch();
+ $propagator = $storage->getPropagator();
+ $propagator->beginBatch();
$scanner->backgroundScan();
- $storage->getPropagator()->commitBatch();
+ $propagator->commitBatch();
}
}
@@ -190,14 +191,15 @@ class Scanner extends PublicEmitter {
$this->db->beginTransaction();
}
try {
- $storage->getPropagator()->beginBatch();
+ $propagator = $storage->getPropagator();
+ $propagator->beginBatch();
$scanner->scan($relativePath, \OC\Files\Cache\Scanner::SCAN_RECURSIVE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE);
$cache = $storage->getCache();
if ($cache instanceof Cache) {
// only re-calculate for the root folder we scanned, anything below that is taken care of by the scanner
$cache->correctFolderSize($relativePath);
}
- $storage->getPropagator()->commitBatch();
+ $propagator->commitBatch();
} catch (StorageNotAvailableException $e) {
$this->logger->error('Storage ' . $storage->getId() . ' not available');
$this->logger->logException($e);