removed DEBUG_MODE

This commit is contained in:
printempw 2016-03-26 19:05:09 +08:00
parent 9da56ee94f
commit 5b18a3e236
3 changed files with 10 additions and 8 deletions

View File

@ -25,9 +25,6 @@ define('DB_PREFIX', '');
/* 盐,用于 token 加密,修改为任意随机字符串 */
define('SALT', '9tvsE+1._%R4@VLaX(I|.U+h_d*s');
/* 调试模式,开启后将会显示所有错误提示 */
define('DEBUG_MODE', false);
/* 好了!请不要再继续编辑。请保存本文件。使用愉快! */
/* Blessing Skin Server 项目根目录 */

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-02-02 21:59:06
* @Last Modified by: printempw
* @Last Modified time: 2016-03-19 11:25:11
* @Last Modified time: 2016-03-26 19:04:39
*/
namespace Database;
@ -21,10 +21,15 @@ class Database implements EncryptInterface, SyncInterface
$this->connection = self::checkConfig();
}
public static function checkConfig() {
if (!DEBUG_MODE) error_reporting(0);
function __destruct() {
$this->connection->close();
}
public static function checkConfig() {
// use error control to hide shitty connect warnings
error_reporting(0);
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, DB_PORT);
error_reporting(E_ALL ^ E_NOTICE);
if ($conn->connect_error)
Utils::showErrorPage($conn->connect_errno,
@ -33,6 +38,7 @@ class Database implements EncryptInterface, SyncInterface
Utils::showErrorPage(-1, "数据库中不存在 ".DB_PREFIX."users 或 ".DB_PREFIX."options 表。请先运行 /admin/install.php 进行安装。");
if (!is_dir(BASE_DIR."/textures/"))
Utils::showErrorPage(-1, "textures 文件夹不存在。请先运行 /admin/install.php 进行安装,或者手动放置一个。");
$conn->query("SET names 'utf8'");
return $conn;
}

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-02-02 21:17:59
* @Last Modified by: printempw
* @Last Modified time: 2016-03-26 18:49:15
* @Last Modified time: 2016-03-26 18:53:05
*/
function __autoload($classname) {
@ -16,4 +16,3 @@ function __autoload($classname) {
if (!file_exists($dir.'/config.php'))
Utils::showErrorPage(-1, '未找到 `config.php`,请确认配置文件是否存在。');
require "$dir/config.php";
if (!DEBUG_MODE) error_reporting(0);