/** * Gets the basic site parameters * * @return array */ protected function getSiteParamsVars() { $siteurl = str_replace('/installation/', '', AUri::root()); $homeurl = str_replace('/installation/', '', AUri::root()); $ret = array('blogname' => $this->getState('blogname', $this->configModel->get('blogname', 'Restored website')), 'blogdescription' => $this->getState('blogdescription', $this->configModel->get('blogdescription', 'Restored website')), 'dbcharset' => $this->getState('dbcharset', $this->configModel->get('dbcharset', 'utf_8')), 'dbcollation' => $this->getState('dbcollation', $this->configModel->get('dbcollation', '')), 'homeurl' => $this->getState('homeurl', $homeurl), 'siteurl' => $this->getState('siteurl', $siteurl)); require_once APATH_INSTALLATION . '/angie/helpers/setup.php'; $ret['homeurl'] = AngieHelperSetup::cleanLiveSite($ret['homeurl']); $ret['siteurl'] = AngieHelperSetup::cleanLiveSite($ret['siteurl']); $this->configModel->set('siteurl', $ret['siteurl']); $this->configModel->set('homeurl', $ret['homeurl']); // Special handling: if we were told to downgrade data from utf8mb4 to utf8 and the dbcharset or dbcollation // contains utf8mb4 we have to downgrade that too to utf8. /** @var AngieModelDatabase $dbModel */ $dbModel = AModel::getTmpInstance('Database', 'AngieModel'); $allDbIni = $dbModel->getDatabasesIni(); $dbNames = $dbModel->getDatabaseNames(); $firstDb = array_shift($dbNames); $dbIni = $allDbIni[$firstDb]; $dbOptions = array('driver' => $dbIni['dbtype'], 'database' => $dbIni['dbname'], 'select' => 0, 'host' => $dbIni['dbhost'], 'user' => $dbIni['dbuser'], 'password' => $dbIni['dbpass'], 'prefix' => $dbIni['prefix']); $db = ADatabaseDriver::getInstance($dbOptions); $downgradeUtf8 = $dbIni['utf8tables'] && (!$dbIni['utf8mb4'] || $dbIni['utf8mb4'] && !$db->supportsUtf8mb4()); if ($downgradeUtf8) { $ret['dbcharset'] = str_replace('utf8mb4', 'utf8', $ret['dbcharset']); $ret['dbcollation'] = str_replace('utf8mb4', 'utf8', $ret['dbcollation']); $this->configModel->set('dbcharset', $ret['dbcharset']); $this->configModel->set('dbcollation', $ret['dbcollation']); } return $ret; }
/** * Gets the basic site parameters * * @return array */ protected function getSiteParamsVars() { $siteurl = str_replace('/installation/', '', AUri::root()); $ret = array('sitename' => $this->getState('sitename', $this->configModel->get('sitename', 'Restored website')), 'siteurl' => $this->getState('siteurl', $siteurl)); require_once APATH_INSTALLATION . '/angie/helpers/setup.php'; $ret['siteurl'] = AngieHelperSetup::cleanLiveSite($ret['siteurl']); $this->configModel->set('siteurl', $ret['siteurl']); return $ret; }
/** * Gets the basic site parameters * * @return array */ protected function getSiteParamsVars() { $ret = array('adminurl' => $this->getState('adminurl', $this->configModel->get('adminurl', 'Restored website')), 'livesite' => $this->getState('livesite', $this->configModel->get('livesite', ''))); // Double check we have a valid livesite URL if ($ret['livesite']) { require_once APATH_INSTALLATION . '/angie/helpers/setup.php'; $ret['livesite'] = AngieHelperSetup::cleanLiveSite($ret['livesite']); } return $ret; }
/** * Gets the basic site parameters * * @return array */ protected function getSiteParamsVars() { $defaultTmpPath = APATH_ROOT . '/tmp'; $defaultLogPath = APATH_ROOT . '/log'; $ret = array('siteemail' => $this->getState('siteemail', $this->configModel->get('mailfrom', '*****@*****.**')), 'emailsender' => $this->getState('emailsender', $this->configModel->get('fromname', 'Restored website')), 'livesite' => $this->getState('livesite', ''), 'logspath' => $this->getState('logspath', $this->configModel->get('log_path', $defaultLogPath)), 'default_tmp' => $defaultTmpPath, 'default_log' => $defaultLogPath, 'site_root_dir' => APATH_ROOT); // Let's cleanup the live site url require_once APATH_INSTALLATION . '/angie/helpers/setup.php'; $ret['livesite'] = AngieHelperSetup::cleanLiveSite($ret['livesite']); // I can't check if the logspath is writable since it will use some tokens inside it return $ret; }
/** * Gets the basic site parameters * * @return array */ protected function getSiteParamsVars() { // Do I have a www_root coming from UNiTE? If so, use it $wwwroot = $this->input->get('livesite', AUri::root()); $wwwroot = str_replace('/installation/', '', $wwwroot); // Create the host from the wwwroot - This regex is not optimal, but let's use the same used by Moodle preg_match('|^[a-z]+://([a-zA-Z0-9-.]+)|i', $wwwroot, $matches); $wwwhost = $matches[1]; $ret = array('fullname' => $this->getState('fullname', $this->configModel->get('fullname', 'Restored Moodle')), 'shortname' => $this->getState('shortname', $this->configModel->get('shortname', 'Moodle')), 'wwwroot' => $this->getState('wwwroot', $wwwroot), 'dataroot' => $this->getState('dataroot', $this->configModel->get('dataroot', '')), 'chat_host' => $this->getState('chat_host', $this->configModel->get('chat_host', $wwwhost)), 'chat_ip' => $this->getState('chat_ip', $this->configModel->get('chat_ip', isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : ''))); require_once APATH_INSTALLATION . '/angie/helpers/setup.php'; $ret['wwwroot'] = AngieHelperSetup::cleanLiveSite($ret['wwwroot']); $this->configModel->set('wwwroot', $ret['wwwroot']); return $ret; }
/** * Gets the basic site parameters * * @return array */ protected function getSiteParamsVars() { $key = $this->input->getCmd('substep', 'default'); $fieldKey = str_replace('.', '_', $key); $defaultTmpPath = APATH_ROOT . '/tmp'; $defaultLogPath = APATH_ROOT . '/log'; $ret = array('sitename' => $this->getState($fieldKey . '_sitename', $this->configModel->get('sitename', 'Restored website', $key)), 'siteemail' => $this->getState($fieldKey . '_siteemail', $this->configModel->get('site_mail', '*****@*****.**', $key)), 'cookiedomain' => $this->getState($fieldKey . '_cookiedomain', $this->configModel->get('cookie_domain', '', $key)), 'livesite' => $this->getState($fieldKey . '_livesite', $this->configModel->get('live_site', '', $key)), 'tmppath' => $this->getState($fieldKey . '_tmppath', $this->configModel->get('tmp_path', $defaultTmpPath, $key)), 'default_tmp' => $defaultTmpPath, 'default_log' => $defaultLogPath, 'site_root_dir' => APATH_ROOT); // Let's cleanup the live site url require_once APATH_INSTALLATION . '/angie/helpers/setup.php'; $ret['livesite'] = AngieHelperSetup::cleanLiveSite($ret['livesite']); // Deal with tmp and logs path if (!@is_dir($ret['tmppath'])) { $ret['tmppath'] = $defaultTmpPath; } elseif (!@is_writable($ret['tmppath'])) { $ret['tmppath'] = $defaultTmpPath; } return $ret; }
/** * Gets the basic site parameters * * @return array */ protected function getSiteParamsVars() { $db = $this->getDatabase(); $query = $db->getQuery(true)->select($db->qn('config_value'))->from($db->qn('#__config'))->where($db->qn('config_name') . ' = ' . $db->q('sitename')); try { $sitename = $db->setQuery($query)->loadResult(); } catch (Exception $e) { $sitename = 'Restored website'; } $query = $db->getQuery(true)->select($db->qn('config_value'))->from($db->qn('#__config'))->where($db->qn('config_name') . ' = ' . $db->q('site_desc')); try { $sitedescr = $db->setQuery($query)->loadResult(); } catch (Exception $e) { $sitedescr = 'Restored website description'; } $siteurl = str_replace('/installation/', '', AUri::root()); $ret = array('sitename' => $this->getState('sitename', $sitename), 'sitedescr' => $this->getState('sitedescr', $sitedescr), 'siteurl' => $this->getState('siteurl', $siteurl)); require_once APATH_INSTALLATION . '/angie/helpers/setup.php'; $ret['siteurl'] = AngieHelperSetup::cleanLiveSite($ret['siteurl']); return $ret; }
/** * Gets the basic site parameters * * @return array */ protected function getSiteParamsVars() { $jVersion = $this->container->session->get('jversion', '3.6.0'); // Default tmp directory: tmp in the root of the site $defaultTmpPath = APATH_ROOT . '/tmp'; // Default logs directory: logs in the administrator directory of the site $defaultLogPath = APATH_ADMINISTRATOR . '/logs'; // If it's a Joomla! 1.x, 2.x or 3.0 to 3.5 site (inclusive) the default log dir is in the site's root if (!empty($jVersion) && version_compare($jVersion, '3.5.999', 'le')) { // I use log instead of logs because "logs" isn't writeable on many hosts. $defaultLogPath = APATH_ROOT . '/log'; } $defaultSSL = 2; if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') { $defaultSSL = 0; } $ret = array('sitename' => $this->getState('sitename', $this->configModel->get('sitename', 'Restored website')), 'siteemail' => $this->getState('siteemail', $this->configModel->get('mailfrom', '*****@*****.**')), 'emailsender' => $this->getState('emailsender', $this->configModel->get('fromname', 'Restored website')), 'livesite' => $this->getState('livesite', $this->configModel->get('live_site', '')), 'cookiedomain' => $this->getState('cookiedomain', $this->configModel->get('cookie_domain', '')), 'cookiepath' => $this->getState('cookiepath', $this->configModel->get('cookie_path', '')), 'tmppath' => $this->getState('tmppath', $this->configModel->get('tmp_path', $defaultTmpPath)), 'logspath' => $this->getState('logspath', $this->configModel->get('log_path', $defaultLogPath)), 'force_ssl' => $this->getState('force_ssl', $this->configModel->get('force_ssl', $defaultSSL)), 'default_tmp' => $defaultTmpPath, 'default_log' => $defaultLogPath, 'site_root_dir' => APATH_ROOT); // Let's cleanup the live site url require_once APATH_INSTALLATION . '/angie/helpers/setup.php'; $ret['livesite'] = AngieHelperSetup::cleanLiveSite($ret['livesite']); if (version_compare($this->container->session->get('jversion'), '3.2', 'ge')) { $ret['mailonline'] = $this->getState('mailonline', $this->configModel->get('mailonline', '1')); } // Deal with tmp and logs path if (!@is_dir($ret['tmppath'])) { $ret['tmppath'] = $defaultTmpPath; } elseif (!@is_writable($ret['tmppath'])) { $ret['tmppath'] = $defaultTmpPath; } if (!@is_dir($ret['logspath'])) { $ret['logspath'] = $defaultLogPath; } elseif (!@is_writable($ret['logspath'])) { $ret['logspath'] = $defaultLogPath; } return $ret; }