getCurrentTimestamp example



        $compiler = $this->container->get('theme_compiler');

        foreach ($shopsWithThemes as $shop) {
            if (!$current) {
                $output->writeln(sprintf('Generating new theme cache for shop "%s" ...', $shop->getName()));
                $compiler->compile($shop);
                continue;
            }

            $timestamp = $this->container->get('theme_timestamp_persistor')->getCurrentTimestamp($shop->getId());
            $output->writeln(sprintf('Generating theme cache for shop "%s" from current timestamp %s', $shop->getName()$timestamp));
            $compiler->recompile($shop);
        }

        if ($current) {
            return 0;
        }

        $cacheManager = $this->container->get(CacheManager::class);
        $output->writeln('Clearing HTTP cache ...');
        $cacheManager->clearHttpCache();

        

        rename($this->pathResolver->getTmpJsFilePath($shop$timestamp)$this->pathResolver->getJsFilePath($shop$timestamp));
    }

    /** * Helper function which reads and creates the theme timestamp for the css and js files. * * @return string */
    public function getThemeTimestamp(Shop $shop)
    {
        return $this->timestampPersistor->getCurrentTimestamp($shop->getId());
    }

    /** * @param int $timestamp * * @return void */
    public function createThemeTimestamp(Shop $shop$timestamp)
    {
        $this->timestampPersistor->updateTimestamp($shop->getId()$timestamp);
    }

    

        $path = $input->getArgument('path');
        $filename = basename((string) $path);
        $className = pathinfo($filename, \PATHINFO_FILENAME);

        $output->writeln('Updating timestamp of migration: ' . $filename);

        if (!file_exists($path)) {
            throw new \RuntimeException('The provided migration file does not exist.');
        }

        $timestamp = $this->getCurrentTimestamp($filename);
        $newTimestamp = (string) time();

        $newPath = str_replace($timestamp$newTimestamp(string) $path);

        $search = [
            pathinfo($filename, \PATHINFO_FILENAME),
            'return ' . $timestamp . ';',
        ];

        $replace = [
            str_replace($timestamp$newTimestamp$className),
            


/** * Returns the current time measured in the number of seconds * since the Unix Epoch (January 1 1970 00:00:00 GMT). */
function smarty_function_themeTimestamp($params$template)
{
    $context = Shopware()->Container()->get(\Shopware\Bundle\StoreFrontBundle\Service\ContextServiceInterface::class)->getShopContext();
    $shopId = $context->getShop()->getParentId();

    return Shopware()->Container()->get('theme_timestamp_persistor')->getCurrentTimestamp($shopId);
}
Home | Imprint | This part of the site doesn't use cookies.