- web: don't check for the stop_web file in BoincDb::get().

That forces that file to include a bunch of unnecessary stuff.
    Do the check at a higher level.

svn path=/trunk/boinc/; revision=15532
This commit is contained in:
David Anderson 2008-07-01 22:11:28 +00:00
parent 6e802a386d
commit 2d6d4110ea
4 changed files with 49 additions and 42 deletions

View File

@ -5322,3 +5322,14 @@ Eric 1 July 2008
parse.h
procinfo_unix.C
David 1 July 2008
- web: don't check for the stop_web file in BoincDb::get().
That forces that file to include a bunch of unnecessary stuff.
Do the check at a higher level.
html/
inc/
boinc_db.inc
util.inc
user/
forum_index.php

View File

@ -7,14 +7,6 @@ class BoincDb extends DbConn {
static $instance;
static function get($readonly = false) {
global $generating_xml;
if (web_stopped()) {
if ($generating_xml) {
xml_error(-183);
} else {
db_maintenance();
}
}
if (!isset($instance)) {
$config = get_config();
$user = parse_config($config, '<db_user>');

View File

@ -6,7 +6,6 @@ require_once("../inc/countries.inc");
require_once("../inc/db.inc");
require_once("../inc/boinc_db.inc");
require_once("../inc/translation.inc");
require_once("../inc/forum.inc");
require_once("../inc/profile.inc");
ini_set("memory_limit", "64M");
@ -15,38 +14,6 @@ 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()) {
db_maintenance();
}
$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();
exit();
}
if ($retval == 2) {
echo "Unable to select database - please try again later";
echo mysql_error();
exit();
}
return 0;
}
function send_cookie($name, $value, $permanent, $ops=false) {
// the following allows independent login for projects on the same server
//
@ -717,6 +684,44 @@ function show_image($src, $title, $alt, $height=null) {
echo "<img border=0 title=\"$title\" alt=\"$alt\" src=\"$src\" $h>";
}
function check_web_stopped() {
global $generating_xml;
if (web_stopped()) {
if ($generating_xml) {
xml_error(-183);
} else {
//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.
// DEPRECATED - use boinc_db.h
//
function db_init($try_replica=false) {
check_web_stopped();
$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();
exit();
}
if ($retval == 2) {
echo "Unable to select database - please try again later";
echo mysql_error();
exit();
}
return 0;
}
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
?>

View File

@ -7,7 +7,6 @@ require_once('../inc/forum.inc');
require_once('../inc/pm.inc');
require_once('../inc/time.inc');
$user = get_logged_in_user(false);
// Process request to mark all posts as read