Remove explicit propagate calls

This commit is contained in:
Robin Appelman 2014-08-12 13:59:06 +02:00
parent 58a1540587
commit e29b7e9335
2 changed files with 7 additions and 19 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* Copyright (c) 2012 Robin Appelman <icewind@owncloud.com> * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or * This file is licensed under the Affero General Public License version 3 or
* later. * later.
* See the COPYING-README file. * See the COPYING-README file.
@ -34,8 +34,9 @@ class Updater {
* Update the cache for $path * Update the cache for $path
* *
* @param string $path * @param string $path
* @param int $time
*/ */
public function update($path) { public function update($path, $time = null) {
/** /**
* @var \OC\Files\Storage\Storage $storage * @var \OC\Files\Storage\Storage $storage
* @var string $internalPath * @var string $internalPath
@ -48,6 +49,7 @@ class Updater {
$data = $scanner->scan($internalPath, Scanner::SCAN_SHALLOW); $data = $scanner->scan($internalPath, Scanner::SCAN_SHALLOW);
$this->correctParentStorageMtime($storage, $internalPath); $this->correctParentStorageMtime($storage, $internalPath);
$cache->correctFolderSize($internalPath, $data); $cache->correctFolderSize($internalPath, $data);
$this->propagator->propagateChanges($time);
} }
} }
@ -72,6 +74,7 @@ class Updater {
$cache->remove($internalPath); $cache->remove($internalPath);
$cache->correctFolderSize($parent); $cache->correctFolderSize($parent);
$this->correctParentStorageMtime($storage, $internalPath); $this->correctParentStorageMtime($storage, $internalPath);
$this->propagator->propagateChanges();
} }
} }
@ -115,18 +118,10 @@ class Updater {
$this->remove($source); $this->remove($source);
$this->update($target); $this->update($target);
} }
$this->propagator->propagateChanges();
} }
} }
/**
* propagate the updates 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 propagate($time = null) {
$this->propagator->propagateChanges($time);
}
/** /**
* update the storage_mtime of the parent * update the storage_mtime of the parent
* *

View File

@ -384,7 +384,6 @@ class View {
fclose($target); fclose($target);
fclose($data); fclose($data);
$this->updater->update($path); $this->updater->update($path);
$this->updater->propagate();
if ($this->shouldEmitHooks($path) && $result !== false) { if ($this->shouldEmitHooks($path) && $result !== false) {
$this->emit_file_hooks_post($exists, $path); $this->emit_file_hooks_post($exists, $path);
} }
@ -506,13 +505,11 @@ class View {
if ((Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2)) && $result !== false) { if ((Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2)) && $result !== false) {
// if it was a rename from a part file to a regular file it was a write and not a rename operation // if it was a rename from a part file to a regular file it was a write and not a rename operation
$this->updater->update($path2); $this->updater->update($path2);
$this->updater->propagate();
if ($this->shouldEmitHooks()) { if ($this->shouldEmitHooks()) {
$this->emit_file_hooks_post($exists, $path2); $this->emit_file_hooks_post($exists, $path2);
} }
} elseif ($this->shouldEmitHooks() && $result !== false) { } elseif ($this->shouldEmitHooks() && $result !== false) {
$this->updater->rename($path1, $path2); $this->updater->rename($path1, $path2);
$this->updater->propagate();
\OC_Hook::emit( \OC_Hook::emit(
Filesystem::CLASSNAME, Filesystem::CLASSNAME,
Filesystem::signal_post_rename, Filesystem::signal_post_rename,
@ -592,7 +589,6 @@ class View {
} }
} }
$this->updater->update($path2); $this->updater->update($path2);
$this->updater->propagate();
if ($this->shouldEmitHooks() && $result !== false) { if ($this->shouldEmitHooks() && $result !== false) {
\OC_Hook::emit( \OC_Hook::emit(
Filesystem::CLASSNAME, Filesystem::CLASSNAME,
@ -776,15 +772,12 @@ class View {
if (in_array('delete', $hooks)) { if (in_array('delete', $hooks)) {
$this->updater->remove($path); $this->updater->remove($path);
$this->updater->propagate();
} }
if (in_array('write', $hooks)) { if (in_array('write', $hooks)) {
$this->updater->update($path); $this->updater->update($path);
$this->updater->propagate();
} }
if (in_array('touch', $hooks)) { if (in_array('touch', $hooks)) {
$this->updater->update($path); $this->updater->update($path, $extraParam);
$this->updater->propagate($extraParam);
} }
if ($this->shouldEmitHooks($path) && $result !== false) { if ($this->shouldEmitHooks($path) && $result !== false) {