예제 #1
0
 public function deleteMatched($matcher, array $options = [])
 {
     $allFiles = Toolbox\FileTools::searchFile($this->basePath);
     foreach ($allFiles as $file) {
         $key = urldecode(substr($file, strrpos($file, DIRECTORY_SEPARATOR) + 1));
         if (preg_match($matcher, $key)) {
             $this->getEntry($key, [])->delete();
         }
     }
 }
예제 #2
0
 public function deleteMatched($matcher, array $options = [])
 {
     $allFiles = Toolbox\FileTools::searchFile($this->basePath);
     foreach ($allFiles as $file) {
         $key = urldecode(substr($file, strrpos($file, DIRECTORY_SEPARATOR) + 1));
         if (preg_match($matcher, $key)) {
             $this->getEntry($key, [])->delete();
         }
     }
     foreach (Toolbox\FileTools::listFilesRecursive($this->basePath) as $finfo) {
         $key = $finfo->getBaseName();
         $entry = $this->getEntry($key, []);
         if ($entry->expired()) {
             $entry->delete();
         }
     }
 }
예제 #3
0
 /**
  * Deletes everything inside the compile folder.
  */
 public function emptyCompileDir()
 {
     $this->console("Deleting compiled assets");
     $dir = $this->compilePath() . $this->prefix();
     if (is_dir($dir)) {
         Rails\Toolbox\FileTools::emptyDir($dir);
     }
 }
예제 #4
0
 public function includeFactories(array $paths)
 {
     $includer = ClassTools::generateFileIncluder($this);
     foreach ($paths as $path) {
         foreach (FileTools::listFilesRecursive($path) as $file) {
             $includer($file->getRealPath());
         }
     }
 }
예제 #5
0
파일: Base.php 프로젝트: railsphp/railsphp
 protected function requireTree($tree)
 {
     $rootDir = $this->file->full_dir();
     $path = $rootDir . '/' . $tree;
     $realPath = realpath($path);
     if (!$realPath) {
         throw new Exception\RuntimeException(sprintf("Path to tree not found: %s", $path));
     }
     # Require files in root directory.
     $this->requireDir($tree);
     # Require files in sub directories.
     $allDirs = Toolbox\FileTools::listDirs($realPath);
     foreach ($allDirs as $dir) {
         $relativeDir = trim(substr($dir, strlen($rootDir)), '/');
         $this->requireDir($relativeDir);
     }
 }
예제 #6
0
파일: Base.php 프로젝트: railsphp/railsphp
 private function runInitializers()
 {
     $dirName = 'initializers';
     $path = $this->config()->paths->config->concat($dirName);
     if (is_dir($path)) {
         $files = [];
         $patt = $path . '/*.php';
         $files = array_merge($files, glob($patt) ?: []);
         foreach (Toolbox\FileTools::listDirs($path) as $dir) {
             $patt = $dir . '/*.php';
             $files = array_merge($files, glob($patt) ?: []);
         }
         foreach ($files as $file) {
             require $file;
         }
     }
 }