return $res;
}
+ /**
+ * @param $search string
+ * @param $replace string
+ * @param $filenames string|string[]
+ * @return void
+ */
+ public static function str_replace($search, $replace, $filenames)
+ {
+ if (!is_array($filenames)) {
+ $filenames = [$filenames];
+ }
+ foreach ($filenames as $filename) {
+ if (!file_exists($filename)) {
+ continue;
+ }
+ file_put_contents($filename, str_replace($search, $replace, file_get_contents($filename)));
+ }
+ }
+
}
\ No newline at end of file
return $this;
}
if ($prepend) {
+ if (isset($this->_copy[$realto])) {
+ return $this;
+ }
$this->_copy = array_merge([$realto => $from], $this->_copy);
} else {
$this->_copy[$realto] = $from;
throw new \Exception(sprintf('Failed to copy %s to %s. Source doesn\'t exist', $from, $to));
}
- if (!file_exists($to) || filesize($from) !== filesize($to) || filemtime($from) > filemtime($to)) {
+ if (!file_exists($to) || filesize($from) !== filesize($to) || filemtime($from) !== filemtime($to)) {
try {
`cp -p $from $to`;
} catch (\Exception $e) {