summaryrefslogtreecommitdiffstats
path: root/lib/private/files
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-12-01 16:50:20 +0100
committerRobin Appelman <icewind@owncloud.com>2015-12-01 16:50:20 +0100
commit62cc316c6a198713195ea5c6543eaa443c0cf764 (patch)
treeae9e3ecbd8a58bc3984826fca66c0b77c87e6c4f /lib/private/files
parent74e8c25a5b48eb4b675de262ced1702dec4307f4 (diff)
downloadnextcloud-server-62cc316c6a198713195ea5c6543eaa443c0cf764.tar.gz
nextcloud-server-62cc316c6a198713195ea5c6543eaa443c0cf764.zip
remove old propagation logic
Diffstat (limited to 'lib/private/files')
-rw-r--r--lib/private/files/cache/changepropagator.php125
-rw-r--r--lib/private/files/utils/scanner.php18
2 files changed, 0 insertions, 143 deletions
diff --git a/lib/private/files/cache/changepropagator.php b/lib/private/files/cache/changepropagator.php
deleted file mode 100644
index 2a48eb13c59..00000000000
--- a/lib/private/files/cache/changepropagator.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-/**
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <icewind@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-namespace OC\Files\Cache;
-
-use OC\Files\Filesystem;
-use OC\Hooks\BasicEmitter;
-
-/**
- * Propagates changes in etag and mtime up the filesystem tree
- *
- * @package OC\Files\Cache
- */
-class ChangePropagator extends BasicEmitter {
- /**
- * @var string[]
- */
- protected $changedFiles = array();
-
- /**
- * @var \OC\Files\View
- */
- protected $view;
-
- /**
- * @param \OC\Files\View $view
- */
- public function __construct(\OC\Files\View $view) {
- $this->view = $view;
- }
-
- public function addChange($path) {
- $this->changedFiles[] = $path;
- }
-
- public function getChanges() {
- return $this->changedFiles;
- }
-
- /**
- * propagate the registered changes to their parent folders
- *
- * @param int $time (optional) the mtime to set for the folders, if not set the current time is used
- */
- public function propagateChanges($time = null) {
- $changes = $this->getChanges();
- $this->changedFiles = [];
- if (!$time) {
- $time = time();
- }
- foreach ($changes as $change) {
- /**
- * @var \OC\Files\Storage\Storage $storage
- * @var string $internalPath
- */
-
- $absolutePath = $this->view->getAbsolutePath($change);
- $mount = $this->view->getMount($change);
- $storage = $mount->getStorage();
- $internalPath = $mount->getInternalPath($absolutePath);
- if ($storage) {
- $propagator = $storage->getPropagator();
- $propagatedEntries = $propagator->propagateChange($internalPath, $time);
-
- foreach ($propagatedEntries as $entry) {
- $absolutePath = Filesystem::normalizePath($mount->getMountPoint() . '/' . $entry['path']);
- $relativePath = $this->view->getRelativePath($absolutePath);
- $this->emit('\OC\Files', 'propagate', [$relativePath, $entry]);
- }
- }
- }
- }
-
- /**
- * @return string[]
- */
- public function getAllParents() {
- $parents = array();
- foreach ($this->getChanges() as $path) {
- $parents = array_values(array_unique(array_merge($parents, $this->getParents($path))));
- }
- return $parents;
- }
-
- /**
- * get all parent folders of $path
- *
- * @param string $path
- * @return string[]
- */
- protected function getParents($path) {
- $parts = explode('/', $path);
-
- // remove the singe file
- array_pop($parts);
- $result = array('/');
- $resultPath = '';
- foreach ($parts as $part) {
- if ($part) {
- $resultPath .= '/' . $part;
- $result[] = $resultPath;
- }
- }
- return $result;
- }
-}
diff --git a/lib/private/files/utils/scanner.php b/lib/private/files/utils/scanner.php
index 85ca734c146..5621bf13910 100644
--- a/lib/private/files/utils/scanner.php
+++ b/lib/private/files/utils/scanner.php
@@ -26,8 +26,6 @@
namespace OC\Files\Utils;
-use OC\Files\View;
-use OC\Files\Cache\ChangePropagator;
use OC\Files\Filesystem;
use OC\ForbiddenException;
use OC\Hooks\PublicEmitter;
@@ -51,11 +49,6 @@ class Scanner extends PublicEmitter {
private $user;
/**
- * @var \OC\Files\Cache\ChangePropagator
- */
- protected $propagator;
-
- /**
* @var \OCP\IDBConnection
*/
protected $db;
@@ -73,7 +66,6 @@ class Scanner extends PublicEmitter {
public function __construct($user, $db, ILogger $logger) {
$this->logger = $logger;
$this->user = $user;
- $this->propagator = new ChangePropagator(new View(''));
$this->db = $db;
}
@@ -116,14 +108,6 @@ class Scanner extends PublicEmitter {
$scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function ($path) use ($mount, $emitter) {
$emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint() . $path));
});
- // propagate etag and mtimes when files are changed or removed
- $propagator = $this->propagator;
- $propagatorListener = function ($path) use ($mount, $propagator) {
- $fullPath = Filesystem::normalizePath($mount->getMountPoint() . $path);
- $propagator->addChange($fullPath);
- };
- $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', $propagatorListener);
- $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', $propagatorListener);
}
/**
@@ -139,7 +123,6 @@ class Scanner extends PublicEmitter {
$this->attachListener($mount);
$scanner->backgroundScan();
}
- $this->propagator->propagateChanges(time());
}
/**
@@ -181,7 +164,6 @@ class Scanner extends PublicEmitter {
$this->db->commit();
}
}
- $this->propagator->propagateChanges(time());
}
}