mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Fix edge case file_exists
This commit is contained in:
parent
3f8b34f00a
commit
1ef5b8d01f
|
|
@ -318,6 +318,8 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
|
||||
if (!file_exists($to)) {
|
||||
self::create($to, 0644, true);
|
||||
} elseif($overwrite && file_exists($to)) {
|
||||
self::delete($to);
|
||||
}
|
||||
|
||||
foreach ($iterator = new \RecursiveIteratorIterator(
|
||||
|
|
@ -345,6 +347,8 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
|
||||
if (!$overwrite && file_exists($to)) {
|
||||
return false;
|
||||
} elseif($overwrite && file_exists($to)) {
|
||||
self::delete($to);
|
||||
}
|
||||
|
||||
if (!self::exists(self::parent($to))) {
|
||||
|
|
|
|||
|
|
@ -268,6 +268,10 @@ class File extends FileAbstract implements FileInterface
|
|||
Directory::create(dirname($to), 0644, true);
|
||||
}
|
||||
|
||||
if($overwrite && file_exists($to)) {
|
||||
unlink($to);
|
||||
}
|
||||
|
||||
copy($from, $to);
|
||||
|
||||
return true;
|
||||
|
|
@ -290,6 +294,10 @@ class File extends FileAbstract implements FileInterface
|
|||
Directory::create(dirname($to), 0644, true);
|
||||
}
|
||||
|
||||
if($overwrite && file_exists($to)) {
|
||||
unlink($to);
|
||||
}
|
||||
|
||||
rename($from, $to);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user