diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-07-24 13:12:13 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-07-24 13:12:13 -0400 |
commit | fdc7950e3386208996b66aa87c7f291b499544fb (patch) | |
tree | 98c659f8512706f39458604bf62fa738514fd98b | |
parent | 7e6870db914d4e905fc7ae833b69404fd3ea0d3d (diff) |
use a random mirror
darcs-hash:20080724171213-84dde-4668d0e57ce1766da7df22a5372aa94466b2fae5.gz
-rw-r--r-- | index.php | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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')); |