Esempio n. 1
0
 /**
  * Helper function to clear the theme cache directory
  * before the new css and js files are compiled.
  *
  * @param array $names
  */
 private function clearDirectory($names = array())
 {
     $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->pathResolver->getCacheDirectory(), \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST);
     /** @var \SplFileInfo $path */
     foreach ($iterator as $path) {
         if ($path->getFilename() == '.gitkeep') {
             continue;
         }
         if (!$this->fileNameMatch($path->getFilename(), $names)) {
             continue;
         }
         if ($path->isDir()) {
             rmdir($path->__toString());
         } else {
             unlink($path->__toString());
         }
     }
 }
Esempio n. 2
0
 /**
  * Clear theme cache
  */
 public function clearThemeCache()
 {
     $this->clearDirectory($this->themePathResolver->getCacheDirectory());
 }