From 795976cadb7a20fbbde8725bbf84a74f98ae75da Mon Sep 17 00:00:00 2001 From: PrestaEdit Date: Sun, 14 Jul 2013 14:59:25 +0200 Subject: [PATCH] [*] FO: display Error500 if no database access Sometimes, we have some problems with the MySQL Database and a Fatal Error is done. With this, we show the error500 template. --- config/config.inc.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/config/config.inc.php b/config/config.inc.php index 637089c22..21fb9b780 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -90,7 +90,21 @@ if (!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST'])) $context = Context::getContext(); /* Initialize the current Shop */ -$context->shop = Shop::initialize(); +try +{ + $context->shop = Shop::initialize(); +} +catch(Exception $e) +{ + header('HTTP/1.1 503 temporarily overloaded'); + + define('_PS_SMARTY_DIR_', _PS_TOOL_DIR_.'smarty/'); + require_once(_PS_SMARTY_DIR_.'Smarty.class.php'); + $context->smarty = new Smarty(); + $context->smarty->display('error500.html'); + + exit; +} define('_THEME_NAME_', $context->shop->getTheme()); define('__PS_BASE_URI__', $context->shop->getBaseURI());