From: Vincent Vanwaelscappel Date: Mon, 13 Feb 2023 10:23:44 +0000 (+0100) Subject: wip #5725 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3edfcd801ab1014ea34317ac33f2eb8ce2422154;p=fluidbook_distantstorage.git wip #5725 @0.25 --- diff --git a/app/src/Tools.php b/app/src/Tools.php index 3b8410d..4b0a15d 100644 --- a/app/src/Tools.php +++ b/app/src/Tools.php @@ -13,10 +13,23 @@ class Tools { public static function copy($a) { foreach ($a['files'] as $from => $to) { - Files::copy($from, $to); + self::_cp($from, $to); } } + public static function lazyCopy($a) { + foreach ($a['files'] as $from => $to) { + if (file_exists($from)) { + self::_cp($from, $to); + } + } + } + + protected static function _cp($from, $to) { + Files::mkdir(dirname($to)); + Files::copyFile($from, $to); + } + protected static function _args($args, $defaults = []) { return array_merge($defaults, $args); }