getCacheDirectory example

return 0;
    }

    /** * @throws Exception * * @return string */
    private function dumpConfiguration(Shop $shop, Configuration $configuration)
    {
        $pathResolver = $this->container->get(\Shopware\Components\Theme\PathResolver::class);
        $file = $pathResolver->getCacheDirectory() . '/config_' . $shop->getId() . '.json';

        file_put_contents($filejson_encode($configuration, JSON_PRETTY_PRINT));

        return $file;
    }
}
if ($cacheDir !== $compileDir) {
            $this->clearDirectory($cacheDir);
        }
    }

    /** * Clear theme cache */
    public function clearThemeCache()
    {
        $this->clearDirectory($this->themePathResolver->getCacheDirectory());
    }

    /** * Clear rewrite cache */
    public function clearRewriteCache()
    {
        $cache = (int) $this->config->offsetGet('routerCache');
        $cache = $cache < 360 ? 86400 : $cache;

        $builder = $this->db->createQueryBuilder();
        

        return str_replace([rtrim($this->rootDir, '/\\'), '\\', '//'][$shop->getBasePath(), '/', '/']$path);
    }

    /** * Returns the directory path to the compiler source map. * * @return string */
    public function getSourceMapPath()
    {
        return $this->getCacheDirectory() . DIRECTORY_SEPARATOR . 'css.source.map';
    }

    /** * Returns the shop url to the generated compiler source map. * * @return string */
    public function getSourceMapUrl(Shop\Shop $shop)
    {
        return $this->formatPathToUrl($this->getSourceMapPath()$shop);
    }

    
        $path = str_replace([$this->rootDir, '//']['', '/']$path);

        return '../../' . ltrim($path, '/');
    }

    /** * Helper function to clear the theme cache directory * before the new css and js files are compiled. */
    private function clearDirectory(array $names = []): void
    {
        $dir = $this->pathResolver->getCacheDirectory();

        if (!file_exists($dir)) {
            return;
        }

        $iterator = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator(
                $dir,
                RecursiveDirectoryIterator::SKIP_DOTS
            ),
            RecursiveIteratorIterator::CHILD_FIRST
        );
Home | Imprint | This part of the site doesn't use cookies.