Upgrade to 3.9.0

This commit is contained in:
Bastian Allgeier
2023-01-17 14:50:16 +01:00
parent 0ebe0c7b16
commit 6e5c9d1f48
132 changed files with 1664 additions and 1254 deletions

View File

@@ -48,12 +48,16 @@ class Dir
/**
* Copy the directory to a new destination
*
* @param array|false $ignore List of full paths to skip during copying
* or `false` to copy all files, including
* those listed in `Dir::$ignore`
*/
public static function copy(
string $dir,
string $target,
bool $recursive = true,
array $ignore = []
array|bool $ignore = []
): bool {
if (is_dir($dir) === false) {
throw new Exception('The directory "' . $dir . '" does not exist');
@@ -67,10 +71,13 @@ class Dir
throw new Exception('The target directory "' . $target . '" could not be created');
}
foreach (static::read($dir) as $name) {
foreach (static::read($dir, $ignore === false ? [] : null) as $name) {
$root = $dir . '/' . $name;
if (in_array($root, $ignore) === true) {
if (
is_array($ignore) === true &&
in_array($root, $ignore) === true
) {
continue;
}

View File

@@ -514,7 +514,14 @@ class F
static::remove($newRoot);
}
// actually move the file if it exists
$directory = dirname($newRoot);
// create the parent directory if it does not exist
if (is_dir($directory) === false) {
Dir::make($directory, true);
}
// actually move the file
if (rename($oldRoot, $newRoot) !== true) {
return false;
}