コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function isResourceFresh($bundleClass, $bundleDir, CumulativeResource $resource, $timestamp)
 {
     // check exist and removed resources
     $found = $resource->getFound($bundleClass);
     foreach ($found as $path) {
         if (!is_file($path) || filemtime($path) >= $timestamp) {
             return false;
         }
     }
     // check new resources
     $finder = $this->getFileFinder($bundleDir);
     if ($finder) {
         /** @var \SplFileInfo $file */
         foreach ($finder as $file) {
             $path = $file->getRealPath();
             if (!$resource->isFound($bundleClass, $path)) {
                 return false;
             }
         }
     }
     return true;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function isResourceFresh($bundleClass, $bundleDir, $bundleAppDir, CumulativeResource $resource, $timestamp)
 {
     $registeredFiles = $resource->getFound($bundleClass);
     $registeredFiles = array_flip($registeredFiles);
     // Check and remove data from $bundleAppDir resources directory
     if (is_dir($bundleAppDir)) {
         $dir = $this->getResourcesDirectoryAbsolutePath($bundleAppDir);
         $realPath = realpath($dir);
         if (is_dir($realPath)) {
             $currentContents = $this->getDirectoryContentsArray($realPath);
             foreach ($currentContents as $filename) {
                 if (!$resource->isFound($bundleClass, $filename)) {
                     return false;
                 }
                 unset($registeredFiles[$filename]);
             }
         }
     }
     // Check and remove data from $bundleDir resources directory
     $dir = $this->getDirectoryAbsolutePath($bundleDir);
     $realPath = realpath($dir);
     if (is_dir($realPath)) {
         $currentContents = $this->getDirectoryContentsArray($realPath);
         foreach ($currentContents as $filename) {
             if (!$resource->isFound($bundleClass, $filename)) {
                 return false;
             }
             unset($registeredFiles[$filename]);
         }
     }
     // case when entire dir was removed or some file was removed
     if (!empty($registeredFiles)) {
         return false;
     }
     return true;
 }