mirror of https://github.com/BOINC/boinc.git
- web: the logic for using read-only DB replicas was messed up
svn path=/trunk/boinc/; revision=18182
This commit is contained in:
parent
4281c90098
commit
c21a37e77a
|
@ -4680,3 +4680,9 @@ Rom 20 May 2009
|
|||
|
||||
lib/
|
||||
stackwalker_win.cpp
|
||||
|
||||
David 20 May 2009
|
||||
- web: the logic for using read-only DB replicas was messed up
|
||||
|
||||
html/inc/
|
||||
boinc_db.inc
|
||||
|
|
|
@ -23,6 +23,10 @@ class BoincDb extends DbConn {
|
|||
static $instance;
|
||||
|
||||
// connect to the database (possibly to a read-only replica)
|
||||
// NOTE: choice of replica can be made only at the page level.
|
||||
// If there's a page that's guaranteed to do only reads, put
|
||||
// BoincDb::get(true);
|
||||
// at the top of it.
|
||||
//
|
||||
static function get_aux($readonly) {
|
||||
$config = get_config();
|
||||
|
@ -37,13 +41,17 @@ class BoincDb extends DbConn {
|
|||
$instance = new DbConn();
|
||||
if ($readonly && $replica_host) {
|
||||
$retval = $instance->init_conn($user, $passwd, $replica_host, $name);
|
||||
if ($retval) return $instance;
|
||||
if ($retval) {
|
||||
self::$instance = $instance;
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
$retval = $instance->init_conn($user, $passwd, $host, $name);
|
||||
if (!$retval) {
|
||||
$instance = null;
|
||||
} else {
|
||||
$instance->do_query("use $name");
|
||||
// needed for places where we do direct queries
|
||||
}
|
||||
self::$instance = $instance;
|
||||
return $instance;
|
||||
|
|
Loading…
Reference in New Issue