From de631c8b20ecb21a653ca6218f901b49bc92336c Mon Sep 17 00:00:00 2001 From: iskrisis Date: Thu, 27 Apr 2023 15:28:51 +0200 Subject: [PATCH] Update Dir.php --- src/Dir.php | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/src/Dir.php b/src/Dir.php index 2103d1c..dec22ed 100644 --- a/src/Dir.php +++ b/src/Dir.php @@ -6,7 +6,7 @@ class Dir extends \Kirby\Toolkit\Dir { // changed from dir class because it had .htacess in it - public static $ignore = [ + public static array $ignore = [ '.', '..', '.DS_Store', @@ -39,37 +39,4 @@ public static function read(string $dir, array $ignore = null, bool $absolute = return $result; } - - public static function copy(string $dir, string $target, bool $recursive = true, array $ignore = []): bool - { - if (is_dir($dir) === false) { - throw new Exception('The directory "' . $dir . '" does not exist'); - } - - if (is_dir($target) === true) { - throw new Exception('The target directory "' . $target . '" exists'); - } - - if (static::make($target) !== true) { - throw new Exception('The target directory "' . $target . '" could not be created'); - } - - foreach (self::read($dir) as $name) { - $root = $dir . '/' . $name; - - if (in_array($root, $ignore) === true) { - continue; - } - - if (is_dir($root) === true) { - if ($recursive === true) { - self::copy($root, $target . '/' . $name, true, $ignore); - } - } else { - \Kirby\Toolkit\F::copy($root, $target . '/' . $name); - } - } - - return true; - } } \ No newline at end of file