- Added master failover database config option.

This commit is contained in:
JT Smith 2007-03-14 04:10:03 +00:00
parent f8c0cb1041
commit 98331a137e
3 changed files with 19 additions and 0 deletions

View file

@ -14,6 +14,7 @@
date.
- fix: 7.4 Editing SQL Form seems to break site ...?
- rfe: Export & files
- Added master failover database config option.
- URLs that would have been created like page.html/article.html are now
created like page/article.html to make them look more realistic.
- fix: Fixing bad link on the Event page to the search engine. Added a new

View file

@ -146,6 +146,19 @@
# "pass" : "password"
# },
# You can configure a backup master database as a failover in case
# your primary database goes down. WebGUI will use this database until
# the original becomes available. However, this does nothing to change
# the settings of your database. If it was set up as a slave until the
# master went down, then some script will have to be written to convert
# it from a slave to a master.
# "failoverdb" : {
# "dsn" : "DBI:mysql:www_example_com;host=failover.example.com;port=3306",
# "user" : "webgui",
# "password" : "password"
# },
# Set this value if you wish to override all outbound emails to a specific
# user for testing purposes.

View file

@ -173,6 +173,11 @@ sub db {
my $skipFatal = shift;
unless (exists $self->{_db}) {
my $db = WebGUI::SQL->connect($self,$self->config->get("dsn"), $self->config->get("dbuser"), $self->config->get("dbpass"));
if (!defined $db && defined $self->config->get("failoverdb")) {
$self->errorHandler->warn("Main DB down, resorting to using failover.");
my $failover = $self->config->get("failoverdb");
$db = WebGUI::SQL->connect($self,$failover->{dsn}, $failover->{user}, $failover->{password});
}
if (defined $db) {
$self->{_db} = $db;
}