Skip to content

Commit f2b3943

Browse files
committed
modified move function
1 parent 12a21d4 commit f2b3943

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

server/lib/classes/system.inc.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -934,18 +934,12 @@ function copy($file1, $file2) {
934934
return copy($file1, $file2);
935935
}
936936

937-
function move($file1, $file2) {
938-
if(file_exists($file1) || is_link($file1) && is_dir(realpath(dirname($file2)))) {
939-
if(copy($file1, $file2)) {
940-
return unlink($file1);
941-
} else {
942-
$app->log("move failed: couldn't move file/link " .$file1. " to " .$file2, LOGLEVEL_DEBUG);
943-
return false;
944-
}
945-
} else {
946-
$app->log("move failed: source " .$file1. " doesn't exist.", LOGLEVEL_DEBUG);
947-
return false;
937+
function move($file1, $file2) {
938+
$result = $this->copy($file1, $file2);
939+
if($result) {
940+
$result &= $this->unlink($file1);
948941
}
942+
return $result;
949943
}
950944

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

0 commit comments

Comments
 (0)