Skip to content

Commit 7a830e4

Browse files
committed
updated move code
1 parent 57e3cd6 commit 7a830e4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

server/lib/classes/system.inc.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -935,10 +935,18 @@ function copy($file1, $file2) {
935935
}
936936

937937
function move($file1, $file2) {
938-
return copy($file1, $file2);
939938
if(file_exists($file1) || is_link($file1)) {
940-
return unlink($file1);
941-
}
939+
return copy($file1, $file2);
940+
if(file_exists($file2) || is_link($file2)) {
941+
return unlink($file1);
942+
} else {
943+
$app->log("move failed: couldn't move file/link " .$file1." to ".$file2, LOGLEVEL_DEBUG);
944+
return false;
945+
}
946+
} else {
947+
$app->log("move failed: " .$file1." doesn't exist.", LOGLEVEL_DEBUG);
948+
return false;
949+
}
942950
}
943951

944952
function touch($file, $allow_symlink = false){

0 commit comments

Comments
 (0)