summaryrefslogtreecommitdiffstats
path: root/lib/private/filechunking.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-08-12 15:06:59 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-09-14 20:35:33 +0200
commit63863271503384e124e39833d0598e8652d3a380 (patch)
tree4e892e2e32c9455c84ce26fad99d48ba632c109d /lib/private/filechunking.php
parentb4241514597585b69816d02d46ece6fda6cf7012 (diff)
downloadnextcloud-server-63863271503384e124e39833d0598e8652d3a380.tar.gz
nextcloud-server-63863271503384e124e39833d0598e8652d3a380.zip
work directly on storages when doing a chunked upload assembly
Diffstat (limited to 'lib/private/filechunking.php')
-rw-r--r--lib/private/filechunking.php27
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/private/filechunking.php b/lib/private/filechunking.php
index 82bf61fa7b1..64399ad4366 100644
--- a/lib/private/filechunking.php
+++ b/lib/private/filechunking.php
@@ -178,27 +178,26 @@ class OC_FileChunking {
* Assembles the chunks into the file specified by the path.
* Also triggers the relevant hooks and proxies.
*
- * @param string $path target path
+ * @param \OC\Files\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 boolean assembled file size or false if file could not be created
- *
- * @throws \OC\InsufficientStorageException when file could not be fully
- * assembled due to lack of free space
+ * @throws \OC\ServerNotAvailableException
*/
- public function file_assemble($path) {
- $absolutePath = \OC\Files\Filesystem::normalizePath(\OC\Files\Filesystem::getView()->getAbsolutePath($path));
+ public function file_assemble($storage, $path, $absolutePath) {
$data = '';
// use file_put_contents as method because that best matches what this function does
if (\OC\Files\Filesystem::isValidPath($path)) {
- $path = \OC\Files\Filesystem::getView()->getRelativePath($absolutePath);
- $exists = \OC\Files\Filesystem::file_exists($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 => $path,
+ \OC\Files\Filesystem::signal_param_path => $hookPath,
\OC\Files\Filesystem::signal_param_run => &$run
)
);
@@ -207,14 +206,14 @@ class OC_FileChunking {
\OC\Files\Filesystem::CLASSNAME,
\OC\Files\Filesystem::signal_write,
array(
- \OC\Files\Filesystem::signal_param_path => $path,
+ \OC\Files\Filesystem::signal_param_path => $hookPath,
\OC\Files\Filesystem::signal_param_run => &$run
)
);
if(!$run) {
return false;
}
- $target = \OC\Files\Filesystem::fopen($path, 'w');
+ $target = $storage->fopen($path, 'w');
if($target) {
$count = $this->assemble($target);
fclose($target);
@@ -222,13 +221,13 @@ class OC_FileChunking {
OC_Hook::emit(
\OC\Files\Filesystem::CLASSNAME,
\OC\Files\Filesystem::signal_post_create,
- array( \OC\Files\Filesystem::signal_param_path => $path)
+ 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 => $path)
+ array( \OC\Files\Filesystem::signal_param_path => $hookPath)
);
return $count > 0;
}else{