Ejemplo n.º 1
0
 /**
  * Mirrors a directory to another.
  *
  * @param string   $originDir  The origin directory
  * @param string   $targetDir  The target directory
  * @param sfFinder $finder     An sfFinder instance
  * @param array    $options    An array of options (see copy())
  */
 public function mirror($originDir, $targetDir, $finder, $options = array())
 {
     foreach ($finder->relative()->in($originDir) as $file) {
         if (is_dir($originDir . DIRECTORY_SEPARATOR . $file)) {
             $this->mkdirs($targetDir . DIRECTORY_SEPARATOR . $file);
         } else {
             if (is_file($originDir . DIRECTORY_SEPARATOR . $file)) {
                 $this->copy($originDir . DIRECTORY_SEPARATOR . $file, $targetDir . DIRECTORY_SEPARATOR . $file, $options);
             } else {
                 if (is_link($originDir . DIRECTORY_SEPARATOR . $file)) {
                     $this->symlink($originDir . DIRECTORY_SEPARATOR . $file, $targetDir . DIRECTORY_SEPARATOR . $file);
                 } else {
                     throw new sfException(sprintf('Unable to guess "%s" file type.', $file));
                 }
             }
         }
     }
 }