Index: install.php =================================================================== --- install.php (revision 14826) +++ install.php (working copy) @@ -68,12 +68,13 @@ * @var Array */ var $steps = Array ( - 'fresh_install' => Array ('check_paths', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'security', 'finish'), - 'clean_reinstall' => Array ('check_paths', 'clean_db', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'security', 'finish'), + 'fresh_install' => Array ('check_paths', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'sys_config', 'select_theme', 'security', 'finish'), + 'clean_reinstall' => Array ('check_paths', 'clean_db', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'sys_config', 'select_theme', 'security', 'finish'), 'already_installed' => Array ('check_paths', 'install_setup'), 'upgrade' => Array ('check_paths', 'install_setup', 'upgrade_modules', 'skin_upgrade', 'security', 'finish'), 'update_license' => Array ('check_paths', 'install_setup', 'select_license', /*'download_license',*/ 'select_domain', 'security', 'finish'), + 'update_config' => Array ('check_paths', 'install_setup', 'sys_config', 'security', 'finish'), 'db_reconfig' => Array ('check_paths', 'install_setup', 'db_reconfig', 'security', 'finish'), 'fix_paths' => Array ('check_paths', 'install_setup', 'fix_paths', 'security', 'finish'), ); @@ -236,12 +237,13 @@ * Returns variable from request * * @param string $name + * @param mixed $default * @return string|bool * @access private */ - private function GetVar($name) + private function GetVar($name, $default = false) { - return array_key_exists($name, $_REQUEST) ? $_REQUEST[$name] : false; + return array_key_exists($name, $_REQUEST) ? $_REQUEST[$name] : $default; } /** @@ -801,6 +803,18 @@ } break; + case 'sys_config': + $config_data = $this->GetVar('system_config'); + + foreach ($config_data as $section => $section_vars) { + foreach ($section_vars as $var_name => $var_value) { + $this->toolkit->setSystemConfig($section, $var_name, $var_value); + } + } + + $this->toolkit->SaveConfig(); + break; + case 'root_password': // update root password in database $password = md5( md5($this->Application->GetVar('root_password')) . 'b38'); Index: install/install_toolkit.php =================================================================== --- install/install_toolkit.php (revision 14826) +++ install/install_toolkit.php (working copy) @@ -580,19 +580,20 @@ * * @param string $section * @param string $key + * @param mixed $default * @return string|bool */ - function getSystemConfig($section, $key) + function getSystemConfig($section, $key, $default = false) { if ( !array_key_exists($section, $this->systemConfig) ) { - return false; + return $default; } if ( !array_key_exists($key, $this->systemConfig[$section]) ) { - return false; + return $default; } - return $this->systemConfig[$section][$key] ? $this->systemConfig[$section][$key] : false; + return $this->systemConfig[$section][$key] ? $this->systemConfig[$section][$key] : $default; } /** @@ -1070,4 +1071,71 @@ // return output in case of errors return $output; } + + /** + * Returns cache handlers, that are working + * + * @param string $current + * @return Array + */ + public function getWorkingCacheHandlers($current = null) + { + if ( !isset($current) ) { + $current = $this->getSystemConfig('Misc', 'CacheHandler'); + } + + $cache_handlers = Array ( + 'Fake' => 'None', 'Memcache' => 'Memcached', 'XCache' => 'XCache', 'Apc' => 'Alternative PHP Cache' + ); + + foreach ($cache_handlers AS $class_prefix => $title) { + $handler_class = $class_prefix . 'CacheHandler'; + + if ( !class_exists($handler_class) ) { + unset($cache_handlers[$class_prefix]); + } + else { + $handler = new $handler_class(); + /* @var $handler FakeCacheHandler */ + + if ( !$handler->isWorking() ) { + if ( $current == $class_prefix ) { + $cache_handlers[$class_prefix] .= ' (offline)'; + } + else { + unset($cache_handlers[$class_prefix]); + } + } + } + } + + return $cache_handlers; + } + + /** + * Returns compression engines, that are working + * + * @param string $current + * @return Array + */ + public function getWorkingCompressionEngines($current = null) + { + if ( !isset($current) ) { + $current = $this->getSystemConfig('Misc', 'CompressionEngine'); + } + + exec('java -version', $output); + $compression_engines = Array ('' => 'None', 'yui' => 'YUICompressor (Java)', 'php' => 'PHP-based'); + + if ( strpos($output, 'Java Version') === false ) { + if ( $current == 'yui' ) { + $compression_engines['yui'] .= ' (offline)'; + } + else { + unset($compression_engines['yui']); + } + } + + return $compression_engines; + } } \ No newline at end of file Index: install/step_templates/install_setup.tpl =================================================================== --- install/step_templates/install_setup.tpl (revision 14826) +++ install/step_templates/install_setup.tpl (working copy) @@ -32,14 +32,19 @@ $option_tpl = ob_get_clean(); $options = Array ( - 'upgrade' => 'Upgrade In-Portal', - 'clean_reinstall' => 'Reinstall In-Portal', - 'fresh_install' => 'Install In-Portal to a New Database', - 'update_license' => 'Update License Information', - 'db_reconfig' => 'Update Database Configuration', - 'fix_paths' => 'Update Installation Paths', - ); + 'upgrade' => 'Upgrade In-Portal', + 'clean_reinstall' => 'Reinstall In-Portal', + 'fresh_install' => 'Install In-Portal to a New Database', + 'update_license' => 'Update License Information', + 'update_config' => 'Update System Configuration', + 'db_reconfig' => 'Update Database Configuration', + 'fix_paths' => 'Update Installation Paths', + ); + if ( !$this->Application->isDebugMode() ) { + unset($options['update_config']); + } + $upgradable_modules = $this->GetUpgradableModules(); if (!$upgradable_modules) { unset($options['upgrade']); Index: install/step_templates/sys_config.tpl =================================================================== --- install/step_templates/sys_config.tpl (revision 0) +++ install/step_templates/sys_config.tpl (revision 0) @@ -0,0 +1,54 @@ + Array ('type' => 'text', 'title' => 'Path to Website', 'section' => 'Misc', 'required' => 1, 'default' => '/'), + 'WriteablePath' => Array ('type' => 'text', 'title' => '', 'section' => 'Misc', 'required' => 1, 'default' => '/system'), + 'RestrictedPath' => Array ('type' => 'text', 'title' => '', 'section' => 'Misc', 'required' => 1, 'default' => '/system/.restricted'), + 'AdminDirectory' => Array ('type' => 'text', 'title' => '', 'section' => 'Misc', 'default' => '/admin'), + 'AdminPresetsDirectory' => Array ('type' => 'text', 'title' => '', 'section' => 'Misc', 'default' => '/admin'), + 'ApplicationClass' => Array ('type' => 'text', 'title' => '', 'section' => 'Misc', 'default' => 'kApplication'), + 'ApplicationPath' => Array ('type' => 'text', 'title' => '', 'section' => 'Misc', 'default' => '/core/kernel/application.php'), + 'CacheHandler' => Array ('type' => 'select', 'title' => 'Caching Engine', 'section' => 'Misc', 'default' => 'Fake'), + 'MemcacheServers' => Array ('type' => 'text', 'title' => 'Memcache Servers', 'section' => 'Misc', 'default' => 'localhost:11211'), + 'CompressionEngine' => Array ('type' => 'select', 'title' => '', 'section' => 'Misc', 'default' => ''), + ); + + $settings['CacheHandler']['options'] = $this->toolkit->getWorkingCacheHandlers(); + $settings['CompressionEngine']['options'] = $this->toolkit->getWorkingCompressionEngines(); + + foreach ($settings as $config_var => $output_params) { + ?> + + + *' : ''); ?>: + + + toolkit->getSystemConfig($output_params['section'], $config_var, $output_params['default']); + + if ( $output_params['type'] == 'text' ) { + echo ''; + } + else { + echo ''; + } + ?> + + + \ No newline at end of file Index: install/steps_db.xml =================================================================== --- install/steps_db.xml (revision 14826) +++ install/steps_db.xml (working copy) @@ -100,6 +100,14 @@ ]]> + + These are system advanced settings and must be changed with caution.

+
+

It's not recommended to change these settings unless you know what you are doing.

+
+

These settings will be stored in system/config.php file and can be changed manually if needed.

+ ]]> +
Selected theme will be used as a default in your In-Portal website.

You can manage your themes in Admin Console under Configuration -> Website -> Themes section.

@@ -165,4 +173,4 @@ For example, if you moved them from one folder to another. It will update all settings and ensure the program is operational at the new location.]]>
- \ No newline at end of file +