/** * Installation Step 6: Configure first web-site */ public function firstWebsiteSetup() { $this->checkPiwikIsNotInstalled(); ServerFilesGenerator::createFilesForSecurity(); $siteIdsCount = Access::doAsSuperUser(function () { return count(APISitesManager::getInstance()->getAllSitesId()); }); if ($siteIdsCount > 0) { // if there is a already a website, skip this step and trackingCode step $this->redirectToNextStep('trackingCode'); } $view = new View('@Installation/firstWebsiteSetup', $this->getInstallationSteps(), __FUNCTION__); $form = new FormFirstWebsiteSetup(); if ($form->validate()) { $name = Common::sanitizeInputValue($form->getSubmitValue('siteName')); $url = Common::unsanitizeInputValue($form->getSubmitValue('url')); $ecommerce = (int) $form->getSubmitValue('ecommerce'); try { $result = Access::doAsSuperUser(function () use($name, $url, $ecommerce) { return APISitesManager::getInstance()->addSite($name, $url, $ecommerce); }); $params = array('site_idSite' => $result, 'site_name' => urlencode($name)); $this->addTrustedHosts($url); $this->redirectToNextStep(__FUNCTION__, $params); } catch (Exception $e) { $view->errorMessage = $e->getMessage(); } } // Display previous step success message, when current step form was not submitted yet if (count($form->getErrorMessages()) == 0) { $view->displayGeneralSetupSuccess = true; } $view->addForm($form); return $view->render(); }
public function doUpdate(Updater $updater) { $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); $updater->executeMigrations(__FILE__, $this->getUserPasswordMigrations([])); ServerFilesGenerator::createFilesForSecurity(); }
public function doUpdate(Updater $updater) { ServerFilesGenerator::createFilesForSecurity(); }