summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-03-16 10:15:41 +0100
committerVincent Petry <pvince81@owncloud.com>2016-03-21 15:14:58 +0100
commitf28f5380295b16d89f81994fc990924b8f15fa20 (patch)
treed5e26fce68069ec7f6ae9fa5571917311fb4880a /lib
parent86581f66265be0dddb97f67ac867a5cb92d335e0 (diff)
downloadnextcloud-server-f28f5380295b16d89f81994fc990924b8f15fa20.tar.gz
nextcloud-server-f28f5380295b16d89f81994fc990924b8f15fa20.zip
Do not fire pre/post hooks twice on chunk upload
Diffstat (limited to 'lib')
-rw-r--r--lib/private/filechunking.php48
1 files changed, 5 insertions, 43 deletions
diff --git a/lib/private/filechunking.php b/lib/private/filechunking.php
index d6ff160870d..604a607336c 100644
--- a/lib/private/filechunking.php
+++ b/lib/private/filechunking.php
@@ -150,59 +150,21 @@ class OC_FileChunking {
* Assembles the chunks into the file specified by the path.
* Also triggers the relevant hooks and proxies.
*
- * @param \OC\Files\Storage\Storage $storage
+ * @param \OC\Files\Storage\Storage $storage storage
* @param string $path target path relative to the storage
- * @param string $absolutePath
- * @return bool assembled file size or false if file could not be created
+ * @return bool true on success or false if file could not be created
*
* @throws \OC\ServerNotAvailableException
*/
- public function file_assemble($storage, $path, $absolutePath) {
- $data = '';
+ public function file_assemble($storage, $path) {
// use file_put_contents as method because that best matches what this function does
if (\OC\Files\Filesystem::isValidPath($path)) {
- $exists = $storage->file_exists($path);
- $run = true;
- $hookPath = \OC\Files\Filesystem::getView()->getRelativePath($absolutePath);
- if(!$exists) {
- OC_Hook::emit(
- \OC\Files\Filesystem::CLASSNAME,
- \OC\Files\Filesystem::signal_create,
- array(
- \OC\Files\Filesystem::signal_param_path => $hookPath,
- \OC\Files\Filesystem::signal_param_run => &$run
- )
- );
- }
- OC_Hook::emit(
- \OC\Files\Filesystem::CLASSNAME,
- \OC\Files\Filesystem::signal_write,
- array(
- \OC\Files\Filesystem::signal_param_path => $hookPath,
- \OC\Files\Filesystem::signal_param_run => &$run
- )
- );
- if(!$run) {
- return false;
- }
$target = $storage->fopen($path, 'w');
- if($target) {
+ if ($target) {
$count = $this->assemble($target);
fclose($target);
- if(!$exists) {
- OC_Hook::emit(
- \OC\Files\Filesystem::CLASSNAME,
- \OC\Files\Filesystem::signal_post_create,
- array( \OC\Files\Filesystem::signal_param_path => $hookPath)
- );
- }
- OC_Hook::emit(
- \OC\Files\Filesystem::CLASSNAME,
- \OC\Files\Filesystem::signal_post_write,
- array( \OC\Files\Filesystem::signal_param_path => $hookPath)
- );
return $count > 0;
- }else{
+ } else {
return false;
}
}