only emit the filesystem hooks once when creating a new file

This commit is contained in:
Robin Appelman 2012-05-05 16:47:23 +02:00
parent 4a7591d0ab
commit d875191777
1 changed files with 8 additions and 7 deletions

View File

@ -32,16 +32,17 @@ if($source){
OCP\JSON::error(array("data" => array( "message" => "Error while downloading ".$source. ' to '.$target ))); OCP\JSON::error(array("data" => array( "message" => "Error while downloading ".$source. ' to '.$target )));
exit(); exit();
} }
} }else{
if(OC_Files::newFile($dir, $filename, 'file')) {
if($content){ if($content){
OC_Filesystem::file_put_contents($dir.'/'.$filename,$content); if(OC_Filesystem::file_put_contents($dir.'/'.$filename,$content)){
}
OCP\JSON::success(array("data" => array('content'=>$content))); OCP\JSON::success(array("data" => array('content'=>$content)));
exit(); exit();
} }
}elseif(OC_Files::newFile($dir, $filename, 'file')){
OCP\JSON::success(array("data" => array('content'=>$content)));
exit();
}
}
OCP\JSON::error(array("data" => array( "message" => "Error when creating the file" ))); OCP\JSON::error(array("data" => array( "message" => "Error when creating the file" )));