From 8101ce638eb51145c28fe3425d06d759481384af Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 23 Jan 2018 15:54:07 -0800 Subject: [PATCH] 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. --- html/inc/boinc_db.inc | 12 ++---------- html/inc/util.inc | 27 ++++++++++++++++----------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/html/inc/boinc_db.inc b/html/inc/boinc_db.inc index c0d6279ed8..ea26569704 100644 --- a/html/inc/boinc_db.inc +++ b/html/inc/boinc_db.inc @@ -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(); } } } diff --git a/html/inc/util.inc b/html/inc/util.inc index 0358daa73e..cadc57e728 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -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 "\"$alt\""; } +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(); } } }