web: always show "Project down" page if project is in fact down

... and show this with the project banner and footer.
This is a bit tricky.
This commit is contained in:
David Anderson 2018-01-23 15:54:07 -08:00
parent 12c5b4e8af
commit 8101ce638e
2 changed files with 18 additions and 21 deletions

View File

@ -127,10 +127,7 @@ class BoincDb extends DbConn {
if ($generating_xml) {
xml_error(-183, "project down for maintenance");
} else {
show_page("Project down for maintenance",
"Please check back in a few hours."
);
exit;
show_project_down();
}
}
self::get_aux($readonly, $fallback_mode);
@ -138,12 +135,7 @@ class BoincDb extends DbConn {
if ($generating_xml) {
xml_error(-138, "the project's database server is down");
} else {
show_page(
"Project is down",
"The project's database server is down.
Please check back in a few hours."
);
exit;
show_project_down();
}
}
}

View File

@ -303,7 +303,7 @@ function page_head(
break;
}
project_banner($title, $url_prefix, $is_main);
check_web_stopped();
}
}
@ -874,21 +874,26 @@ function show_image($src, $title, $alt, $height=null) {
echo "<img class=\"icon\" border=\"0\" title=\"$title\" alt=\"$alt\" src=\"$src\" $h>";
}
function show_project_down() {
global $did_page_head;
if (!$did_page_head) {
page_head(tra("Project down for maintenance"));
}
echo tra(
"%1 is temporarily shut down for maintenance. Please try again later.",
PROJECT
);
page_tail();
exit();
}
function check_web_stopped() {
global $generating_xml, $did_page_head;
global $generating_xml;
if (web_stopped()) {
if ($generating_xml) {
xml_error(-183);
} else {
if (!$did_page_head) {
page_head(tra("Project down for maintenance"));
}
echo tra(
"%1 is temporarily shut down for maintenance. Please try again later.",
PROJECT
);
page_tail();
exit();
show_project_down();
}
}
}