mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=12223
This commit is contained in:
parent
cb8a8bec0d
commit
9e0b73e9d3
|
@ -2438,3 +2438,17 @@ Charlie 13 Mar 2007
|
|||
gui_rpc_server_ops.C
|
||||
clientgui/
|
||||
ViewProjectsGrid.cpp
|
||||
|
||||
Matt 14 Mar 2007
|
||||
- updated db_init and db_init_aux code in util.inc, db.inc to enable
|
||||
possible use of replica (i.e. read-only) database (for pages that
|
||||
lookup stats, print profiles, etc. but don't make any updates).
|
||||
Implemented in top_{users,teams,hosts}.php
|
||||
|
||||
html/inc
|
||||
db.inc
|
||||
util.inc
|
||||
html/user
|
||||
top_users.php
|
||||
top_hosts.php
|
||||
top_teams.php
|
||||
|
|
|
@ -5,11 +5,17 @@ require_once('../inc/util.inc');
|
|||
// database-related functions.
|
||||
// Presentation code (HTML) shouldn't be here
|
||||
|
||||
function db_init_aux() {
|
||||
function db_init_aux($try_replica=false) {
|
||||
$config = get_config();
|
||||
$user = parse_config($config, "<db_user>");
|
||||
$pass = parse_config($config, "<db_passwd>");
|
||||
$host = parse_config($config, "<db_host>");
|
||||
$host = null;
|
||||
if ($try_replica == true) {
|
||||
$host = parse_config($config, "<replica_db_host>");
|
||||
}
|
||||
if ($host == null) {
|
||||
$host = parse_config($config, "<db_host>");
|
||||
}
|
||||
if ($host == null) {
|
||||
$host = "localhost";
|
||||
}
|
||||
|
|
|
@ -8,7 +8,13 @@ require_once("../inc/translation.inc");
|
|||
|
||||
$generating_xml = false;
|
||||
|
||||
function db_init() {
|
||||
// db_init
|
||||
// Connects to database server and selects database as noted in config.xml
|
||||
// (Or, in some cases, if only read-only access is necessary, tries instead
|
||||
// to connect to replica database server noted in <replica_db_host> tag. If
|
||||
// this tag doesn't exist, db_init will revert to connecting to <db_host>.)
|
||||
//
|
||||
function db_init($try_replica=false) {
|
||||
if (web_stopped()) {
|
||||
page_head("Not available");
|
||||
echo "This page requires database access.
|
||||
|
@ -18,7 +24,7 @@ function db_init() {
|
|||
page_tail();
|
||||
exit();
|
||||
}
|
||||
$retval = db_init_aux();
|
||||
$retval = db_init_aux($try_replica);
|
||||
if ($retval == 1) {
|
||||
echo "Unable to connect to database - please try again later\n";
|
||||
echo "Error: ", mysql_errno(), mysql_error();
|
||||
|
|
|
@ -28,7 +28,7 @@ if ($offset < 1000) {
|
|||
require_once("../inc/db.inc");
|
||||
require_once("../inc/host.inc");
|
||||
|
||||
db_init();
|
||||
db_init(true);
|
||||
page_head("Top computers");
|
||||
if ($sort_by == "total_credit") {
|
||||
$sort_clause = "total_credit desc";
|
||||
|
|
|
@ -62,7 +62,7 @@ if ($offset < ITEM_LIMIT) {
|
|||
if ($cacheddata){ //If we have got the data in cache
|
||||
$data = store_to_teams($cacheddata); // use the cached data
|
||||
} else { //if not do queries etc to generate new data
|
||||
db_init();
|
||||
db_init(true);
|
||||
$data = get_top_teams($offset,$sort_by,$type);
|
||||
|
||||
// We need to calculate nusers before storing into the cache
|
||||
|
|
|
@ -45,7 +45,7 @@ if ($offset < ITEM_LIMIT) {
|
|||
if ($cacheddata){ //If we have got the data in cache
|
||||
$data = store_to_participants($cacheddata); // use the cached data
|
||||
} else { //if not do queries etc to generate new data
|
||||
db_init();
|
||||
db_init(true);
|
||||
$data = get_top_participants($offset,$sort_by);
|
||||
set_cache_data(participants_to_store($data),$cache_args); //save data in cache
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue