Sulu\Bundle\MediaBundle\Media\FormatCache\LocalFormatCache::clear PHP Method

clear() public method

public clear ( )
    public function clear()
    {
        $realCacheDir = $this->path;
        $oldCacheDir = $realCacheDir . '_old';
        if (!is_writable($realCacheDir)) {
            throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $realCacheDir));
        }
        if ($this->filesystem->exists($oldCacheDir)) {
            $this->filesystem->remove($oldCacheDir);
        }
        $this->filesystem->rename($realCacheDir, $oldCacheDir);
        $this->filesystem->mkdir($realCacheDir);
        $this->filesystem->remove($oldCacheDir);
    }