/** * */ protected function execute() { $input = CampRequest::GetInput('post'); $session = CampSession::singleton(); $this->m_step = (!empty($input['step'])) ? $input['step'] : $this->m_defaultStep; switch($this->m_step) { case 'precheck': break; case 'license': $session->unsetData('config.db', 'installation'); $session->unsetData('config.site', 'installation'); $session->unsetData('config.demo', 'installation'); $this->preInstallationCheck(); break; case 'database': $this->license(); break; case 'mainconfig': $prevStep = (isset($input['this_step'])) ? $input['this_step'] : ''; if ($prevStep != 'loaddemo' && $this->databaseConfiguration($input)) { $session->setData('config.db', $this->m_config['database'], 'installation', true); } break; case 'loaddemo': $prevStep = (isset($input['this_step'])) ? $input['this_step'] : ''; if ($prevStep != 'loaddemo' && $this->generalConfiguration($input)) { $session->setData('config.site', $this->m_config['mainconfig'], 'installation', true); } break; case 'cronjobs': if (isset($input['install_demo'])) { $session->setData('config.demo', array('loaddemo' => $input['install_demo']), 'installation', true); if ($input['install_demo'] != '0') { if (!$this->loadDemoSite()) { break; } } } break; case 'finish': if (isset($input['install_demo'])) { $session->setData('config.demo', array('loaddemo' => $input['install_demo']), 'installation', true); if ($input['install_demo'] != '0') { if (!$this->loadDemoSite()) { break; } } } $this->saveCronJobsScripts(); if ($this->finish()) { $this->saveConfiguration(); self::InstallPlugins(); require_once($GLOBALS['g_campsiteDir'].'/classes/SystemPref.php'); SystemPref::DeleteSystemPrefsFromCache(); // clear all cache require_once($GLOBALS['g_campsiteDir'].'/classes/CampCache.php'); CampCache::singleton()->clear('user'); CampCache::singleton()->clear(); CampTemplate::singleton()->clearCache(); } break; } } // fn execute
$campsite = new CampSite(); // loads site configuration settings $campsite->loadConfiguration(CS_PATH_CONFIG . DIR_SEP . 'configuration.php'); // starts the session $campsite->initSession(); $session = CampSite::GetSessionInstance(); $configDb = array('hostname' => $Campsite['db']['host'], 'hostport' => $Campsite['db']['port'], 'username' => $Campsite['db']['user'], 'userpass' => $Campsite['db']['pass'], 'database' => $Campsite['db']['name']); $session->setData('config.db', $configDb, 'installation'); // upgrading the database $res = camp_upgrade_database($Campsite['DATABASE_NAME'], true, true); if ($res !== 0) { display_upgrade_error("While upgrading the database: {$res}"); } CampCache::singleton()->clear('user'); CampCache::singleton()->clear(); SystemPref::DeleteSystemPrefsFromCache(); // replace $campsite by $gimme require_once $g_documentRoot . '/classes/TemplateConverterNewscoop.php'; $template_files = camp_read_files($g_documentRoot . '/templates'); $converter = new TemplateConverterNewscoop(); if (!empty($template_files)) { foreach ($template_files as $template_file) { $converter->read($template_file); $converter->parse(); $converter->write(); } } // update plugins CampPlugin::OnUpgrade(); CampRequest::SetVar('step', 'finish'); $install = new CampInstallation();