summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-04-09 16:47:51 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-04-29 10:34:27 +0200
commitc1caaa624109d75d61394c9b4a43b638ddf8936a (patch)
treec122da980923c5b5704ab3e5f807bb294e12aaff
parent4fa9e46d2b92c03e81c0ffeaebfd28d400bacf0c (diff)
downloadnextcloud-server-c1caaa624109d75d61394c9b4a43b638ddf8936a.tar.gz
nextcloud-server-c1caaa624109d75d61394c9b4a43b638ddf8936a.zip
Correctly emit create/update hooks when a large file is being created/update
after being uploaded in .part files Fix #8131
-rw-r--r--lib/private/files/view.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 1291ed170e8..d0c7e14ef63 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -393,6 +393,7 @@ class View {
) {
$path1 = $this->getRelativePath($absolutePath1);
$path2 = $this->getRelativePath($absolutePath2);
+ $exists = $this->file_exists($path2);
if ($path1 == null or $path2 == null) {
return false;
@@ -400,6 +401,23 @@ class View {
$run = true;
if ($this->shouldEmitHooks() && (Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2))) {
// if it was a rename from a part file to a regular file it was a write and not a rename operation
+ if (!$exists) {
+ \OC_Hook::emit(
+ Filesystem::CLASSNAME, Filesystem::signal_create,
+ array(
+ Filesystem::signal_param_path => $this->getHookPath($path2),
+ Filesystem::signal_param_run => &$run
+ )
+ );
+ } else {
+ \OC_Hook::emit(
+ Filesystem::CLASSNAME, Filesystem::signal_update,
+ array(
+ Filesystem::signal_param_path => $this->getHookPath($path2),
+ Filesystem::signal_param_run => &$run,
+ )
+ );
+ }
\OC_Hook::emit(
Filesystem::CLASSNAME, Filesystem::signal_write,
array(
@@ -463,6 +481,19 @@ 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)));
+ if (!$exists) {
+ \OC_Hook::emit(
+ Filesystem::CLASSNAME,
+ Filesystem::signal_post_create,
+ array(Filesystem::signal_param_path => $this->getHookPath($path2))
+ );
+ } else {
+ \OC_Hook::emit(
+ Filesystem::CLASSNAME,
+ Filesystem::signal_post_update,
+ array(Filesystem::signal_param_path => $this->getHookPath($path2))
+ );
+ }
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_write,