Useful for holding onto loaded filters and creating collections of filters based on specific target requirements.
Beispiel #1
0
 /**
  * Check to see if a cached build file is 'fresh'.
  * Fresh cached files have timestamps newer than all of the component
  * files.
  *
  * @param AssetTarget $target The target file being built.
  * @return boolean
  */
 public function isFresh(AssetTarget $target)
 {
     $buildName = $this->buildFileName($target);
     $buildFile = $this->outputDir($target) . DIRECTORY_SEPARATOR . $buildName;
     if (!file_exists($buildFile)) {
         return false;
     }
     $buildTime = filemtime($buildFile);
     if ($this->configTime && $this->configTime >= $buildTime) {
         return false;
     }
     foreach ($target->files() as $file) {
         $time = $file->modifiedTime();
         if ($time === false || $time >= $buildTime) {
             return false;
         }
     }
     $filters = $this->filterRegistry->collection($target);
     foreach ($filters->filters() as $filter) {
         foreach ($filter->getDependencies($target) as $child) {
             $time = $child->modifiedTime();
             if ($time >= $buildTime) {
                 return false;
             }
         }
     }
     return true;
 }