]> _ Git - cubist_util.git/commitdiff
wait #5891 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 27 Apr 2023 14:47:32 +0000 (16:47 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 27 Apr 2023 14:47:32 +0000 (16:47 +0200)
src/Files/VirtualDirectory.php

index e3d5c0aabe0fcebcc9e902b89872da65be956076..3d2d4c944f2588e89da6c425c8f0d557b2d24f2a 100644 (file)
@@ -76,9 +76,6 @@ class VirtualDirectory
         }
 
         foreach ($this->_copy as $to => $from) {
-            if (!file_exists($from)) {
-                continue;
-            }
             if ($delete) {
                 $existing[$to] = true;
             }
@@ -88,9 +85,10 @@ class VirtualDirectory
             }
 
             if (!file_exists($to) || filesize($from) !== filesize($to) || filemtime($from) !== filemtime($to)) {
-                try {
-                    `cp -p $from $to`;
-                } catch (\Exception $e) {
+                $to_esc = escapeshellarg($to);
+                $from_esc = escapeshellarg($from);
+                `cp -p $from_esc $to_esc`;
+                if (!file_exists($to)) {
                     throw new \Exception(sprintf('Failed to copy %s to %s', $from, $to));
                 }
             }
@@ -107,6 +105,7 @@ class VirtualDirectory
         if ($delete) {
             $this->_delete($existing);
         }
+
         $this->cleanTemp();
     }