summaryrefslogtreecommitdiffstats
path: root/lib/filesystemview.php
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-07-31 15:00:04 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-07-31 15:00:04 -0400
commit94ce8f2168bdd9897f54ec433ad7017fb3db1cc8 (patch)
treedb031ac7fd4788be6593e258d170c8f134533e4b /lib/filesystemview.php
parent269922543eaf9e69dbf5a15fa0ba34704040b09c (diff)
parentdfae77dec1650f171d09d4bde88ab74029f6e8c7 (diff)
downloadnextcloud-server-94ce8f2168bdd9897f54ec433ad7017fb3db1cc8.tar.gz
nextcloud-server-94ce8f2168bdd9897f54ec433ad7017fb3db1cc8.zip
Merge branch 'master' into share_api
Conflicts: apps/contacts/lib/app.php apps/files_sharing/js/share.js
Diffstat (limited to 'lib/filesystemview.php')
-rw-r--r--lib/filesystemview.php67
1 files changed, 36 insertions, 31 deletions
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index af1a578ec6a..a488b4953d5 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -244,49 +244,54 @@ class OC_FilesystemView {
}
public function file_put_contents($path, $data) {
if(is_resource($data)) {//not having to deal with streams in file_put_contents makes life easier
- $exists = $this->file_exists($path);
- $run = true;
- if(!$exists) {
+ $absolutePath = $this->getAbsolutePath($path);
+ if (OC_FileProxy::runPreProxies('file_put_contents', $absolutePath, $data) && OC_Filesystem::isValidPath($path)) {
+ $path = $this->getRelativePath($absolutePath);
+ $exists = $this->file_exists($path);
+ $run = true;
+ if(!$exists) {
+ OC_Hook::emit(
+ OC_Filesystem::CLASSNAME,
+ OC_Filesystem::signal_create,
+ array(
+ OC_Filesystem::signal_param_path => $path,
+ OC_Filesystem::signal_param_run => &$run
+ )
+ );
+ }
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_create,
+ OC_Filesystem::signal_write,
array(
OC_Filesystem::signal_param_path => $path,
OC_Filesystem::signal_param_run => &$run
)
);
- }
- OC_Hook::emit(
- OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_write,
- array(
- OC_Filesystem::signal_param_path => $path,
- OC_Filesystem::signal_param_run => &$run
- )
- );
- if(!$run) {
- return false;
- }
- $target=$this->fopen($path, 'w');
- if($target) {
- $count=OC_Helper::streamCopy($data, $target);
- fclose($target);
- fclose($data);
- if(!$exists) {
+ if(!$run) {
+ return false;
+ }
+ $target=$this->fopen($path, 'w');
+ if($target) {
+ $count=OC_Helper::streamCopy($data, $target);
+ fclose($target);
+ fclose($data);
+ if(!$exists) {
+ OC_Hook::emit(
+ OC_Filesystem::CLASSNAME,
+ OC_Filesystem::signal_post_create,
+ array( OC_Filesystem::signal_param_path => $path)
+ );
+ }
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_post_create,
+ OC_Filesystem::signal_post_write,
array( OC_Filesystem::signal_param_path => $path)
);
+ OC_FileProxy::runPostProxies('file_put_contents', $absolutePath, $count);
+ return $count > 0;
+ }else{
+ return false;
}
- OC_Hook::emit(
- OC_Filesystem::CLASSNAME,
- OC_Filesystem::signal_post_write,
- array( OC_Filesystem::signal_param_path => $path)
- );
- return $count > 0;
- }else{
- return false;
}
}else{
return $this->basicOperation('file_put_contents', $path, array('create', 'write'), $data);