Esempio n. 1
0
 /**
  * Executes the current command.
  *
  * @param InputInterface $input An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!isset($this->oxidVersions[$input->getOption('oxidVersion')])) {
         $output->writeln("<error>Oxid {$input->getOption('oxidVersion')} not available</error>");
         return;
     }
     $output->writeln("<info>Downloading oxid {$input->getOption('oxidVersion')}</info>");
     $oxidVersion = $this->oxidVersions[$input->getOption('oxidVersion')];
     $archiveFile = $this->downloadOxid($output, $oxidVersion);
     $target = $input->getOption('installationFolder');
     if (!is_dir($target)) {
         mkdir($target, 0755, true);
     }
     $target = realpath($input->getOption('installationFolder'));
     $output->writeLn("<info>Extracting archive</info>");
     $this->extractArchive($output, $archiveFile, $target, $oxidVersion);
     $output->writeLn("<info>Patching installation</info>");
     $this->patchOxSetup($target);
     $output->writeLn("<info>Installing shop</info>");
     include_once $target . '/setup/oxrunsetup.php';
     // Fake request params...
     $_GET['ow'] = true;
     $_POST = array("aDB" => array('dbHost' => $input->getOption('dbHost'), 'dbName' => $input->getOption('dbName'), 'dbUser' => $input->getOption('dbUser'), 'dbPwd' => $input->getOption('dbPwd'), 'dbiDemoData' => $input->getOption('installSampleData'), 'iUtfMode' => 1), "aPath" => array('sShopURL' => $input->getOption('shopURL'), 'sShopDir' => $target, 'sCompileDir' => $target . '/tmp', 'sBaseUrlPath' => '/'), "aSetupConfig" => array('blDelSetupDir' => 1), "aAdminData" => array('sLoginName' => $input->getOption('adminUser'), 'sPassword' => $input->getOption('adminPassword'), 'sPasswordConfirm' => $input->getOption('adminPassword')));
     $oxSetupSession = new \oxSetupSession();
     $oxSetupSession->setSessionParam('aDB', $_POST["aDB"]);
     $oxSetupSession->setSessionParam('setup_lang', 'en');
     $oxSetupSession->setSessionParam('sShopLang', 'de');
     $oxSetupSession->setSessionParam('aSetupConfig', $_POST["aSetupConfig"]);
     $oxSetupController = new \oxSetupController();
     $oxSetupController->dbConnect();
     $oxSetupController->dbCreate();
     $oxSetupController->dirsWrite();
     $aMessages = $oxSetupController->getView()->getMessages();
     foreach ($aMessages as $message) {
         $cleanMessage = str_replace(array('ERROR:', 'FEHLER:'), '', $message);
         if ($cleanMessage !== $message) {
             $cleanMessage = trim($cleanMessage);
             $output->writeln("<error>An error occured during the installation: {$cleanMessage}</error>");
         }
     }
     $oxSetupController->finish();
     $oxSetupView = new \oxSetupView();
     $oxSetupView->isDeletedSetup();
     rmdir($target . '/setup/');
 }
Esempio n. 2
0
 /**
  * Adds config value if shop info should be set.
  *
  * @param oxSetupUtils   $oUtils      Setup utilities
  * @param string         $sBaseShopId Shop id
  * @param array          $aParams     Parameters
  * @param Conf           $oConfk      Config key loader
  * @param oxSetupSession $oSession    Setup session manager
  */
 private function _addConfigValueIfShopInfoShouldBeSent($oUtils, $sBaseShopId, $aParams, $oConfk, $oSession)
 {
     $blSendShopDataToOxid = isset($aParams["blSendShopDataToOxid"]) ? $aParams["blSendShopDataToOxid"] : $oSession->getSessionParam('blSendShopDataToOxid');
     $sID = $oUtils->generateUid();
     $this->execSql("insert into oxconfig (oxid, oxshopid, oxvarname, oxvartype, oxvarvalue)\n                             values('{$sID}', '{$sBaseShopId}', 'blSendShopDataToOxid', 'bool', ENCODE( '{$blSendShopDataToOxid}', '" . $oConfk->sConfigKey . "'))");
 }