Esempio n. 1
0
 public function preparePage()
 {
     $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
     $this->P->cb_pagetype = 'content';
     $this->P->cb_subnav = 'admin';
     $this->P->oPayload->cl_html = 'The template cache has been cleared.';
     $adapter = new \League\Flysystem\Adapter\Local(PATH_CACHE);
     $filesystem = new \League\Flysystem\Filesystem($adapter);
     $filesystem->deleteDir(DIRNAME_TEMPLATECACHE);
     $filesystem->createDir(DIRNAME_TEMPLATECACHE);
 }
Esempio n. 2
0
 /**
  * due to Doctrine cache deleteAll() cannot really delete file/folder for FilesystemCache, it just left old cache file and create new cache folder.<br>
  * this method is for really delete all cache and all file (in specified sub folder if it was set).
  * 
  * @return boolean
  */
 public function deleteAllFile()
 {
     $result = $this->deleteAll();
     if (isset($this->cache_config['driver']) && $this->cache_config['driver'] == 'Filesystem' && isset($this->cache_config['cache_path'])) {
         $adapter = new \League\Flysystem\Adapter\Local($this->cache_config['cache_path']);
         $Filesystem = new \League\Flysystem\Filesystem($adapter);
         $Filesystem->addPlugin(new \League\Flysystem\Plugin\ListPaths());
         if ($this->cache_config['cache_path'] . $this->subFolder == STORAGE_PATH . DS . 'cms' . DS . 'cache') {
             // sub folder may not set and cache path is match main cache folder.
             $files = $Filesystem->listPaths($this->subFolder);
             if (is_array($files)) {
                 foreach ($files as $file) {
                     if ($file != '.gitignore' && is_dir($this->cache_config['cache_path'] . $this->subFolder . '/' . $file)) {
                         $Filesystem->deleteDir($file);
                     } elseif ($file != '.gitignore' && is_file($this->cache_config['cache_path'] . $this->subFolder . '/' . $file)) {
                         $Filesystem->delete($file);
                     }
                 }
                 unset($file);
             }
             unset($files);
         } else {
             // sub folder is set.
             $files = $Filesystem->listPaths('');
             if (is_array($files)) {
                 foreach ($files as $file) {
                     if (is_dir($this->cache_config['cache_path'] . '/' . $file)) {
                         $Filesystem->deleteDir($file);
                     } elseif (is_file($this->cache_config['cache_path'] . '/' . $file)) {
                         $Filesystem->delete($file);
                     }
                 }
                 unset($file);
             }
             unset($files);
         }
     }
     return $result;
 }
Esempio n. 3
0
 /**
  * Remove a directory even if it's not empty.
  *
  * @param string $dir
  * @deprecated Use Flysystem instead.
  */
 public static function rrmdir($dir)
 {
     $adapter = new Local(dirname($dir));
     $filesystem = new \League\Flysystem\Filesystem($adapter);
     $filesystem->deleteDir(basename($dir));
 }