- web: shuffle code to eliminate redundancy

svn path=/trunk/boinc/; revision=15419
This commit is contained in:
David Anderson 2008-06-17 17:38:02 +00:00
parent 7678669df5
commit bfa6747467
4 changed files with 23 additions and 17 deletions

View File

@ -4888,9 +4888,17 @@ David 16 June 2008
client/
client_state.C
David 16 June 2008
David 17 June 2008
- scheduler: if host.n_bwdown is zero, skip the bandwidth check;
the host hasn't been measured yet.
sched/
sched_send.C
David 17 June 2008
- web: shuffle code to eliminate redundancy
html/inc/
boinc_db.inc
bossa_db.inc
util.inc

View File

@ -1,7 +1,7 @@
<?php
require_once("../inc/db_conn.inc");
require_once("../inc/util_basic.inc");
require_once("../inc/util.inc");
class BoincDb extends DbConn {
static $instance;
@ -12,14 +12,8 @@ class BoincDb extends DbConn {
if ($generating_xml) {
xml_error(-183);
} else {
show_page(
"Page not available",
"This page requires database access.
Our database server is temporarily shut down for maintenance.
Please try again later."
);
db_maintenance();
}
exit();
}
if (!isset($instance)) {
$config = get_config();

View File

@ -1,7 +1,7 @@
<?php
require_once("../inc/db_conn.inc");
require_once("../inc/util.inc");
require_once("../inc/util_basic.inc");
define ('VALIDATE_STATE_INIT', 0);
define ('VALIDATE_STATE_VALID', 1);

View File

@ -15,19 +15,23 @@ date_default_timezone_set("UTC");
$generating_xml = false;
$caching = false;
function db_maintenance() {
page_head("Not available");
echo "This page requires database access.
Our database server is temporarily shut down for maintenance.
Please try again later.
";
page_tail();
exit();
}
// Connects to database server and selects database as noted in config.xml
// If only read-only access is necessary,
// tries instead to connect to <replica_db_host> if tag exists.
//
function db_init($try_replica=false) {
if (web_stopped()) {
page_head("Not available");
echo "This page requires database access.
Our database server is temporarily shut down for maintenance.
Please try again later.
";
page_tail();
exit();
db_maintenance();
}
$retval = db_init_aux($try_replica);
if ($retval == 1) {