diff --git a/hwe/j_install_db.php b/hwe/j_install_db.php index 6b72dad4..238f72af 100644 --- a/hwe/j_install_db.php +++ b/hwe/j_install_db.php @@ -63,6 +63,8 @@ $db->addHook('run_failed', function(){ ]); }); +$mysqli_obj = $db->get(); + $prefix = basename(__DIR__); $result = Util::generateFileUsingSimpleTemplate( @@ -84,24 +86,29 @@ if($result !== true){ ]); } -if (!class_exists('\\sammo\\DB')) { - $loader = require __DIR__.'/../vendor/autoload.php'; - $loader->addClassMap((function () { - $d_settingMap = []; - foreach (glob(__DIR__.'/d_setting/*.orig.php') as $filepath) { - $filepath = str_replace('.orig.php', '.php', $filepath); - if(!file_exists($filepath)) { - continue; - } - $filename = basename($filepath); - $classname = explode('.', $filename)[0]; - $d_settingMap['sammo\\'.$classname] = $filepath; - }; - return $d_settingMap; - })()); +//최소한의 테이블 처리를 위해 수동으로 초기화하도록 하자 +if($mysqli_obj->multi_query(file_get_contents(__DIR__.'/sql/reset.sql'))){ + while(true){ + if (!$mysqli_obj->more_results()) { + break; + } + if(!$mysqli_obj->next_result()){ + break; + } + } + } -ResetHelper::clearDB($db, $prefix); +if($mysqli_obj->multi_query(file_get_contents(__DIR__.'/sql/schema.sql'))){ + while(true){ + if (!$mysqli_obj->more_results()) { + break; + } + if(!$mysqli_obj->next_result()){ + break; + } + } +} ServConfig::getServerList()[$prefix]->closeServer(); diff --git a/hwe/sammo/ResetHelper.php b/hwe/sammo/ResetHelper.php index 3fd7ad05..a5d3d80c 100644 --- a/hwe/sammo/ResetHelper.php +++ b/hwe/sammo/ResetHelper.php @@ -8,7 +8,7 @@ class ResetHelper{ } - static public function clearDB(?\MeekroDB $db = null, ?string $prefix = null):array{ + static public function clearDB():array{ $servRoot = realpath(__DIR__.'/../'); if(!file_exists($servRoot.'/logs') || !file_exists($servRoot.'/data')){ @@ -72,15 +72,11 @@ class ResetHelper{ } } - if($prefix === null){ - $prefix = DB::prefix(); - } + $prefix = DB::prefix(); ServConfig::getServerList()[$prefix]->closeServer(); - if($db === null){ - $db = DB::db(); - } + $db = DB::db(); $mysqli_obj = $db->get(); $serverID = $prefix.'_'.date("ymd").'_'.Util::randomStr(4);