Merge pull request #12865 from nextcloud/fix/do_not_propogate_in_appdata

No need to propogate changes in appdata
This commit is contained in:
Morris Jobke 2018-12-06 08:50:22 +01:00 committed by GitHub
commit 60681decdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -46,12 +46,14 @@ class Propagator implements IPropagator {
private $connection; private $connection;
/** /**
* @param \OC\Files\Storage\Storage $storage * @var array
* @param IDBConnection $connection
*/ */
public function __construct(\OC\Files\Storage\Storage $storage, IDBConnection $connection) { private $ignore = [];
public function __construct(\OC\Files\Storage\Storage $storage, IDBConnection $connection, array $ignore = []) {
$this->storage = $storage; $this->storage = $storage;
$this->connection = $connection; $this->connection = $connection;
$this->ignore = $ignore;
} }
@ -62,6 +64,13 @@ class Propagator implements IPropagator {
* @suppress SqlInjectionChecker * @suppress SqlInjectionChecker
*/ */
public function propagateChange($internalPath, $time, $sizeDifference = 0) { public function propagateChange($internalPath, $time, $sizeDifference = 0) {
// Do not propogate changes in ignored paths
foreach ($this->ignore as $ignore) {
if (strpos($internalPath, $ignore) === 0) {
return;
}
}
$storageId = (int)$this->storage->getStorageCache()->getNumericId(); $storageId = (int)$this->storage->getStorageCache()->getNumericId();
$parents = $this->getParents($internalPath); $parents = $this->getParents($internalPath);

View File

@ -368,7 +368,8 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
$storage = $this; $storage = $this;
} }
if (!isset($storage->propagator)) { if (!isset($storage->propagator)) {
$storage->propagator = new Propagator($storage, \OC::$server->getDatabaseConnection()); $config = \OC::$server->getSystemConfig();
$storage->propagator = new Propagator($storage, \OC::$server->getDatabaseConnection(), ['appdata_' . $config->getValue('instanceid')]);
} }
return $storage->propagator; return $storage->propagator;
} }