diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index c09a04e8709..fcf68096e6b 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -121,6 +121,25 @@ if (! defined('NOREQUIREDB')) if ($db->error) { + // If we were into a website context + if (! defined('USEDOLIBARREDITOR') && ! defined('USEDOLIBARRSERVER') && ! empty($_SERVER['SCRIPT_FILENAME']) && (strpos($_SERVER['SCRIPT_FILENAME'], DOL_DATA_ROOT.'/website') === 0)) + { + $sapi_type = php_sapi_name(); + if (substr($sapi_type, 0, 3) != 'cgi') http_response_code(503); // To tel search engine this is a temporary error + print '
'; + if (is_object($langs)) + { + $langs->setDefaultLang('auto'); + $langs->load("website"); + print $langs->trans("SorryWebsiteIsCurrentlyOffLine"); + } + else + { + print "SorryWebsiteIsCurrentlyOffLine"; + } + print '
'; + exit; + } dol_print_error($db, "host=".$conf->db->host.", port=".$conf->db->port.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error); exit; }