}
foreach ($this->_copy as $to => $from) {
- if (!file_exists($from)) {
- continue;
- }
if ($delete) {
$existing[$to] = true;
}
}
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));
}
}
if ($delete) {
$this->_delete($existing);
}
+
$this->cleanTemp();
}