From 461a30d771edd8bc6606f2c92dfde363514b93b1 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak
Date: Fri, 14 Jun 2013 12:09:08 +0200
Subject: Merge config files (#1487311). Now we have defaults.inc.php and
config.inc.php. Renamed $rcmail_config to $config. Old naming and old files
are supported for backward compatibility.
---
bin/update.sh | 47 +++++++++++++++++++----------------------------
1 file changed, 19 insertions(+), 28 deletions(-)
(limited to 'bin/update.sh')
diff --git a/bin/update.sh b/bin/update.sh
index 05956b933..1a6fbd32d 100755
--- a/bin/update.sh
+++ b/bin/update.sh
@@ -45,23 +45,11 @@ $RCI->load_config();
if ($RCI->configured) {
$success = true;
-
+
if ($messages = $RCI->check_config()) {
$success = false;
$err = 0;
- // list missing config options
- if (is_array($messages['missing'])) {
- echo "WARNING: Missing config options:\n";
- echo "(These config options should be present in the current configuration)\n";
-
- foreach ($messages['missing'] as $msg) {
- echo "- '" . $msg['prop'] . ($msg['name'] ? "': " . $msg['name'] : "'") . "\n";
- $err++;
- }
- echo "\n";
- }
-
// list old/replaced config options
if (is_array($messages['replaced'])) {
echo "WARNING: Replaced config options:\n";
@@ -93,24 +81,27 @@ if ($RCI->configured) {
// positive: let's merge the local config with the defaults
if (strtolower($input) == 'y') {
- $copy1 = $copy2 = $write1 = $write2 = false;
-
+ $error = $writed = false;
+
// backup current config
- echo ". backing up the current config files...\n";
- $copy1 = copy(RCMAIL_CONFIG_DIR . '/main.inc.php', RCMAIL_CONFIG_DIR . '/main.old.php');
- $copy2 = copy(RCMAIL_CONFIG_DIR . '/db.inc.php', RCMAIL_CONFIG_DIR . '/db.old.php');
-
- if ($copy1 && $copy2) {
+ echo ". backing up the current config file(s)...\n";
+
+ foreach (array('config', 'main', 'db') as $file) {
+ if (file_exists(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php'))
+ if (!copy(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php', RCMAIL_CONFIG_DIR . '/' . $file . '.old.php')) {
+ $error = true;
+ }
+ }
+ }
+
+ if (!$error) {
$RCI->merge_config();
-
- echo ". writing " . RCMAIL_CONFIG_DIR . "/main.inc.php...\n";
- $write1 = file_put_contents(RCMAIL_CONFIG_DIR . '/main.inc.php', $RCI->create_config('main', true));
- echo ". writing " . RCMAIL_CONFIG_DIR . "/main.db.php...\n";
- $write2 = file_put_contents(RCMAIL_CONFIG_DIR . '/db.inc.php', $RCI->create_config('db', true));
+ echo ". writing " . RCMAIL_CONFIG_DIR . "/config.inc.php...\n";
+ $writed = file_put_contents(RCMAIL_CONFIG_DIR . '/config.inc.php', $RCI->create_config());
}
-
+
// Success!
- if ($write1 && $write2) {
+ if ($writed) {
echo "Done.\n";
echo "Your configuration files are now up-to-date!\n";
@@ -121,7 +112,7 @@ if ($RCI->configured) {
}
}
else {
- echo "Failed to write config files!\n";
+ echo "Failed to write config file(s)!\n";
echo "Grant write privileges to the current user or update the files manually according to the above messages.\n";
}
}
--
cgit v1.2.3
From 9bacb2cd3f7e8f96a29f651460954965c400aac6 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli
Date: Fri, 28 Jun 2013 22:27:59 +0200
Subject: 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
---
INSTALL | 11 +++---
bin/update.sh | 30 +++++++++++-----
config/config.inc.php.sample | 85 ++++++++++++++++++++++++++++++++++++++++++++
config/defaults.inc.php | 12 +++----
installer/config.php | 13 ++++---
installer/index.php | 12 +++++--
installer/rcube_install.php | 7 +++-
7 files changed, 144 insertions(+), 26 deletions(-)
create mode 100644 config/config.inc.php.sample
(limited to 'bin/update.sh')
diff --git a/INSTALL b/INSTALL
index 4573c55af..b80d3323b 100644
--- a/INSTALL
+++ b/INSTALL
@@ -141,10 +141,13 @@ Best solution is to install a cronjob running this script daily.
MANUAL CONFIGURATION
====================
-First of all, rename the files config/*.inc.php.dist to config/*.inc.php.
-You can then change these files according to your environment and your needs.
-Details about the config parameters can be found in the config files.
-See http://trac.roundcube.net/wiki/Howto_Install for even more guidance.
+First of all, copy the sample configuration file config/config.inc.php.sample
+to config/config.inc.php and make the necessary adjustments according to your
+environment and your needs. More configuration options can be copied from the
+config/defaults.inc.php file into your local config.inc.php file as needed.
+Read the comments above the individual configuration options to find out what
+they do or read http://trac.roundcube.net/wiki/Howto_Install for even more
+guidance.
You can also modify the default .htaccess file. This is necessary to
increase the allowed size of file attachments, for example:
diff --git a/bin/update.sh b/bin/update.sh
index 1a6fbd32d..b5000bbe5 100755
--- a/bin/update.sh
+++ b/bin/update.sh
@@ -36,17 +36,17 @@ if (!$opts['version']) {
$opts['version'] = RCMAIL_VERSION;
}
-if ($opts['version'] && version_compare(version_parse($opts['version']), version_parse(RCMAIL_VERSION), '>='))
- die("Nothing to be done here. Bye!\n");
-
-
$RCI = rcube_install::get_instance();
$RCI->load_config();
+if ($opts['version'] && version_compare(version_parse($opts['version']), version_parse(RCMAIL_VERSION), '>=') && !$RCI->legacy_config)
+ die("Nothing to be done here. Bye!\n");
+
+
if ($RCI->configured) {
$success = true;
- if ($messages = $RCI->check_config()) {
+ if (($messages = $RCI->check_config()) || $RCI->legacy_config) {
$success = false;
$err = 0;
@@ -74,6 +74,12 @@ if ($RCI->configured) {
echo "\n";
}
+ if (!$err && $RCI->legacy_config) {
+ echo "WARNING: Your configuration needs to be migrated!\n";
+ echo "We changed the configuration files structure and your two config files main.inc.php and db.inc.php have to be merged into one single file.\n";
+ $err++;
+ }
+
// ask user to update config files
if ($err) {
echo "Do you want me to fix your local configuration? (y/N)\n";
@@ -81,13 +87,13 @@ if ($RCI->configured) {
// positive: let's merge the local config with the defaults
if (strtolower($input) == 'y') {
- $error = $writed = false;
+ $error = $written = false;
// backup current config
echo ". backing up the current config file(s)...\n";
foreach (array('config', 'main', 'db') as $file) {
- if (file_exists(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php'))
+ if (file_exists(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php')) {
if (!copy(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php', RCMAIL_CONFIG_DIR . '/' . $file . '.old.php')) {
$error = true;
}
@@ -97,11 +103,11 @@ if ($RCI->configured) {
if (!$error) {
$RCI->merge_config();
echo ". writing " . RCMAIL_CONFIG_DIR . "/config.inc.php...\n";
- $writed = file_put_contents(RCMAIL_CONFIG_DIR . '/config.inc.php', $RCI->create_config());
+ $written = file_put_contents(RCMAIL_CONFIG_DIR . '/config.inc.php', $RCI->create_config());
}
// Success!
- if ($writed) {
+ if ($written) {
echo "Done.\n";
echo "Your configuration files are now up-to-date!\n";
@@ -110,6 +116,12 @@ if ($RCI->configured) {
foreach ($messages['missing'] as $msg)
echo "- '" . $msg['prop'] . ($msg['name'] ? "': " . $msg['name'] : "'") . "\n";
}
+
+ if ($RCI->legacy_config) {
+ foreach (array('main', 'db') as $file) {
+ @unlink(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php');
+ }
+ }
}
else {
echo "Failed to write config file(s)!\n";
diff --git a/config/config.inc.php.sample b/config/config.inc.php.sample
new file mode 100644
index 000000000..22a269460
--- /dev/null
+++ b/config/config.inc.php.sample
@@ -0,0 +1,85 @@
+bool_config_props = array(
$_SESSION['allowinstaller'] = true;
if (!empty($_POST['submit'])) {
- echo '
Copy or download the following configuration and save';
- echo ' as config.inc.php within the '.RCMAIL_CONFIG_DIR.' directory of your Roundcube installation. ';
+ echo '
Copy or download the following configuration and save it';
+ echo ' as config.inc.php within the '.RCUBE_CONFIG_DIR.' directory of your Roundcube installation. ';
echo ' Make sure that there are no characters outside the <?php ?> brackets when saving the file.';
- echo '