Simplified Filesystem->copy()

This commit is contained in:
Jordan Alliot 2011-08-26 09:34:23 +01:00
parent 707e8aaecb
commit 9a05db0e7e

View File

@ -33,14 +33,13 @@ class Filesystem
{
$this->mkdir(dirname($targetFile));
$mostRecent = false;
if (file_exists($targetFile)) {
$statTarget = stat($targetFile);
$statOrigin = stat($originFile);
$mostRecent = $statOrigin['mtime'] > $statTarget['mtime'];
if (!$override && file_exists($targetFile)) {
$doCopy = filemtime($originFile) > filemtime($targetFile);
} else {
$doCopy = true;
}
if ($override || !file_exists($targetFile) || $mostRecent) {
if ($doCopy) {
copy($originFile, $targetFile);
}
}
@ -145,7 +144,7 @@ class Filesystem
*
* @param string $originDir The origin directory path
* @param string $targetDir The symbolic link name
* @param Boolean $copyOnWindows Whether to copy files if on windows
* @param Boolean $copyOnWindows Whether to copy files if on Windows
*/
public function symlink($originDir, $targetDir, $copyOnWindows = false)
{