summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/index.php b/index.php
index 21d5ed275..fad626646 100644
--- a/index.php
+++ b/index.php
@@ -34,6 +34,16 @@ if (file_exists($actionfile)) {
require_once($actionfile);
$action_class = ucfirst($action)."Action";
$action_obj = new $action_class();
+ if ($config['db']['mirror'] && $action_obj->is_readonly()) {
+ if (is_array($config['db']['mirror'])) {
+ # "load balancing", ha ha
+ $k = array_rand($config['db']['mirror']);
+ $mirror = $config['db']['mirror'][$k];
+ } else {
+ $mirror = $config['db']['mirror'];
+ }
+ $config['db']['database'] = $mirror;
+ }
call_user_func(array($action_obj, 'handle'), $_REQUEST);
} else {
common_user_error(_('Unknown action'));