@@ -245,13 +245,13 @@ public function touch($path, $mtime = null) {
245
245
if (!is_null ($ mtime ) and !is_numeric ($ mtime )) {
246
246
$ mtime = strtotime ($ mtime );
247
247
}
248
-
248
+
249
249
$ hooks = array ('touch ' );
250
-
250
+
251
251
if (!$ this ->file_exists ($ path )) {
252
252
$ hooks [] = 'write ' ;
253
253
}
254
-
254
+
255
255
return $ this ->basicOperation ('touch ' , $ path , $ hooks , $ mtime );
256
256
}
257
257
@@ -263,11 +263,12 @@ public function file_put_contents($path, $data) {
263
263
if (is_resource ($ data )) { //not having to deal with streams in file_put_contents makes life easier
264
264
$ absolutePath = Filesystem::normalizePath ($ this ->getAbsolutePath ($ path ));
265
265
if (\OC_FileProxy::runPreProxies ('file_put_contents ' , $ absolutePath , $ data )
266
- && Filesystem::isValidPath ($ path )) {
266
+ && Filesystem::isValidPath ($ path )
267
+ ) {
267
268
$ path = $ this ->getRelativePath ($ absolutePath );
268
269
$ exists = $ this ->file_exists ($ path );
269
270
$ run = true ;
270
- if ($ this ->fakeRoot == Filesystem::getRoot () && ! Cache \Scanner::isIgnoredFile ($ path ) ) {
271
+ if ($ this ->fakeRoot == Filesystem::getRoot () && !Cache \Scanner::isIgnoredFile ($ path )) {
271
272
if (!$ exists ) {
272
273
\OC_Hook::emit (
273
274
Filesystem::CLASSNAME ,
@@ -295,7 +296,7 @@ public function file_put_contents($path, $data) {
295
296
list ($ count , $ result ) = \OC_Helper::streamCopy ($ data , $ target );
296
297
fclose ($ target );
297
298
fclose ($ data );
298
- if ($ this ->fakeRoot == Filesystem::getRoot () && ! Cache \Scanner::isIgnoredFile ($ path ) ) {
299
+ if ($ this ->fakeRoot == Filesystem::getRoot () && !Cache \Scanner::isIgnoredFile ($ path )) {
299
300
if (!$ exists ) {
300
301
\OC_Hook::emit (
301
302
Filesystem::CLASSNAME ,
@@ -335,8 +336,11 @@ public function rename($path1, $path2) {
335
336
$ postFix2 = (substr ($ path2 , -1 , 1 ) === '/ ' ) ? '/ ' : '' ;
336
337
$ absolutePath1 = Filesystem::normalizePath ($ this ->getAbsolutePath ($ path1 ));
337
338
$ absolutePath2 = Filesystem::normalizePath ($ this ->getAbsolutePath ($ path2 ));
338
- if (\OC_FileProxy::runPreProxies ('rename ' , $ absolutePath1 , $ absolutePath2 )
339
- and Filesystem::isValidPath ($ path2 )) {
339
+ if (
340
+ \OC_FileProxy::runPreProxies ('rename ' , $ absolutePath1 , $ absolutePath2 )
341
+ and Filesystem::isValidPath ($ path2 )
342
+ and Filesystem::isValidPath ($ path1 )
343
+ ) {
340
344
$ path1 = $ this ->getRelativePath ($ absolutePath1 );
341
345
$ path2 = $ this ->getRelativePath ($ absolutePath2 );
342
346
@@ -396,7 +400,11 @@ public function copy($path1, $path2) {
396
400
$ postFix2 = (substr ($ path2 , -1 , 1 ) === '/ ' ) ? '/ ' : '' ;
397
401
$ absolutePath1 = Filesystem::normalizePath ($ this ->getAbsolutePath ($ path1 ));
398
402
$ absolutePath2 = Filesystem::normalizePath ($ this ->getAbsolutePath ($ path2 ));
399
- if (\OC_FileProxy::runPreProxies ('copy ' , $ absolutePath1 , $ absolutePath2 ) and Filesystem::isValidPath ($ path2 )) {
403
+ if (
404
+ \OC_FileProxy::runPreProxies ('copy ' , $ absolutePath1 , $ absolutePath2 )
405
+ and Filesystem::isValidPath ($ path2 )
406
+ and Filesystem::isValidPath ($ path1 )
407
+ ) {
400
408
$ path1 = $ this ->getRelativePath ($ absolutePath1 );
401
409
$ path2 = $ this ->getRelativePath ($ absolutePath2 );
402
410
@@ -627,7 +635,7 @@ private function basicOperation($operation, $path, $hooks = array(), $extraParam
627
635
private function runHooks ($ hooks , $ path , $ post = false ) {
628
636
$ prefix = ($ post ) ? 'post_ ' : '' ;
629
637
$ run = true ;
630
- if (Filesystem::$ loaded and $ this ->fakeRoot == Filesystem::getRoot () && ! Cache \Scanner::isIgnoredFile ($ path ) ) {
638
+ if (Filesystem::$ loaded and $ this ->fakeRoot == Filesystem::getRoot () && !Cache \Scanner::isIgnoredFile ($ path )) {
631
639
foreach ($ hooks as $ hook ) {
632
640
if ($ hook != 'read ' ) {
633
641
\OC_Hook::emit (
@@ -930,11 +938,11 @@ private function searchCommon($query, $method) {
930
938
}
931
939
932
940
/**
933
- * Get the owner for a file or folder
934
- *
935
- * @param string $path
936
- * @return string
937
- */
941
+ * Get the owner for a file or folder
942
+ *
943
+ * @param string $path
944
+ * @return string
945
+ */
938
946
public function getOwner ($ path ) {
939
947
return $ this ->basicOperation ('getOwner ' , $ path );
940
948
}
0 commit comments