Hide errors in production.

This commit is contained in:
flash 2022-07-05 13:28:28 +00:00
parent 96a83b98fb
commit 8109bc2892
3 changed files with 11 additions and 4 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@
.DS_Store .DS_Store
/config/config-db.php /config/config-db.php
/public/robots.txt /public/robots.txt
/.debug

View file

@ -8,6 +8,16 @@
*/ */
define('AJAX_CHAT_PATH', __DIR__); define('AJAX_CHAT_PATH', __DIR__);
define('AJAX_CHAT_DEBUG', is_file(AJAX_CHAT_PATH . '/.debug'));
// Only show errors in debug mode:
if(AJAX_CHAT_DEBUG) {
ini_set('display_errors', 'on');
error_reporting(-1);
} else {
ini_set('display_errors', 'off');
error_reporting(0);
}
// Include Class libraries: // Include Class libraries:
require_once AJAX_CHAT_PATH . '/src/AJAXChat.php'; require_once AJAX_CHAT_PATH . '/src/AJAXChat.php';

View file

@ -7,10 +7,6 @@
* @link https://blueimp.net/ajax/ * @link https://blueimp.net/ajax/
*/ */
// Show all errors:
ini_set('display_errors', 'On');
error_reporting(-1);
// Include Class libraries: // Include Class libraries:
require_once __DIR__ . '/../ajaxchat.php'; require_once __DIR__ . '/../ajaxchat.php';