summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-07-18 11:35:14 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2016-08-10 10:57:49 +0200
commit412b5c5407c936eb768554685c3c7fab87389c23 (patch)
tree813f90bdc6ef8dea5bb154a655bb0d427cd0f901
parentd6bee61131d9702483830d39819e6204588eb800 (diff)
downloadnextcloud-server-412b5c5407c936eb768554685c3c7fab87389c23.tar.gz
nextcloud-server-412b5c5407c936eb768554685c3c7fab87389c23.zip
Store the shared propagator instance
This instead of recreating it for every call.
-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);