private function finalizeParameters() { \ModUtil::initCoreVars(true); // initialize the modvars array (includes ZConfig (System) vars) // Set the System Identifier as a unique string. if (!\System::getVar('system_identifier')) { \System::setVar('system_identifier', str_replace('.', '', uniqid(rand(1000000000, 9999999999), true))); } // store the recent version in a config var for later usage. This enables us to determine the version we are upgrading from \System::setVar('Version_Num', \Zikula_Core::VERSION_NUM); \System::setVar('language_i18n', \ZLanguage::getLanguageCode()); // add new configuration parameters $params = $this->yamlManager->getParameters(); unset($params['username'], $params['password']); if (!isset($params['secret']) || $params['secret'] == 'ThisTokenIsNotSoSecretChangeIt') { $params['secret'] = \RandomUtil::getRandomString(50); } if (!isset($params['url_secret'])) { $params['url_secret'] = \RandomUtil::getRandomString(10); } // Configure the Request Context // see http://symfony.com/doc/current/cookbook/console/sending_emails.html#configuring-the-request-context-globally $params['router.request_context.host'] = isset($params['router.request_context.host']) ? $params['router.request_context.host'] : $this->container->get('request')->getHost(); $params['router.request_context.scheme'] = isset($params['router.request_context.scheme']) ? $params['router.request_context.scheme'] : 'http'; $params['router.request_context.base_url'] = isset($params['router.request_context.base_url']) ? $params['router.request_context.base_url'] : $this->container->get('request')->getBasePath(); $this->yamlManager->setParameters($params); return true; }
private function finalizeParameters() { \ModUtil::initCoreVars(true); // initialize the modvars array (includes ZConfig (System) vars) $params = $this->decodeParameters($this->yamlManager->getParameters()); \System::setVar('language_i18n', $params['locale']); // Set the System Identifier as a unique string. \System::setVar('system_identifier', str_replace('.', '', uniqid(rand(1000000000, 9999999999.0), true))); // add admin email as site email \System::setVar('adminmail', $params['email']); // regenerate the theme list \Zikula\Module\ThemeModule\Util::regenerate(); // add remaining parameters and remove unneeded ones unset($params['username'], $params['password'], $params['email'], $params['dbtabletype']); $params['datadir'] = !empty($params['datadir']) ? $params['datadir'] : 'userdir'; $params['secret'] = \RandomUtil::getRandomString(50); $params['url_secret'] = \RandomUtil::getRandomString(10); // Configure the Request Context // see http://symfony.com/doc/current/cookbook/console/sending_emails.html#configuring-the-request-context-globally $params['router.request_context.host'] = isset($params['router.request_context.host']) ? $params['router.request_context.host'] : $this->container->get('request')->getHost(); $params['router.request_context.scheme'] = isset($params['router.request_context.scheme']) ? $params['router.request_context.scheme'] : 'http'; $params['router.request_context.base_url'] = isset($params['router.request_context.base_url']) ? $params['router.request_context.base_url'] : $this->container->get('request')->getBasePath(); $this->yamlManager->setParameters($params); // clear the cache $this->container->get('zikula.cache_clearer')->clear('symfony.config'); return true; }