getDB(), getRootDB()를 autoload 클래스로 변경

- 각각 DB::db(), RootDB::db()임.
This commit is contained in:
2018-03-25 00:07:37 +09:00
parent bb1a496835
commit 9e1aadf486
62 changed files with 258 additions and 269 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ if(!AppConf::getRoot()->isExists()){
}
require(__DIR__.'/../f_config/DB.php');
$rootDB = getRootDB();
$rootDB = RootDB::db();
//초기 관리자 계정은 딱 하나만 있어야하므로, 중요함.
$rootDB->query('LOCK TABLES member WRITE, member_log WRITE');
+2 -2
View File
@@ -23,7 +23,7 @@ if(!AppConf::getRoot()->isExists()){
}
require(__DIR__.'/../f_config/DB.php');
$rootDB = getRootDB();
$rootDB = RootDB::db();
$rootDB->throw_exception_on_nonsql_error = false;
$rootDB->nonsql_error_handler = 'dbConnFail';
@@ -33,7 +33,7 @@ $memberCnt = $rootDB->queryFirstField('SELECT count(`NO`) from MEMBER');
if($memberCnt === 0){
Json::die([
'step'=>'admin',
'globalSalt'=>getGlobalSalt()
'globalSalt'=>RootDB::getGlobalSalt()
]);
}
+5 -5
View File
@@ -38,17 +38,17 @@ if(!filter_var($servHost, FILTER_VALIDATE_URL)){
]);
}
if(file_exists(ROOT.'/d_setting/conf.php') && is_dir(ROOT.'/d_setting/conf.php')){
if(file_exists(ROOT.'/d_setting/RootDB.php') && is_dir(ROOT.'/d_setting/RootDB.php')){
Json::die([
'result'=>false,
'reason'=>'d_setting/conf.php 가 디렉토리입니다'
'reason'=>'d_setting/RootDB.php 가 디렉토리입니다'
]);
}
if(AppConf::getRoot()->isExists()){
Json::die([
'result'=>false,
'reason'=>'이미 conf.php 파일이 있습니다'
'reason'=>'이미 RootDB.php 파일이 있습니다'
]);
}
@@ -139,8 +139,8 @@ $rootDB->insert('system', array(
$globalSalt = bin2hex(random_bytes(16));
$result = Util::generateFileUsingSimpleTemplate(
ROOT.'/d_setting/conf.orig.php',
ROOT.'/d_setting/conf.php',[
ROOT.'/d_setting/RootDB.orig.php',
ROOT.'/d_setting/RootDB.php',[
'host'=>$host,
'user'=>$username,
'password'=>$password,