]> _ Git - fluidbook_distantstorage.git/commitdiff
wip #5725 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 13 Feb 2023 10:23:44 +0000 (11:23 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 13 Feb 2023 10:23:44 +0000 (11:23 +0100)
app/src/Tools.php

index 3b8410d862e577f3e6ddf63ecbd3c76005b06164..4b0a15d62bd905e98da8108cc73fa1f21870c106 100644 (file)
@@ -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);
        }