Attached Files |
system_configuration_969.patch [^] (10,392 bytes) 2011-12-02 09:28
[Show Content]
Index: install.php
===================================================================
--- install.php (revision 14817)
+++ install.php (working copy)
@@ -74,6 +74,7 @@
'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'),
+ 'sys_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'),
);
@@ -169,18 +170,10 @@
$this->writeableFolders[] = $this->toolkit->defaultWritablePath . '/config.php';
}
- if ( !$this->toolkit->getSystemConfig('Misc', 'WriteablePath') ) {
- $this->toolkit->setSystemConfig('Misc', 'WriteablePath', $this->toolkit->defaultWritablePath);
- }
-
if ( !$this->toolkit->getSystemConfig('Misc', 'RestrictedPath') ) {
$this->toolkit->setSystemConfig('Misc', 'RestrictedPath', $this->toolkit->getSystemConfig('Misc', 'WriteablePath') . DIRECTORY_SEPARATOR . '.restricted');
}
- if ( !$this->toolkit->getSystemConfig('Misc', 'WebsitePath') ) {
- $this->toolkit->setSystemConfig('Misc', 'WebsitePath', $base_path);
- }
-
if ( $this->toolkit->systemConfigChanged ) {
// immediately save, because this paths will be used in kApplication class later
$this->toolkit->SaveConfig(true);
@@ -278,6 +271,11 @@
switch ($this->currentStep) {
case 'check_paths':
$writeable_base = $this->toolkit->getSystemConfig('Misc', 'WriteablePath');
+
+ if (!$writeable_base) {
+ $writeable_base = $this->toolkit->defaultWritablePath;
+ }
+
foreach ($this->writeableFolders as $folder_path) {
$file_path = FULL_PATH . str_replace('$1', $writeable_base, $folder_path);
if (file_exists($file_path) && !is_writable($file_path)) {
@@ -801,6 +799,82 @@
}
break;
+ case 'sys_config':
+ $website_path = $this->GetVar('website_path');
+
+ if (!$website_path || $website_path == $this->toolkit->defaultWebsitePath) {
+ unset($website_path);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'WebsitePath', $website_path);
+
+ $writeable_path = $this->GetVar('writeable_path');
+
+ if (!$writeable_path || $writeable_path == $this->toolkit->defaultWritablePath) {
+ unset($writeable_path);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'WriteablePath', $writeable_path);
+
+ $admin_directory = $this->GetVar('admin_directory');
+
+ if (!$admin_directory || $admin_directory == '/admin') {
+ unset($admin_directory);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'AdminDirectory', $admin_directory);
+
+ $admin_presets_directory = $this->GetVar('admin_directory');
+
+ if (!$admin_presets_directory || $admin_presets_directory == '/admin') {
+ unset($admin_presets_directory);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'AdminPresetsDirectory', $admin_presets_directory);
+
+ $application_class = $this->GetVar('application_class');
+
+ if (!$application_class || $application_class == 'kApplication') {
+ unset($application_class);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'ApplicationClass', $application_class);
+
+ $application_path = $this->GetVar('application_path');
+
+ if (!$application_path || $application_path == '/core/kernel/application.php') {
+ unset($application_path);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'ApplicationPath', $application_path);
+
+ $cache_handler = $this->GetVar('cache_handler');
+
+ if (!$cache_handler) {
+ unset($cache_handler);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'CacheHandler', $cache_handler);
+
+ $memcache_servers = $this->GetVar('memcache_servers');
+
+ if (!$memcache_servers || $memcache_servers == 'localhost:11211') {
+ unset($memcache_servers);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'MemcacheServers', $memcache_servers);
+
+ $compression_engine = $this->GetVar('compression_engine');
+
+ if (!$compression_engine) {
+ unset($compression_engine);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'CompressionEngine', $compression_engine);
+
+ $this->toolkit->SaveConfig();
+ break;
+
case 'root_password':
// update root password in database
$password = md5( md5($this->Application->GetVar('root_password')) . 'b38');
@@ -1008,11 +1082,11 @@
return ;
}
+ $this->InitApplication();
+
$this->currentStep = $this->GetNextStep();
$this->InitStep(); // init next step (that will be shown now)
- $this->InitApplication();
-
if ($this->currentStep == -1) {
// step after last step -> redirect to admin
$this->Application->Redirect('index', Array (), '', 'index.php');
@@ -1225,6 +1299,12 @@
$this->Conn =& $this->Application->GetADODBConnection();
$this->toolkit->Conn =& $this->Application->GetADODBConnection();
}
+
+ if ($this->Application && $this->Application->isDebugMode()) {
+ // add "System Configuration" installation step
+ $this->steps['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');
+ $this->steps['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');
+ }
}
/**
Index: install/install_toolkit.php
===================================================================
--- install/install_toolkit.php (revision 14817)
+++ install/install_toolkit.php (working copy)
@@ -90,6 +90,12 @@
var $defaultWritablePath = '';
/**
+ *
+ * @var string
+ */
+ var $defaultWebsitePath = '';
+
+ /**
* Installator instance
*
* @var kInstallator
@@ -99,6 +105,7 @@
function kInstallToolkit()
{
$this->defaultWritablePath = DIRECTORY_SEPARATOR . 'system';
+ $this->defaultWebsitePath = rtrim(preg_replace('/'.preg_quote(rtrim(REL_PATH, '/'), '/').'$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/');
if ( class_exists('kApplication') ) {
// auto-setup in case of separate module install
Index: install/step_templates/check_paths.tpl
===================================================================
--- install/step_templates/check_paths.tpl (revision 14817)
+++ install/step_templates/check_paths.tpl (working copy)
@@ -9,6 +9,11 @@
$folder_tpl = ob_get_clean();
$writeable_base = $this->toolkit->getSystemConfig('Misc', 'WriteablePath');
+
+ if (!$writeable_base) {
+ $writeable_base = $this->toolkit->defaultWritablePath;
+ }
+
foreach ($this->writeableFolders as $folder_path) {
$file_path = str_replace('$1', $writeable_base, $folder_path);
if (file_exists(FULL_PATH . $file_path)) {
Index: install/step_templates/install_setup.tpl
===================================================================
--- install/step_templates/install_setup.tpl (revision 14817)
+++ install/step_templates/install_setup.tpl (working copy)
@@ -36,6 +36,7 @@
'clean_reinstall' => 'Reinstall In-Portal',
'fresh_install' => 'Install In-Portal to a New Database',
'update_license' => 'Update License Information',
+ 'sys_config' => 'Update System Configuration',
'db_reconfig' => 'Update Database Configuration',
'fix_paths' => 'Update Installation Paths',
);
Index: install/steps_db.xml
===================================================================
--- install/steps_db.xml (revision 14817)
+++ install/steps_db.xml (working copy)
@@ -100,6 +100,14 @@
]]>
</step>
+ <step name="sys_config" title="System Configuration">
+ <![CDATA[<p>These are system advanced settings and must be changed with caution.</p>
+ <br/>
+ <p>It's not recommended to change these settings unless you know what you are doing.</p>
+ <br/>
+ <p>These settings will be stored in system/config.php file and can be changed manually if needed.</p>
+ ]]>
+ </step>
<step name="select_theme" title="Select Default Theme">
<![CDATA[<p>Selected theme will be used as a default in your In-Portal website.</p>
<p>You can manage your themes in Admin Console under Configuration -> Website -> Themes section.</p>
Index: kernel/startup.php
===================================================================
--- kernel/startup.php (revision 14817)
+++ kernel/startup.php (working copy)
@@ -65,17 +65,31 @@
exit;
}
- // variable WebsitePath is auto-detected once during installation/upgrade
+ // variable WebsitePath may be set once during installation/upgrade
+ if (!isset($vars['WebsitePath'])) {
+ if (defined('REL_PATH')) {
+ // location of index.php relatively to site base folder
+ $relative_path = preg_replace('/^[\/]{0,1}admin(.*)/', $admin_directory . '\\1', REL_PATH);
+ }
+ else {
+ // default index.php relative location is administrative console folder
+ define('REL_PATH', $admin_directory);
+ $relative_path = REL_PATH;
+ }
+ $vars['WebsitePath'] = rtrim(preg_replace('/' . preg_quote(rtrim($relative_path, '/'), '/') . '$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/');
+ }
define('BASE_PATH', $vars['WebsitePath']);
define('APPLICATION_CLASS', isset($vars['ApplicationClass']) ? $vars['ApplicationClass'] : 'kApplication');
define('APPLICATION_PATH', isset($vars['ApplicationPath']) ? $vars['ApplicationPath'] : '/core/kernel/application.php');
- if (isset($vars['WriteablePath'])) {
- define('WRITEABLE', FULL_PATH . $vars['WriteablePath']);
- define('WRITEBALE_BASE', $vars['WriteablePath']);
+ if (!isset($vars['WriteablePath'])) {
+ $vars['WriteablePath'] = DIRECTORY_SEPARATOR . 'system';
}
+ define('WRITEABLE', FULL_PATH . $vars['WriteablePath']);
+ define('WRITEBALE_BASE', $vars['WriteablePath']);
+
if ( isset($vars['RestrictedPath']) ) {
define('RESTRICTED', FULL_PATH . $vars['RestrictedPath']);
}
system_configuration_969.2.patch [^] (15,514 bytes) 2011-12-05 04:16
[Show Content]
Index: install.php
===================================================================
--- install.php (revision 14817)
+++ install.php (working copy)
@@ -74,6 +74,7 @@
'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'),
+ 'sys_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'),
);
@@ -169,18 +170,10 @@
$this->writeableFolders[] = $this->toolkit->defaultWritablePath . '/config.php';
}
- if ( !$this->toolkit->getSystemConfig('Misc', 'WriteablePath') ) {
- $this->toolkit->setSystemConfig('Misc', 'WriteablePath', $this->toolkit->defaultWritablePath);
- }
-
if ( !$this->toolkit->getSystemConfig('Misc', 'RestrictedPath') ) {
$this->toolkit->setSystemConfig('Misc', 'RestrictedPath', $this->toolkit->getSystemConfig('Misc', 'WriteablePath') . DIRECTORY_SEPARATOR . '.restricted');
}
- if ( !$this->toolkit->getSystemConfig('Misc', 'WebsitePath') ) {
- $this->toolkit->setSystemConfig('Misc', 'WebsitePath', $base_path);
- }
-
if ( $this->toolkit->systemConfigChanged ) {
// immediately save, because this paths will be used in kApplication class later
$this->toolkit->SaveConfig(true);
@@ -278,6 +271,11 @@
switch ($this->currentStep) {
case 'check_paths':
$writeable_base = $this->toolkit->getSystemConfig('Misc', 'WriteablePath');
+
+ if (!$writeable_base) {
+ $writeable_base = $this->toolkit->defaultWritablePath;
+ }
+
foreach ($this->writeableFolders as $folder_path) {
$file_path = FULL_PATH . str_replace('$1', $writeable_base, $folder_path);
if (file_exists($file_path) && !is_writable($file_path)) {
@@ -801,6 +799,82 @@
}
break;
+ case 'sys_config':
+ $website_path = $this->GetVar('website_path');
+
+ if (!$website_path || $website_path == $this->toolkit->defaultWebsitePath) {
+ unset($website_path);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'WebsitePath', $website_path);
+
+ $writeable_path = $this->GetVar('writeable_path');
+
+ if (!$writeable_path || $writeable_path == $this->toolkit->defaultWritablePath) {
+ unset($writeable_path);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'WriteablePath', $writeable_path);
+
+ $admin_directory = $this->GetVar('admin_directory');
+
+ if (!$admin_directory || $admin_directory == '/admin') {
+ unset($admin_directory);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'AdminDirectory', $admin_directory);
+
+ $admin_presets_directory = $this->GetVar('admin_directory');
+
+ if (!$admin_presets_directory || $admin_presets_directory == '/admin') {
+ unset($admin_presets_directory);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'AdminPresetsDirectory', $admin_presets_directory);
+
+ $application_class = $this->GetVar('application_class');
+
+ if (!$application_class || $application_class == 'kApplication') {
+ unset($application_class);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'ApplicationClass', $application_class);
+
+ $application_path = $this->GetVar('application_path');
+
+ if (!$application_path || $application_path == '/core/kernel/application.php') {
+ unset($application_path);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'ApplicationPath', $application_path);
+
+ $cache_handler = $this->GetVar('cache_handler');
+
+ if (!$cache_handler) {
+ unset($cache_handler);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'CacheHandler', $cache_handler);
+
+ $memcache_servers = $this->GetVar('memcache_servers');
+
+ if (!$memcache_servers || $memcache_servers == 'localhost:11211') {
+ unset($memcache_servers);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'MemcacheServers', $memcache_servers);
+
+ $compression_engine = $this->GetVar('compression_engine');
+
+ if (!$compression_engine) {
+ unset($compression_engine);
+ }
+
+ $this->toolkit->setSystemConfig('Misc', 'CompressionEngine', $compression_engine);
+
+ $this->toolkit->SaveConfig();
+ break;
+
case 'root_password':
// update root password in database
$password = md5( md5($this->Application->GetVar('root_password')) . 'b38');
@@ -1008,11 +1082,11 @@
return ;
}
+ $this->InitApplication();
+
$this->currentStep = $this->GetNextStep();
$this->InitStep(); // init next step (that will be shown now)
- $this->InitApplication();
-
if ($this->currentStep == -1) {
// step after last step -> redirect to admin
$this->Application->Redirect('index', Array (), '', 'index.php');
@@ -1225,6 +1299,12 @@
$this->Conn =& $this->Application->GetADODBConnection();
$this->toolkit->Conn =& $this->Application->GetADODBConnection();
}
+
+ if ($this->Application && $this->Application->isDebugMode()) {
+ // add "System Configuration" installation step
+ $this->steps['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');
+ $this->steps['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');
+ }
}
/**
Index: install/install_toolkit.php
===================================================================
--- install/install_toolkit.php (revision 14817)
+++ install/install_toolkit.php (working copy)
@@ -90,6 +90,12 @@
var $defaultWritablePath = '';
/**
+ *
+ * @var string
+ */
+ var $defaultWebsitePath = '';
+
+ /**
* Installator instance
*
* @var kInstallator
@@ -99,6 +105,7 @@
function kInstallToolkit()
{
$this->defaultWritablePath = DIRECTORY_SEPARATOR . 'system';
+ $this->defaultWebsitePath = rtrim(preg_replace('/'.preg_quote(rtrim(REL_PATH, '/'), '/').'$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/');
if ( class_exists('kApplication') ) {
// auto-setup in case of separate module install
Index: install/step_templates/check_paths.tpl
===================================================================
--- install/step_templates/check_paths.tpl (revision 14817)
+++ install/step_templates/check_paths.tpl (working copy)
@@ -9,6 +9,11 @@
$folder_tpl = ob_get_clean();
$writeable_base = $this->toolkit->getSystemConfig('Misc', 'WriteablePath');
+
+ if (!$writeable_base) {
+ $writeable_base = $this->toolkit->defaultWritablePath;
+ }
+
foreach ($this->writeableFolders as $folder_path) {
$file_path = str_replace('$1', $writeable_base, $folder_path);
if (file_exists(FULL_PATH . $file_path)) {
Index: install/step_templates/install_setup.tpl
===================================================================
--- install/step_templates/install_setup.tpl (revision 14817)
+++ install/step_templates/install_setup.tpl (working copy)
@@ -36,6 +36,7 @@
'clean_reinstall' => 'Reinstall In-Portal',
'fresh_install' => 'Install In-Portal to a New Database',
'update_license' => 'Update License Information',
+ 'sys_config' => 'Update System Configuration',
'db_reconfig' => 'Update Database Configuration',
'fix_paths' => 'Update Installation Paths',
);
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,172 @@
+<?php
+ $website_path = $this->toolkit->getSystemConfig('Misc', 'WebsitePath');
+
+ if (!$website_path) {
+ $website_path = $this->toolkit->defaultWebsitePath;
+ }
+
+ $writeable_path = $this->toolkit->getSystemConfig('Misc', 'WriteablePath');
+
+ if (!$writeable_path) {
+ $writeable_path = $this->toolkit->defaultWritablePath;
+ }
+
+ $admin_directory = $this->toolkit->getSystemConfig('Misc', 'AdminDirectory');
+
+ if (!$admin_directory) {
+ $admin_directory = '/admin';
+ }
+
+ $admin_presets_directory = $this->toolkit->getSystemConfig('Misc', 'AdminPresetsDirectory');
+
+ if (!$admin_presets_directory) {
+ $admin_presets_directory = '/admin';
+ }
+
+ $application_class = $this->toolkit->getSystemConfig('Misc', 'ApplicationClass');
+
+ if (!$application_class) {
+ $application_class = 'kApplication';
+ }
+
+ $application_path = $this->toolkit->getSystemConfig('Misc', 'ApplicationPath');
+
+ if (!$application_path) {
+ $application_path = '/core/kernel/application.php';
+ }
+
+ $cache_handler = $this->toolkit->getSystemConfig('Misc', 'CacheHandler');
+
+ $cache_handlers = Array('Memcache' => 1, 'XCache' => 1, 'Apc' => 1);
+
+ foreach ($cache_handlers AS $current_cache_handler => $is_enabled) {
+ $handler_class = $current_cache_handler.'CacheHandler';
+ $handler = new $handler_class();
+ if (!$handler->isWorking()) {
+ $cache_handlers[$current_cache_handler] = 0;
+ } else {
+ if (!$cache_handler) {
+ $cache_handler = $current_cache_handler;
+ }
+ }
+ }
+
+ $memcache_servers = $this->toolkit->getSystemConfig('Misc', 'MemcacheServers');
+
+ if (!$memcache_servers) {
+ $memcache_servers = 'localhost:11211';
+ }
+
+ $compression_engine = $this->toolkit->getSystemConfig('Misc', 'CompressionEngine');
+
+ $comprecssion_engines = Array('PHP-based' => 1, 'YUICompressor (Java)' => 1);
+
+ if (function_exists('gzencode') && strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
+ $compression_engine = 'PHP-based';
+ } else {
+ $compression_engines['PHP-based'] = 0;
+ }
+
+ exec('java -version', $output);
+
+ if (strpos($output, 'Java Version') !== false) {
+ $compression_engine = 'YUICompressor (Java)';
+ } else {
+ $compression_engines['YUICompressor (Java)'] = 0;
+ }
+
+
+?>
+
+<tr class="table-color2">
+ <td class="text">
+ <b>WebsitePath<span class="error"></span>:</b>
+ </td>
+ <td>
+ <input type="text" name="website_path" value="<?php echo $website_path ?>" class="text">
+ </td>
+</tr>
+<tr class="table-color2">
+ <td class="text">
+ <b>WriteablePath<span class="error"></span>:</b>
+ </td>
+ <td>
+ <input type="text" name="writeable_path" value="<?php echo $writeable_path ?>" class="text">
+ </td>
+</tr>
+<tr class="table-color2">
+ <td class="text">
+ <b>AdminDirectory<span class="error"></span>:</b>
+ </td>
+ <td>
+ <input type="text" name="admin_directory" value="<?php echo $admin_directory ?>" class="text">
+ </td>
+</tr>
+<tr class="table-color2">
+ <td class="text">
+ <b>AdminPresetsDirectory<span class="error"></span>:</b>
+ </td>
+ <td>
+ <input type="text" name="admin_presets_directory" value="<?php echo $admin_presets_directory ?>" class="text">
+ </td>
+</tr>
+<tr class="table-color2">
+ <td class="text">
+ <b>ApplicationClass<span class="error"></span>:</b>
+ </td>
+ <td>
+ <input type="text" name="application_class" value="<?php echo $application_class ?>" class="text">
+ </td>
+</tr>
+<tr class="table-color2">
+ <td class="text">
+ <b>ApplicationPath<span class="error"></span>:</b>
+ </td>
+ <td>
+ <input type="text" name="application_path" value="<?php echo $application_path ?>" class="text">
+ </td>
+</tr>
+<tr class="table-color2">
+ <td class="text">
+ <b>CacheHandler<span class="error"></span>:</b>
+ </td>
+ <td>
+ <select name="cache_handler">
+ <option value="">None</option>
+ <?php
+ foreach ($cache_handlers AS $current_cache_handler => $is_enabled) {
+ if ($is_enabled) {
+ echo '<option value="'.$current_cache_handler.'"'.(($current_cache_handler == $cache_handler) ? ' selected' : '').'>'.$current_cache_handler.'</option>'."\n";
+ }
+ }
+
+ ?>
+ </select>
+ </td>
+</tr>
+<tr class="table-color2">
+ <td class="text">
+ <b>MemcacheServers<span class="error"></span>:</b>
+ </td>
+ <td>
+ <input type="text" name="memcache_servers" value="<?php echo $memcache_servers ?>" class="text">
+ </td>
+</tr>
+<tr class="table-color2">
+ <td class="text">
+ <b>CompressionEngine<span class="error"></span>:</b>
+ </td>
+ <td>
+ <select name="compression_engine">
+ <option value="">None</option>
+ <?php
+ foreach ($compression_engines AS $current_compression_engine => $is_enabled) {
+ if ($is_enabled) {
+ echo '<option value="'.$current_compression_engine.'"'.(($current_compression_engine == $compression_engine) ? ' selected' : '').'>'.$current_compression_engine.'</option>'."\n";
+ }
+ }
+
+ ?>
+ </select>
+ </td>
+</tr>
Index: install/steps_db.xml
===================================================================
--- install/steps_db.xml (revision 14817)
+++ install/steps_db.xml (working copy)
@@ -100,6 +100,14 @@
]]>
</step>
+ <step name="sys_config" title="System Configuration">
+ <![CDATA[<p>These are system advanced settings and must be changed with caution.</p>
+ <br/>
+ <p>It's not recommended to change these settings unless you know what you are doing.</p>
+ <br/>
+ <p>These settings will be stored in system/config.php file and can be changed manually if needed.</p>
+ ]]>
+ </step>
<step name="select_theme" title="Select Default Theme">
<![CDATA[<p>Selected theme will be used as a default in your In-Portal website.</p>
<p>You can manage your themes in Admin Console under Configuration -> Website -> Themes section.</p>
Index: kernel/startup.php
===================================================================
--- kernel/startup.php (revision 14817)
+++ kernel/startup.php (working copy)
@@ -65,17 +65,31 @@
exit;
}
- // variable WebsitePath is auto-detected once during installation/upgrade
+ // variable WebsitePath may be set once during installation/upgrade
+ if (!isset($vars['WebsitePath'])) {
+ if (defined('REL_PATH')) {
+ // location of index.php relatively to site base folder
+ $relative_path = preg_replace('/^[\/]{0,1}admin(.*)/', $admin_directory . '\\1', REL_PATH);
+ }
+ else {
+ // default index.php relative location is administrative console folder
+ define('REL_PATH', $admin_directory);
+ $relative_path = REL_PATH;
+ }
+ $vars['WebsitePath'] = rtrim(preg_replace('/' . preg_quote(rtrim($relative_path, '/'), '/') . '$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/');
+ }
define('BASE_PATH', $vars['WebsitePath']);
define('APPLICATION_CLASS', isset($vars['ApplicationClass']) ? $vars['ApplicationClass'] : 'kApplication');
define('APPLICATION_PATH', isset($vars['ApplicationPath']) ? $vars['ApplicationPath'] : '/core/kernel/application.php');
- if (isset($vars['WriteablePath'])) {
- define('WRITEABLE', FULL_PATH . $vars['WriteablePath']);
- define('WRITEBALE_BASE', $vars['WriteablePath']);
+ if (!isset($vars['WriteablePath'])) {
+ $vars['WriteablePath'] = DIRECTORY_SEPARATOR . 'system';
}
+ define('WRITEABLE', FULL_PATH . $vars['WriteablePath']);
+ define('WRITEBALE_BASE', $vars['WriteablePath']);
+
if ( isset($vars['RestrictedPath']) ) {
define('RESTRICTED', FULL_PATH . $vars['RestrictedPath']);
}
sys_config_installation_step_v3.patch [^] (10,863 bytes) 2011-12-05 10:59
[Show Content]
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 @@
+<?php
+ $settings = Array (
+ 'WebsitePath' => 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) {
+ ?>
+ <tr class="table-color2">
+ <td class="text">
+ <b><?php echo ($output_params['title'] ? $output_params['title'] : $config_var) . (isset($output_params['required']) ? ' <span class="error">*</span>' : ''); ?>:</b>
+ </td>
+ <td>
+ <?php
+ $config_value = $this->toolkit->getSystemConfig($output_params['section'], $config_var, $output_params['default']);
+
+ if ( $output_params['type'] == 'text' ) {
+ echo '<input type="text" name="system_config[' . $output_params['section'] . '][' . $config_var . ']" value="' . $config_value . '" class="text" style="width: 200px;"/>';
+ }
+ else {
+ echo '<select name="system_config[' . $output_params['section'] . '][' . $config_var . ']">';
+
+ if ( $output_params['options'][$config_value] == 'None' ) {
+ $tmp_values = array_keys($output_params['options']);
+
+ if ( count($tmp_values) > 1 ) {
+ $config_value = $tmp_values[1];
+ }
+ }
+
+ foreach($output_params['options'] as $option_key => $option_value) {
+ $selected = $option_key == $config_value ? ' selected' : '';
+ echo '<option value="' . $option_key . '"' . $selected . '>' . $option_value . '</option>';
+ }
+
+ echo '</select>';
+ }
+ ?>
+ </td>
+ </tr>
+ <?php
+ }
+?>
\ 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 @@
]]>
</step>
+ <step name="sys_config" title="System Configuration">
+ <![CDATA[<p>These are system advanced settings and must be changed with caution.</p>
+ <br/>
+ <p>It's not recommended to change these settings unless you know what you are doing.</p>
+ <br/>
+ <p>These settings will be stored in system/config.php file and can be changed manually if needed.</p>
+ ]]>
+ </step>
<step name="select_theme" title="Select Default Theme">
<![CDATA[<p>Selected theme will be used as a default in your In-Portal website.</p>
<p>You can manage your themes in Admin Console under Configuration -> Website -> Themes section.</p>
@@ -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.]]>
</step>
-</steps>
\ No newline at end of file
+</steps>
sys_config_installation_step_v4-Dmitry.patch [^] (15,109 bytes) 2011-12-07 16:51
[Show Content]
Index: install.php
===================================================================
--- install.php (revision 14841)
+++ install.php (working copy)
@@ -68,14 +68,14 @@
* @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 +236,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 +802,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');
@@ -973,10 +986,6 @@
}
break;
- case 'fix_paths':
- $this->toolkit->saveConfigValues( $this->Application->GetVar('config') );
- break;
-
case 'finish':
// delete cache
$this->toolkit->deleteCache();
Index: install/install_toolkit.php
===================================================================
--- install/install_toolkit.php (revision 14841)
+++ 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 14841)
+++ install/step_templates/install_setup.tpl (working copy)
@@ -32,14 +32,18 @@
$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',
+ );
+ 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 @@
+<?php
+ $settings = Array (
+ 'WebsitePath' => Array ('type' => 'text', 'title' => 'Path to Website', 'section' => 'Misc', 'required' => 1, 'default' => '/'),
+ 'WriteablePath' => Array ('type' => 'text', 'title' => 'Path to Writable folder', 'section' => 'Misc', 'required' => 1, 'default' => '/system'),
+ 'RestrictedPath' => Array ('type' => 'text', 'title' => 'Path to Restricted folder', 'section' => 'Misc', 'required' => 1, 'default' => '/system/.restricted'),
+ 'AdminDirectory' => Array ('type' => 'text', 'title' => 'Path to Admin folder', 'section' => 'Misc', 'default' => '/admin'),
+ 'AdminPresetsDirectory' => Array ('type' => 'text', 'title' => 'Path to Admin Interface Presets folder', 'section' => 'Misc', 'default' => '/admin'),
+ 'ApplicationClass' => Array ('type' => 'text', 'title' => 'Name of Core Application Class', 'section' => 'Misc', 'default' => 'kApplication'),
+ 'ApplicationPath' => Array ('type' => 'text', 'title' => 'Path to Core Application Class file', 'section' => 'Misc', 'default' => '/core/kernel/application.php'),
+ 'CacheHandler' => Array ('type' => 'select', 'title' => 'Caching Engine', 'section' => 'Misc', 'default' => 'Fake'),
+ 'MemcacheServers' => Array ('type' => 'text', 'title' => 'Location of Memcache Servers', 'section' => 'Misc', 'default' => 'localhost:11211'),
+ 'CompressionEngine' => Array ('type' => 'select', 'title' => 'CSS/JS Compression Engine', 'section' => 'Misc', 'default' => ''),
+ );
+
+ $settings['CacheHandler']['options'] = $this->toolkit->getWorkingCacheHandlers();
+ $settings['CompressionEngine']['options'] = $this->toolkit->getWorkingCompressionEngines();
+
+ foreach ($settings as $config_var => $output_params) {
+ ?>
+ <tr class="table-color2">
+ <td class="text">
+ <b><?php echo ($output_params['title'] ? $output_params['title'] : $config_var) . (isset($output_params['required']) ? ' <span class="error">*</span>' : ''); ?>:</b>
+ </td>
+ <td>
+ <?php
+ $config_value = $this->toolkit->getSystemConfig($output_params['section'], $config_var, $output_params['default']);
+
+ if ( $output_params['type'] == 'text' ) {
+ echo '<input type="text" name="system_config[' . $output_params['section'] . '][' . $config_var . ']" value="' . $config_value . '" class="text" style="width: 200px;"/>';
+ }
+ else {
+ echo '<select name="system_config[' . $output_params['section'] . '][' . $config_var . ']">';
+
+ if ( $output_params['options'][$config_value] == 'None' ) {
+ $tmp_values = array_keys($output_params['options']);
+
+ if ( count($tmp_values) > 1 ) {
+ $config_value = $tmp_values[1];
+ }
+ }
+
+ foreach($output_params['options'] as $option_key => $option_value) {
+ $selected = $option_key == $config_value ? ' selected' : '';
+ echo '<option value="' . $option_key . '"' . $selected . '>' . $option_value . '</option>';
+ }
+
+ echo '</select>';
+ }
+ ?>
+ </td>
+ </tr>
+ <?php
+ }
+?>
Property changes on: install\step_templates\sys_config.tpl
___________________________________________________________________
Added: svn:eol-style
+ LF
Index: install/steps_db.xml
===================================================================
--- install/steps_db.xml (revision 14841)
+++ install/steps_db.xml (working copy)
@@ -100,6 +100,53 @@
]]>
</step>
+ <step name="sys_config" title="System Configuration">
+ <![CDATA[<p>These are system advanced settings and must be changed with caution. It's <strong><i>not recommended</i></strong> to
+ change these settings unless you exactly know what you are doing. These settings will be stored in <strong>system/config.php</strong>
+ file and can be changed manually if needed.</p>
+ <br/>
+
+ <p><b><i>Web Path to Installation</i></b> - web path to the root of your In-Portal installation. For example,
+ if your In-Portal will be running at http://www.your-website.com, then Web Path to Installation should be set to <b>/</b>
+ since In-Portal is setup in the root of the domain. In case if your In-Portal will be running under
+ http://www.your-website.com/in-portal/, then it should be set to <b>/in-portal/</b>. This setting is auto-detected during the
+ initial installation step, but can be adjusted at Installation Maintenance step.</p>
+
+ <p><b><i>Path to Writable folder</i></b> - path to a folder inside your In-Portal installation which can be accessed from the Web
+ and has writable permissions for the web server. This folder will be used to store dynamic content such as
+ uploaded and resized images, cached templates and other types of user files. The default value is <b>/system</b>.</p>
+
+ <p><b><i>Path to Restricted folder</i></b> - path to a folder inside or outside your In-Portal installation which will
+ used to store debug files, system logs and other non-public information. This folder must be writable by the web-server
+ and can be located outside of your In-Portal installation if needed. The default value is <b>/system/.restricted</b> .</p>
+
+ <p><b><i>Path to Admin folder</i></b> - web path to your In-Portal Admin Console folder. The default value is set to
+ <b>/admin</b> and your Admin Console will be accessible at http://www.your-website.com/admin.
+ In case if you want your Admin Console to be under http://www.your-website.com/secure-admin (or anything else)
+ you'll need to rename original <b>admin</b> folder to <b>secure-admin</b> on your filesystem and then set this path to <b>/secure-admin</b> .</p>
+
+ <p><b><i>Path to Admin Interface Presets folder</i></b> - path to a folder inside your In-Portal installation
+ contains Admin Interface Presets. The default value is <b>/admin</b> .</p>
+
+ <p><b><i>Name of Base Application Class</i></b> - default value is <b>kApplication</b> and can change very rarely. </p>
+
+ <p><b><i>Path to Base Application Class file</i></b> - default value is <b>/core/kernel/application.php</b> and can change very rarely.</p>
+
+ <p><b><i>Output Caching Engine</i></b> - provides ability to cache HTML output or other data using various caching engines to
+ lower the database load. The default value is set to <b>None</b> if no available engines detected. Available options are:
+ None (Fake), Memcached (Memcache), XCache (XCache) and Alternative PHP Cache (Apc).
+ Note that only auto-detected caching engines will be available for selection.</p>
+
+ <p><b><i>Location of Memcache Servers</i></b> - host or IP address with port where Memcached Server is running.
+ Multiple locations of can be listed separated by semi-colon (;). For example, 192.168.1.1:1121;192.168.1.2:1121;192.168.1.3:1121 .</p>
+
+ <p><b><i>CSS/JS Compression Engine</i></b> - provides <a href="http://en.wikipedia.org/wiki/Minification_(programming)">minification</a>
+ functionality for CSS / Javascript files. The default value is set to <b>PHP-based</b> if no Java is auto-detected on server-side.
+ Available options are: None (empty), YUICompressor (Java) (yui) and PHP-based (php) .</p>
+
+ <br/>
+ ]]>
+ </step>
<step name="select_theme" title="Select Default Theme">
<![CDATA[<p>Selected theme will be used as a default in your In-Portal website.</p>
<p>You can manage your themes in Admin Console under Configuration -> Website -> Themes section.</p>
@@ -160,9 +207,4 @@
The characters entered in this field are placed <i>before</i> the names of the tables used by In-Portal.
For example, if you enter "inp_" into the prefix field, the table named Category will be named inp_Category.</p>]]>
</step>
- <step name="fix_paths" title="Update Installation Paths">
- <![CDATA[The <i>Fix Paths</i> option should be used when the location of the In-Portal files has changed.
- 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.]]>
- </step>
</steps>
\ No newline at end of file
sys_config_installation_step_v5-combined.patch [^] (16,253 bytes) 2011-12-08 03:00
[Show Content]
Index: install.php
===================================================================
--- install.php (revision 14826)
+++ install.php (working copy)
@@ -68,14 +68,14 @@
* @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 +236,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 +802,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');
@@ -973,10 +986,6 @@
}
break;
- case 'fix_paths':
- $this->toolkit->saveConfigValues( $this->Application->GetVar('config') );
- break;
-
case 'finish':
// delete cache
$this->toolkit->deleteCache();
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('localhost:11211');
+ /* @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');
+ }
+
+ $output = shell_exec('java -version');
+ $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/fix_paths.tpl
===================================================================
--- install/step_templates/fix_paths.tpl (revision 14826)
+++ install/step_templates/fix_paths.tpl (working copy)
@@ -1,21 +0,0 @@
-<?php
- $config_vars = Array ('Site_Name', 'Backup_Path');
-
- $sql = 'SELECT Prompt, VariableName
- FROM ' . TABLE_PREFIX . 'ConfigurationValues
- WHERE VariableName IN ("' . implode('","', $config_vars) . '")';
- $config_labels = $this->Conn->GetCol($sql, 'VariableName');
-
- $odd_even = true;
- foreach ($config_vars as $config_var) {
- ?>
- <tr class="<?php echo $odd_even ? 'table-color1' : 'table-color2'; ?>">
- <td class="text"><b><?php echo $this->Application->Phrase( $config_labels[$config_var] ); ?>:</b></td>
- <td align="left">
- <input type="text" name="config[<?php echo $config_var; ?>]" class="text" size="50" value="<?php echo $this->Application->ConfigValue($config_var); ?>" />
- </td>
- </tr>
- <?php
- $odd_even = $odd_even ? false : true;
- }
-?>
\ 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,18 @@
$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',
+ );
+ 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,57 @@
+<?php
+ $settings = Array (
+ 'WebsitePath' => Array ('type' => 'text', 'title' => 'Web Path to Installation', 'section' => 'Misc', 'required' => 1, 'default' => '/'),
+ 'WriteablePath' => Array ('type' => 'text', 'title' => 'Path to Writable folder', 'section' => 'Misc', 'required' => 1, 'default' => '/system'),
+ 'RestrictedPath' => Array ('type' => 'text', 'title' => 'Path to Restricted folder', 'section' => 'Misc', 'required' => 1, 'default' => '/system/.restricted'),
+ 'AdminDirectory' => Array ('type' => 'text', 'title' => 'Path to Admin folder', 'section' => 'Misc', 'default' => '/admin'),
+ 'AdminPresetsDirectory' => Array ('type' => 'text', 'title' => 'Path to Admin Interface Presets folder', 'section' => 'Misc', 'default' => '/admin'),
+ 'ApplicationClass' => Array ('type' => 'text', 'title' => 'Name of Base Application Class', 'section' => 'Misc', 'default' => 'kApplication'),
+ 'ApplicationPath' => Array ('type' => 'text', 'title' => 'Path to Base Application Class file', 'section' => 'Misc', 'default' => '/core/kernel/application.php'),
+ 'CacheHandler' => Array ('type' => 'select', 'title' => 'Output Caching Engine', 'section' => 'Misc', 'default' => 'Fake'),
+ 'MemcacheServers' => Array ('type' => 'text', 'title' => 'Location of Memcache Servers', 'section' => 'Misc', 'default' => 'localhost:11211'),
+ 'CompressionEngine' => Array ('type' => 'select', 'title' => 'CSS/JS Compression Engine', 'section' => 'Misc', 'default' => ''),
+ );
+
+ $settings['CacheHandler']['options'] = $this->toolkit->getWorkingCacheHandlers();
+ $settings['CompressionEngine']['options'] = $this->toolkit->getWorkingCompressionEngines();
+
+ $row_class = 'table-color2';
+
+ foreach ($settings as $config_var => $output_params) {
+ $row_class = $row_class == 'table-color1' ? 'table-color2' : 'table-color1';
+ ?>
+ <tr class="<?php echo $row_class; ?>">
+ <td class="text">
+ <b><?php echo ($output_params['title'] ? $output_params['title'] : $config_var) . (isset($output_params['required']) ? ' <span class="error">*</span>' : ''); ?>:</b>
+ </td>
+ <td>
+ <?php
+ $config_value = $this->toolkit->getSystemConfig($output_params['section'], $config_var, $output_params['default']);
+
+ if ( $output_params['type'] == 'text' ) {
+ echo '<input type="text" name="system_config[' . $output_params['section'] . '][' . $config_var . ']" value="' . $config_value . '" class="text" style="width: 200px;"/>';
+ }
+ else {
+ echo '<select name="system_config[' . $output_params['section'] . '][' . $config_var . ']">';
+
+ if ( $output_params['options'][$config_value] == 'None' ) {
+ $tmp_values = array_keys($output_params['options']);
+
+ if ( count($tmp_values) > 1 ) {
+ $config_value = $tmp_values[1];
+ }
+ }
+
+ foreach($output_params['options'] as $option_key => $option_value) {
+ $selected = $option_key == $config_value ? ' selected' : '';
+ echo '<option value="' . $option_key . '"' . $selected . '>' . $option_value . '</option>';
+ }
+
+ echo '</select>';
+ }
+ ?>
+ </td>
+ </tr>
+ <?php
+ }
+?>
Index: install/steps_db.xml
===================================================================
--- install/steps_db.xml (revision 14826)
+++ install/steps_db.xml (working copy)
@@ -100,6 +100,53 @@
]]>
</step>
+ <step name="sys_config" title="System Configuration">
+ <![CDATA[<p>These are system advanced settings and must be changed with caution. It's <strong><i>not recommended</i></strong> to
+ change these settings unless you exactly know what you are doing. These settings will be stored in <strong>system/config.php</strong>
+ file and can be changed manually if needed.</p>
+ <br/>
+
+ <p><b><i>Web Path to Installation</i></b> - web path to the root of your In-Portal installation. For example,
+ if your In-Portal will be running at http://www.your-website.com, then Web Path to Installation should be set to <b>/</b>
+ since In-Portal is setup in the root of the domain. In case if your In-Portal will be running under
+ http://www.your-website.com/in-portal/, then it should be set to <b>/in-portal</b> (no trailing slash). This setting is auto-detected during the
+ initial installation step, but can be adjusted at Installation Maintenance step.</p>
+
+ <p><b><i>Path to Writable folder</i></b> - path to a folder inside your In-Portal installation which can be accessed from the Web
+ and has writable permissions for the web server. This folder will be used to store dynamic content such as
+ uploaded and resized images, cached templates and other types of user files. The default value is <b>/system</b>.</p>
+
+ <p><b><i>Path to Restricted folder</i></b> - path to a folder inside or outside your In-Portal installation which will
+ used to store debug files, system logs and other non-public information. This folder must be writable by the web-server
+ and can be located outside of your In-Portal installation if needed. The default value is <b>/system/.restricted</b> .</p>
+
+ <p><b><i>Path to Admin folder</i></b> - web path to your In-Portal Admin Console folder. The default value is set to
+ <b>/admin</b> and your Admin Console will be accessible at http://www.your-website.com/admin.
+ In case if you want your Admin Console to be under http://www.your-website.com/secure-admin (or anything else)
+ you'll need to rename original <b>admin</b> folder to <b>secure-admin</b> on your filesystem and then set this path to <b>/secure-admin</b> .</p>
+
+ <p><b><i>Path to Admin Interface Presets folder</i></b> - path to a folder inside your In-Portal installation
+ contains Admin Interface Presets. The default value is <b>/admin</b> .</p>
+
+ <p><b><i>Name of Base Application Class</i></b> - default value is <b>kApplication</b> and can change very rarely. </p>
+
+ <p><b><i>Path to Base Application Class file</i></b> - default value is <b>/core/kernel/application.php</b> and can change very rarely.</p>
+
+ <p><b><i>Output Caching Engine</i></b> - provides ability to cache HTML output or other data using various caching engines to
+ lower the database load. The default value is set to <b>None</b> if no available engines detected. Available options are:
+ None (Fake), Memcached (Memcache), XCache (XCache) and Alternative PHP Cache (Apc).
+ Note that only auto-detected caching engines will be available for selection.</p>
+
+ <p><b><i>Location of Memcache Servers</i></b> - host or IP address with port where Memcached Server is running.
+ Multiple locations of can be listed separated by semi-colon (;). For example, 192.168.1.1:1121;192.168.1.2:1121;192.168.1.3:1121 .</p>
+
+ <p><b><i>CSS/JS Compression Engine</i></b> - provides <a href="http://en.wikipedia.org/wiki/Minification_(programming)">minification</a>
+ functionality for CSS / Javascript files. The default value is set to <b>PHP-based</b> if no Java is auto-detected on server-side.
+ Available options are: None (empty), YUICompressor (Java) (yui) and PHP-based (php) .</p>
+
+ <br/>
+ ]]>
+ </step>
<step name="select_theme" title="Select Default Theme">
<![CDATA[<p>Selected theme will be used as a default in your In-Portal website.</p>
<p>You can manage your themes in Admin Console under Configuration -> Website -> Themes section.</p>
@@ -160,9 +207,4 @@
The characters entered in this field are placed <i>before</i> the names of the tables used by In-Portal.
For example, if you enter "inp_" into the prefix field, the table named Category will be named inp_Category.</p>]]>
</step>
- <step name="fix_paths" title="Update Installation Paths">
- <![CDATA[The <i>Fix Paths</i> option should be used when the location of the In-Portal files has changed.
- 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.]]>
- </step>
</steps>
\ No newline at end of file
|