Example #1
0
 /**
  * The main entry point method.
  * @return void
  * @throws \BuildException If there is something wrong.
  */
 public function main()
 {
     $config = new Configuration();
     $install = $this->getSWInstallApp();
     $project = $this->getProject();
     $install->setDatabase();
     $config->setDatabase($install->getDatabase());
     // fake server values used by shopware.
     $original = $_SERVER;
     $_SERVER['SCRIPT_NAME'] = str_replace(DIRECTORY_SEPARATOR, '/', rtrim($this->getBasePath() ?: '/', '/') . '/recovery/install/index.php');
     $configData = array('c_config_admin_email' => $this->getAdminEmail(), 'c_config_admin_language' => $this->getAdminLanguage(), 'c_config_admin_name' => $this->getAdminName(), 'c_config_admin_password' => $this->getAdminPassword(), 'c_config_admin_password2' => $this->getAdminPassword(), 'c_config_admin_user' => $this->getAdminUser(), 'c_config_mail' => $this->getConfigMail(), 'c_config_shop_currency' => (int) $this->getShopCurrency(), 'c_config_shop_host' => $_SERVER["HTTP_HOST"] = $this->getShopHost(), 'c_config_shop_language' => $this->getShopLanguage(), 'c_config_shopName' => $this->getShopName(), 'c_edition' => 'ce', 'c_license' => '');
     try {
         $this->log('Saving config data: ' . implode(',', array_keys($configData)));
         $config->createAdmin($configData);
         $config->updateConfig($configData);
         $config->updateShop($configData);
         $_SERVER = $original;
     } catch (\Exception $exception) {
         throw new \BuildException($exception->getMessage());
     }
     // catch
 }