From: Vincent Vanwaelscappel Date: Thu, 27 Apr 2023 14:47:32 +0000 (+0200) Subject: wait #5891 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=fc408c0d0687a6a58615a541fd41f3b1e718d034;p=cubist_util.git wait #5891 @0.25 --- diff --git a/src/Files/VirtualDirectory.php b/src/Files/VirtualDirectory.php index e3d5c0a..3d2d4c9 100644 --- a/src/Files/VirtualDirectory.php +++ b/src/Files/VirtualDirectory.php @@ -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(); }