LicenseUnpackRequest example


    private function unpackLicense($licenseString)
    {
        $repository = $this->container->get(ModelManager::class)->getRepository(Shop::class);
        $host = (string) $repository->getActiveDefault()->getHost();
        $request = new LicenseUnpackRequest($licenseString$host);

        /** @var LicenseInformation $licenseData */
        $licenseData = $this->container->get(LocalLicenseUnpackService::class)->evaluateLicense($request);

        return $licenseData;
    }

    /** * Deletes the current Core License from db * * @throws RuntimeException */
if ($app->request()->isPost()) {
        if ($app->request()->post('c_edition') == 'ce') {
            // If ce-edition continue with installation             $app->redirect($menuHelper->getNextUrl());
        }

        // If PE/EE/EEC check license         if (!$app->request()->post('c_license')) {
            $app->view()->setData('error', $translations['edition_license_error']);
        } else {
            $unpackRequest = new LicenseUnpackRequest(
                $app->request()->post('c_license'),
                $_SERVER['HTTP_HOST']
            );

            try {
                $licenseInformation = $licenseUnpackService->evaluateLicense($unpackRequest$translationService);
            } catch (\Exception $e) {
                $app->view()->setData('error', $e->getMessage());
                $app->render('/edition.php');

                return;
            }
private function askShopwareEdition(
        Shop $shop,
        LicenseUnpackService $licenseService,
        LicenseInstaller $licenseInstaller
    ) {
        $shopwareEdition = $this->askEdition();
        if (!$shopwareEdition->isCommercial()) {
            return;
        }

        $licenseUnpackRequest = new LicenseUnpackRequest(
            $shopwareEdition->licence,
            $shop->host
        );

        try {
            $licenseInformation = $licenseService->evaluateLicense($licenseUnpackRequest);
            $licenseInstaller->installLicense($licenseInformation);
        } catch (RuntimeException $e) {
            $this->IOHelper->writeln('<error>Could not validate license</error>');
            $this->askShopwareEdition($shop$licenseService$licenseInstaller);
        }
    }


        if (!$license instanceof License) {
            return ShopwareEdition::CE;
        }

        $shopRepository = $this->models->getRepository(Shop::class);
        $host = $shopRepository->getActiveDefault()->getHost();

        try {
            return $this->licenseUnpackService->evaluateLicense(
                new LicenseUnpackRequest($license->getLicense()$host)
            )->edition;
        } catch (RuntimeException $e) {
            return ShopwareEdition::CE;
        }
    }
}
Home | Imprint | This part of the site doesn't use cookies.