Permalink
Browse files

Merge pull request #239 from oddnoc/ConfigureFromEnv-timezone

API CHANGE: Enable setting the DB timezone from the environment.
  • Loading branch information...
2 parents 98604fa + ab976a9 commit b2d16fd538175d1e7b7155b4ba23555dfb16de59 @halkyon halkyon committed Mar 12, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 conf/ConfigureFromEnv.php
@@ -15,6 +15,7 @@
* - SS_DATABASE_PASSWORD: The database password (mandatory)
* - SS_DATABASE_SUFFIX: A suffix to add to the database name.
* - SS_DATABASE_PREFIX: A prefix to add to the database name.
+ * - SS_DATABASE_TIMEZONE: Set the database timezone to something other than the system timezone.
*
* There is one more setting that is intended to be used by people who work on SilverStripe.
* - SS_DATABASE_CHOOSE_NAME: Boolean/Int. If set, then the system will choose a default database name for you if one isn't give
@@ -83,7 +84,12 @@
. $database
. (defined('SS_DATABASE_SUFFIX') ? SS_DATABASE_SUFFIX : ''),
);
-
+
+ // Set the timezone if called for
+ if (defined('SS_DATABASE_TIMEZONE')) {
+ $databaseConfig['timezone'] = SS_DATABASE_TIMEZONE;
+ }
+
// For schema enabled drivers:
if(defined('SS_DATABASE_SCHEMA'))
$databaseConfig["schema"] = SS_DATABASE_SCHEMA;

0 comments on commit b2d16fd

Please sign in to comment.