Esempio n. 1
0
 /**
  * @param  array     $files array of filenames
  * @param  PhingFile $dir
  *
  * @return boolean
  */
 protected function areFilesUpToDate($files, $dir)
 {
     $sfs = new SourceFileScanner($this);
     $mm = new MergeMapper();
     $mm->setTo($this->tarFile->getAbsolutePath());
     return count($sfs->restrict($files, $dir, null, $mm)) == 0;
 }
Esempio n. 2
0
 /**
  * Builds a map of filenames (from->to) that should be copied
  *
  * @access  private
  * @return  void
  */
 private function buildMap(&$fromDir, &$toDir, &$names, &$mapper, &$map)
 {
     $toCopy = null;
     if ($this->overwrite) {
         $v = array();
         foreach ($names as $name) {
             $result = $mapper->main($name);
             if ($result !== null) {
                 $v[] = $name;
             }
         }
         $toCopy = $v;
     } else {
         $ds = new SourceFileScanner($this);
         $toCopy = $ds->restrict($names, $fromDir, $toDir, $mapper);
     }
     for ($i = 0, $_i = count($toCopy); $i < $_i; $i++) {
         $src = new PhingFile($fromDir, $toCopy[$i]);
         $mapped = $mapper->main($toCopy[$i]);
         $dest = new PhingFile($toDir, $mapped[0]);
         $map[$src->getAbsolutePath()] = $dest->getAbsolutePath();
     }
 }
 protected function scanDir(PhingFile $srcDir, $files)
 {
     $sfs = new SourceFileScanner($this);
     $mapper = null;
     $dir = $srcDir;
     if ($this->mapperElement === null) {
         $mm = new MergeMapper();
         $mm->setTo($this->_targetFile->getAbsolutePath());
         $mapper = $mm;
         $dir = null;
     } else {
         $mapper = $this->mapperElement->getImplementation();
     }
     return count($sfs->restrict($files, $srcDir, $dir, $mapper)) === 0;
 }