Upgrade to 3.9.4

This commit is contained in:
Bastian Allgeier
2023-04-21 11:26:07 +02:00
parent cd495f054e
commit 38c8ba7e59
57 changed files with 4658 additions and 87 deletions

View File

@@ -521,12 +521,26 @@ class F
Dir::make($directory, true);
}
// actually move the file
if (rename($oldRoot, $newRoot) !== true) {
return false;
// atomically moving the file will only work if
// source and target are on the same filesystem
if (stat($oldRoot)['dev'] === stat($directory)['dev']) {
// same filesystem, we can move the file
return rename($oldRoot, $newRoot) === true;
}
return true;
// @codeCoverageIgnoreStart
// not the same filesystem; we need to copy
// the file and unlink the source afterwards
if (copy($oldRoot, $newRoot) === true) {
return unlink($oldRoot) === true;
}
// copying failed, ensure the new root isn't there
// (e.g. if the file could be created but there's no
// more remaining disk space to write its contents)
static::remove($newRoot);
return false;
// @codeCoverageIgnoreEnd
}
/**