summaryrefslogtreecommitdiff
path: root/installer
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2013-06-28 22:27:59 +0200
committerThomas Bruederli <thomas@roundcube.net>2013-06-28 22:27:59 +0200
commit9bacb2cd3f7e8f96a29f651460954965c400aac6 (patch)
tree73ce71706da010ef337b23fd53afc296e4675f17 /installer
parent0f39b4f4cdd60f4af5f85d656ed08698e86287ea (diff)
Prepare config migration:
- Show warning in installer and hints how to migrate - Let update.sh create the new config file if legacy config is detected - Provide a sample config file for manual configuration - Define a list of options which always should be written to local config
Diffstat (limited to 'installer')
-rw-r--r--installer/config.php13
-rw-r--r--installer/index.php12
-rw-r--r--installer/rcube_install.php7
3 files changed, 25 insertions, 7 deletions
diff --git a/installer/config.php b/installer/config.php
index acdd4ffd1..f990fc23f 100644
--- a/installer/config.php
+++ b/installer/config.php
@@ -24,10 +24,15 @@ $RCI->bool_config_props = array(
$_SESSION['allowinstaller'] = true;
if (!empty($_POST['submit'])) {
- echo '<p class="notice">Copy or download the following configuration and save';
- echo ' as <tt><b>config.inc.php</b></tt> within the <tt>'.RCMAIL_CONFIG_DIR.'</tt> directory of your Roundcube installation.<br/>';
+ echo '<p class="notice">Copy or download the following configuration and save it';
+ echo ' as <tt><b>config.inc.php</b></tt> within the <tt>'.RCUBE_CONFIG_DIR.'</tt> directory of your Roundcube installation.<br/>';
echo ' Make sure that there are no characters outside the <tt>&lt;?php ?&gt;</tt> brackets when saving the file.';
- echo '&nbsp;<input type="button" onclick="location.href=\'index.php?_getconfig=1\'" value="Download" /></p>';
+ echo '&nbsp;<input type="button" onclick="location.href=\'index.php?_getconfig=1\'" value="Download" />';
+ if ($RCI->legacy_config) {
+ echo '<br/><br/>Afterwards, please <b>remove</b> the old configuration files <tt>main.inc.php</tt> and <tt>db.inc.php</tt>';
+ echo ' from the config directory.';
+ }
+ echo '</p>';
$textbox = new html_textarea(array('rows' => 16, 'cols' => 60, 'class' => "configfile"));
echo $textbox->show(($_SESSION['config'] = $RCI->create_config()));
@@ -640,7 +645,7 @@ $select_param_folding->add('Full RFC 2231 (Roundcube, Thunderbird)', '0');
$select_param_folding->add('RFC 2047/2231 (MS Outlook, OE)', '1');
$select_param_folding->add('Full RFC 2047 (deprecated)', '2');
-echo $select_param_folding->show(intval($RCI->getprop('mime_param_folding')));
+echo $select_param_folding->show(strval($RCI->getprop('mime_param_folding')));
?>
<div>How to encode attachment long/non-ascii names</div>
diff --git a/installer/index.php b/installer/index.php
index 4e4a04326..dc4c0a43f 100644
--- a/installer/index.php
+++ b/installer/index.php
@@ -121,8 +121,16 @@ if ($RCI->configured && empty($_REQUEST['_step'])) {
// exit if installation is complete
if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) {
// header("HTTP/1.0 404 Not Found");
- echo '<h2 class="error">The installer is disabled!</h2>';
- echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/config.inc.php</p>';
+ if ($RCI->configured && $RCI->legacy_config) {
+ echo '<h2 class="error">Your configuration needs to be migrated!</h2>';
+ echo '<p>We changed the configuration files structure and your installation needs to be updated accordingly.</p>';
+ echo '<p>Please run the <tt>bin/update.sh</tt> script from the command line or set <p>&nbsp; <tt>$rcmail_config[\'enable_installer\'] = true;</tt></p>';
+ echo ' in your RCUBE_CONFIG_DIR/main.inc.php to let the installer help you migrating it.</p>';
+ }
+ else {
+ echo '<h2 class="error">The installer is disabled!</h2>';
+ echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/config.inc.php</p>';
+ }
echo '</div></body></html>';
exit;
}
diff --git a/installer/rcube_install.php b/installer/rcube_install.php
index 5d766f4d0..06622de4d 100644
--- a/installer/rcube_install.php
+++ b/installer/rcube_install.php
@@ -28,10 +28,12 @@ class rcube_install
var $failures = 0;
var $config = array();
var $configured = false;
+ var $legacy_config = false;
var $last_error = null;
var $email_pattern = '([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9])';
var $bool_config_props = array();
+ var $local_config = array('db_dsnw', 'default_host', 'support_url', 'des_key', 'plugins');
var $obsolete_config = array('db_backend', 'double_auth');
var $replaced_config = array(
'skin_path' => 'skin',
@@ -157,6 +159,9 @@ class rcube_install
$is_default = !isset($_POST["_$prop"]);
$value = !$is_default || $this->bool_config_props[$prop] ? $_POST["_$prop"] : $default;
+ if ($prop == 'enable_installer')
+ $value = false;
+
// convert some form data
if ($prop == 'debug_level' && !$is_default) {
if (is_array($value)) {
@@ -211,7 +216,7 @@ class rcube_install
}
// skip this property
- if (!array_key_exists($prop, $this->defaults) || ($value == $this->defaults[$prop])) {
+ if ((!array_key_exists($prop, $this->defaults) || ($value == $this->defaults[$prop])) && !in_array($prop, $this->local_config)) {
continue;
}