commit a3d2dd79bdda2f3d5986736d5b67a5c73bcff6b0
parent 24d749fab2174274c1defa5129087501b4f63872
Author: Felicitus <felicitus@felicitus.org>
Date: Fri, 23 Dec 2011 05:35:56 +0100
Bugfix for old-style configuration key "hostname"
Diffstat:
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/config.php.template b/config.php.template
@@ -16,7 +16,7 @@ Configuration::setOption("partkeepr.database.password", "partkeepr");
/**
* Specifies the hostname for the database
*/
-Configuration::setOption("partkeepr.database.hostname", "localhost");
+Configuration::setOption("partkeepr.database.host", "localhost");
/**
* Specifies the database name
@@ -114,4 +114,4 @@ Configuration::setOption("partkeepr.frontend.debug", false);
/**
* Specifies if password changing is allowed.
*/
-Configuration::setOption("partkeepr.frontend.allow_password_change", true);-
\ No newline at end of file
+Configuration::setOption("partkeepr.frontend.allow_password_change", true);
diff --git a/src/backend/de/RaumZeitLabor/PartKeepr/PartKeepr.php b/src/backend/de/RaumZeitLabor/PartKeepr/PartKeepr.php
@@ -146,7 +146,16 @@ class PartKeepr {
$connectionOptions["dbname"] = PartKeeprConfiguration::getOption("partkeepr.database.dbname", "partkeepr");
$connectionOptions["user"] = PartKeeprConfiguration::getOption("partkeepr.database.username", "partkeepr");
$connectionOptions["password"] = PartKeeprConfiguration::getOption("partkeepr.database.password", "partkeepr");
- $connectionOptions["host"] = PartKeeprConfiguration::getOption("partkeepr.database.host", "localhost");
+
+ /**
+ * Compatibility with older configuration files. We check for the key "hostname" as well as "host".
+ */
+ if (PartKeeprConfiguration::getOption("partkeepr.database.hostname", null) !== null) {
+ $connectionOptions["host"] = PartKeeprConfiguration::getOption("partkeepr.database.hostname");
+ } else {
+ $connectionOptions["host"] = PartKeeprConfiguration::getOption("partkeepr.database.host", "localhost");
+ }
+
if (PartKeeprConfiguration::getOption("partkeepr.database.port") !== null) {
$connectionOptions["port"] = PartKeeprConfiguration::getOption("partkeepr.database.port");
diff --git a/src/backend/de/RaumZeitLabor/PartKeepr/Setup/Setup.php b/src/backend/de/RaumZeitLabor/PartKeepr/Setup/Setup.php
@@ -132,7 +132,7 @@ class Setup {
PartKeeprConfiguration::setOption("partkeepr.database.dbname", $_REQUEST["dbname"]);
PartKeeprConfiguration::setOption("partkeepr.database.username", $_REQUEST["user"]);
PartKeeprConfiguration::setOption("partkeepr.database.password", $_REQUEST["password"]);
- PartKeeprConfiguration::setOption("partkeepr.database.hostname", $_REQUEST["host"]);
+ PartKeeprConfiguration::setOption("partkeepr.database.host", $_REQUEST["host"]);
if (isset($_REQUEST['port'])) {
PartKeeprConfiguration::setOption("partkeepr.database.mysql_port", $_REQUEST["port"]);