Selaa lähdekoodia

Simplified Filesystem->copy()

Jordan Alliot 13 vuotta sitten
vanhempi
commit
9a05db0e7e
1 muutettua tiedostoa jossa 6 lisäystä ja 7 poistoa
  1. 6 7
      src/Symfony/Component/HttpKernel/Util/Filesystem.php

+ 6 - 7
src/Symfony/Component/HttpKernel/Util/Filesystem.php

@@ -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)
     {