Example #1
0
 $menuHelper->setCurrent('configuration');
 try {
     $db = $container->offsetGet('db');
 } catch (\Exception $e) {
     $menuHelper->setCurrent('database-configuration');
     $app->render('database-configuration.php', ["error" => "Please fill in all fields"]);
     return;
 }
 if ($app->request()->isPost()) {
     $adminUser = new \Shopware\Recovery\Install\Struct\AdminUser(['email' => $_SESSION["parameters"]['c_config_admin_email'], 'username' => $_SESSION["parameters"]['c_config_admin_username'], 'locale' => $_SESSION["parameters"]['c_config_admin_language'], 'name' => $_SESSION["parameters"]['c_config_admin_name'], 'password' => $_SESSION["parameters"]['c_config_admin_password']]);
     $shop = new \Shopware\Recovery\Install\Struct\Shop(['name' => $_SESSION["parameters"]['c_config_shopName'], 'locale' => $_SESSION["parameters"]['c_config_shop_language'], 'currency' => $_SESSION["parameters"]['c_config_shop_currency'], 'email' => $_SESSION["parameters"]['c_config_mail'], 'host' => $_SERVER["HTTP_HOST"], 'basePath' => str_replace("/recovery/install/index.php", "", $_SERVER["SCRIPT_NAME"])]);
     $locale = $_SESSION["parameters"]['c_config_shop_language'] ?: 'de_DE';
     $shopService = new ShopService($db);
     $currencyService = new CurrencyService($db);
     $adminService = new AdminService($db);
     $localeSettingsService = new LocaleSettingsService($db, $container);
     $hasErrors = false;
     try {
         $adminService->createAdmin($adminUser);
         $adminService->addWidgets($adminUser);
         $shopService->updateShop($shop);
         $currencyService->updateCurrency($shop);
         $shopService->updateConfig($shop);
         $localeSettingsService->updateLocaleSettings($locale);
     } catch (\Exception $e) {
         $hasErrors = true;
         $app->view()->setData("error", $e->getMessage());
     }
     if (!$hasErrors) {
         $app->redirect($app->urlFor('finalize'));
     }
Example #2
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->IOHelper = $ioService = new IOHelper($input, $output, $this->getHelper('question'));
     /** @var $container Container */
     $container = $this->container = $this->getApplication()->getContainer();
     if (!$ioService->isInteractive()) {
         $ioService->writeln("<error>Non interactive installation is not supported.</error>");
         return 1;
     }
     $this->printStartMessage($ioService);
     if ($this->isConfigured()) {
         $connectionInfo = $this->createConnectionInfoFromConfig(SW_PATH . '/config.php');
         $connectionInfo = $this->interactDatabaseConfig($ioService, $connectionInfo);
     } else {
         $connectionInfo = $this->interactDatabaseConfig($ioService);
     }
     $conn = $this->initDatabaseConnection($connectionInfo, $container);
     $databaseService = new DatabaseService($conn);
     $skipImport = $databaseService->containsShopwareSchema() && $this->shouldSkipImport();
     if (!$skipImport) {
         $this->importDatabase();
         $this->importSnippets();
     }
     $locales = ['de_DE', 'en_GB'];
     $shop = $this->askForShopInformation($locales);
     $currencies = ['EUR', 'USD', 'GBP'];
     $currency = $this->askForCurrencyInformation($currencies);
     $shop->currency = $currency;
     if (!$this->webserverCheck($ioService, $container, $shop)) {
         $ioService->writeln("Could not verify");
         if (!$this->IOHelper->askConfirmation("Continue?")) {
             return 1;
         }
     }
     $adminUser = $this->askAdminInformation($locales);
     $shopService = new ShopService($conn);
     $shopService->updateShop($shop);
     $shopService->updateConfig($shop);
     $currencyService = new CurrencyService($conn);
     $currencyService->updateCurrency($shop);
     $currencyService = new LocaleSettingsService($conn, $container);
     $currencyService->updateLocaleSettings($shop->locale);
     $adminService = new AdminService($conn);
     $adminService->createAdmin($adminUser);
     $adminService->addWidgets($adminUser);
     $this->activateResponsiveTheme();
     $this->IOHelper->cls();
     $this->IOHelper->writeln("<info>=== License Information ===</info>");
     /** @var $licenseService LicenseUnpackService */
     $licenseService = $container->offsetGet('license.service');
     /** @var $licenseInstaller LicenseInstaller */
     $licenseInstaller = $container->offsetGet('license.installer');
     $this->askShopwareEdition($shop, $licenseService, $licenseInstaller);
     /** @var \Shopware\Recovery\Common\SystemLocker $systemLocker */
     $systemLocker = $this->container->offsetGet('system.locker');
     $systemLocker();
     $ioService->writeln("<info>Shop successfully installed.</info>");
 }