clearDB에 $db 전달

This commit is contained in:
2024-05-17 17:59:27 +00:00
parent 0b8e91efe8
commit 625cf81f1f
2 changed files with 10 additions and 12 deletions
+9 -4
View File
@@ -8,7 +8,7 @@ class ResetHelper{
}
static public function clearDB(){
static public function clearDB(?\MeekroDB $db = null, ?string $prefix = null):array{
$servRoot = realpath(__DIR__.'/../');
if(!file_exists($servRoot.'/logs') || !file_exists($servRoot.'/data')){
@@ -72,13 +72,18 @@ class ResetHelper{
}
}
$prefix = DB::prefix();
if($prefix === null){
$prefix = DB::prefix();
}
ServConfig::getServerList()[$prefix]->closeServer();
$db = DB::db();
if($db === null){
$db = DB::db();
}
$mysqli_obj = $db->get();
$serverID = DB::prefix().'_'.date("ymd").'_'.Util::randomStr(4);
$serverID = $prefix.'_'.date("ymd").'_'.Util::randomStr(4);
mkdir($servRoot.'/logs/'.$serverID, 0775);
mkdir($servRoot.'/data/'.$serverID, 0775);