Airship\Engine\Continuum\Installer::clearCache PHP Method

clearCache() public method

We just need to clear the template caches and the cabin data.
public clearCache ( ) : boolean
return boolean
    public function clearCache() : bool
    {
        \Airship\clear_cache();
        $dirs = ['csp_hash', 'csp_static', 'html_purifier', 'markdown', 'rst', 'static', 'twig'];
        foreach ($dirs as $dir) {
            if (!\is_dir(ROOT . '/tmp/cache/' . $dir)) {
                continue;
            }
            foreach (\Airship\list_all_files(ROOT . '/tmp/cache/' . $dir) as $file) {
                if ($file === ROOT . '/tmp/cache/' . $dir . '/.gitignore') {
                    continue;
                }
                \unlink($file);
            }
        }
        if (\file_exists(ROOT . '/tmp/cache/cabin_data.json')) {
            \unlink(ROOT . '/tmp/cache/cabin_data.json');
        }
        \clearstatcache();
        return true;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Clear the cache files related to Cabins.
  *
  * @return bool
  */
 public function clearCache() : bool
 {
     $name = $this->makeNamespace($this->supplier->getName(), $this->package);
     $toDelete = [\implode(DIRECTORY_SEPARATOR, [ROOT, 'tmp', 'cache', 'cargo-' . $name . '.cache.json']), \implode(DIRECTORY_SEPARATOR, [ROOT, 'tmp', 'cache', 'csp.' . $name . '.json']), \implode(DIRECTORY_SEPARATOR, [ROOT, 'tmp', 'cache', $name . '.motifs.json'])];
     foreach ($toDelete as $file) {
         if (\file_exists($file)) {
             \unlink($file);
         }
     }
     return parent::clearCache();
 }