diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-02-26 14:29:13 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-02-26 14:29:13 +0100 |
commit | bc49c6be04d78740d9b7cb100debcb6641559d39 (patch) | |
tree | 370d0d1b653e3cb464c1211d41ba89d107eab627 /lib | |
parent | 59df3ffdf4647fcff1996017723af8c5eca72522 (diff) | |
download | nextcloud-server-bc49c6be04d78740d9b7cb100debcb6641559d39.tar.gz nextcloud-server-bc49c6be04d78740d9b7cb100debcb6641559d39.zip |
Manually triger the filecache update hooks before any other hook
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/view.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 2dbbf5b88c9..a76115a816e 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -25,6 +25,8 @@ namespace OC\Files; +use OC\Files\Cache\Updater; + class View { private $fakeRoot = ''; private $internal_path_cache = array(); @@ -433,6 +435,7 @@ class View { } if ($this->shouldEmitHooks() && (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 + Updater::writeHook(array('path' => $this->getHookPath($path2))); \OC_Hook::emit( Filesystem::CLASSNAME, Filesystem::signal_post_write, @@ -441,6 +444,10 @@ class View { ) ); } elseif ($this->shouldEmitHooks() && $result !== false) { + Updater::renameHook(array( + 'oldpath' => $this->getHookPath($path1), + 'newpath' => $this->getHookPath($path2) + )); \OC_Hook::emit( Filesystem::CLASSNAME, Filesystem::signal_post_rename, @@ -741,7 +748,10 @@ class View { } /** + * @param string[] $hooks * @param string $path + * @param bool $post + * @return bool */ private function runHooks($hooks, $path, $post = false) { $path = $this->getHookPath($path); @@ -749,6 +759,16 @@ class View { $run = true; if ($this->shouldEmitHooks($path)) { foreach ($hooks as $hook) { + // manually triger updater hooks to ensure they are called first + if ($post) { + if ($hook == 'write') { + Updater::writeHook(array('path' => $path)); + } elseif ($hook == 'touch') { + Updater::touchHook(array('path' => $path)); + } else if ($hook == 'delete') { + Updater::deleteHook(array('path' => $path)); + } + } if ($hook != 'read') { \OC_Hook::emit( Filesystem::CLASSNAME, |