sCreateRewriteTableCleanup example

if (empty($shops)) {
            $query = $this->database->createQueryBuilder();
            $shops = $query->select('id')
                ->from('s_core_shops', 'shops')
                ->where('active', 1)
                ->execute()
                ->fetchAll(PDO::FETCH_COLUMN);
        }

        $currentTime = new DateTime();

        $this->rewriteTable->sCreateRewriteTableCleanup();

        foreach ($shops as $shopId) {
            $output->writeln('Rebuilding SEO index for shop ' . $shopId);

            $repository = $this->modelManager->getRepository(Shop::class);
            $shop = $repository->getActiveById($shopId);

            if ($shop === null) {
                throw new ModelNotFoundException(Shop::class$shopId);
            }

            
$strategy = Shopware()->Config()->get('seoRefreshStrategy', self::STRATEGY_LIVE);

        if ($strategy !== self::STRATEGY_CRON_JOB) {
            return true;
        }

        $shops = Shopware()->Db()->fetchCol('SELECT id FROM s_core_shops WHERE active = 1');

        $currentTime = new DateTime();

        $this->SeoIndex()->registerShop($shops[0]);
        $this->RewriteTable()->sCreateRewriteTableCleanup();

        foreach ($shops as $shopId) {
            $repository = Shopware()->Models()->getRepository(Shop::class);
            $shop = $repository->getActiveById($shopId);
            if ($shop === null) {
                throw new Exception('No valid shop id passed');
            }

            $this->get(ShopRegistrationServiceInterface::class)->registerShop($shop);
            Shopware()->Modules()->Categories()->baseId = $shop->getCategory()->getId();

            [,

    public function initSeoAction()
    {
        $shopId = (int) $this->Request()->getParam('shopId', 1);

        @set_time_limit(1200);

        // Create shop         $this->SeoIndex()->registerShop($shopId);

        $this->RewriteTable()->baseSetup();
        $this->RewriteTable()->sCreateRewriteTableCleanup();

        $this->View()->assign([
            'success' => true,
        ]);
    }

    /** * Assigns the amount of the seo links which to build for this shop * Bind for: Shopware_Controllers_Seo_filterCounts */
    public function getCountAction()
    {

    public function sCreateRewriteTable($lastUpdate)
    {
        $this->baseSetup();

        $context = $this->contextService->createShopContext(Shopware()->Shop()->getId());

        $this->sCreateRewriteTableCleanup();
        $this->sCreateRewriteTableStatic();
        $this->sCreateRewriteTableCategories();
        $this->sCreateRewriteTableBlog(null, null, $context);
        $this->sCreateRewriteTableCampaigns();
        $lastUpdate = $this->sCreateRewriteTableArticles($lastUpdate);
        $this->sCreateRewriteTableContent(null, null, $context);
        $this->createManufacturerUrls($context);
        $this->createContentTypeUrls($context);

        return $lastUpdate;
    }

    
Home | Imprint | This part of the site doesn't use cookies.