updateScripts example

public function refresh(): void
    {
        $criteria = new Criteria();
        $criteria->setTitle('app-scripts::refresh');
        $criteria->addFilter(new EqualsFilter('active', true));

        $apps = $this->appRepository->search($criteria, Context::createDefaultContext())->getEntities();

        /** @var AppEntity $app */
        foreach ($apps as $app) {
            $this->updateScripts($app->getId(), Context::createDefaultContext());
        }
    }

    private function deleteOldScripts(ScriptCollection $toBeRemoved, Context $context): void
    {
        /** @var array<string> $ids */
        $ids = $toBeRemoved->getIds();

        if (!empty($ids)) {
            $ids = array_map(static fn (string $id): array => ['id' => $id]array_values($ids));

            
        // therefore we only install webhooks, modules, tax providers and payment methods if we have a secret         if ($app->getAppSecret()) {
            $this->paymentMethodPersister->updatePaymentMethods($manifest$id$defaultLocale$context);
            $this->taxProviderPersister->updateTaxProviders($manifest$id$defaultLocale$context);

            $this->updateModules($manifest$id$defaultLocale$context);
        }

        $this->ruleConditionPersister->updateConditions($manifest$id$defaultLocale$context);
        $this->actionButtonPersister->updateActions($manifest$id$defaultLocale$context);
        $this->templatePersister->updateTemplates($manifest$id$context);
        $this->scriptPersister->updateScripts($id$context);
        $this->customFieldPersister->updateCustomFields($manifest$id$context);
        $this->assetService->copyAssetsFromApp($app->getName()$app->getPath());

        $cmsExtensions = $this->appLoader->getCmsExtensions($app);
        if ($cmsExtensions) {
            $this->cmsBlockPersister->updateCmsBlocks($cmsExtensions$id$defaultLocale$context);
        }

        $updatePayload = [
            'id' => $app->getId(),
            'configurable' => $this->handleConfigUpdates($app$manifest$install$context),
            
Home | Imprint | This part of the site doesn't use cookies.