From dc56de8afdb11caec2a93e3f640a8216d1e0d259 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 28 Jan 2018 21:44:08 +0900 Subject: [PATCH] =?UTF-8?q?newRootDB(),=20newDB=EA=B0=80=20=EC=9D=B4?= =?UTF-8?q?=EC=A0=84=EC=9D=98=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20new=EB=A5=BC=20=EC=88=98=ED=96=89=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EA=B2=BD=EC=9A=B0=EA=B0=80=20=EC=A4=84=EC=96=B4?= =?UTF-8?q?=EB=93=A4=EC=97=88=EC=9C=BC=EB=AF=80=EB=A1=9C=20getRootDB(),=20?= =?UTF-8?q?newDB()=20=EB=A1=9C=20=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- d_setting/conf.orig.php | 2 +- twe/_admin2_submit.php | 1 + twe/d_setting/conf.orig.php | 2 +- twe/func.php | 10 +++++----- twe/func_converter.php | 4 ++-- twe/func_message.php | 4 ++-- twe/func_template.php | 4 ++-- twe/j_msgsubmit.php | 2 +- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/d_setting/conf.orig.php b/d_setting/conf.orig.php index a2e736e3..f11281ce 100644 --- a/d_setting/conf.orig.php +++ b/d_setting/conf.orig.php @@ -6,7 +6,7 @@ require(__dir__.'/../vendor/autoload.php'); * * @return MeekroDB */ -function newRootDB(){ +function getRootDB(){ $host = '_host_'; $user = '_user_'; $password = '_password_'; diff --git a/twe/_admin2_submit.php b/twe/_admin2_submit.php index 99d56b30..54c31794 100644 --- a/twe/_admin2_submit.php +++ b/twe/_admin2_submit.php @@ -43,6 +43,7 @@ switch($btn) { $gen = MYDB_fetch_array($result); $uid[$i] = $gen['user_id']; } + $connect = dbConn("sammo"); $date = date('Y-m-d H:i:s'); for($i=0; $i < sizeof($uid); $i++) { diff --git a/twe/d_setting/conf.orig.php b/twe/d_setting/conf.orig.php index 6d58362d..f51eb9d1 100644 --- a/twe/d_setting/conf.orig.php +++ b/twe/d_setting/conf.orig.php @@ -6,7 +6,7 @@ require_once(__dir__.'/../../d_setting/conf.php'); * * @return MeekroDB */ -function newDB(){ +function getDB(){ $host = '_host_'; $user = '_user_'; $password = '_password_'; diff --git a/twe/func.php b/twe/func.php index 3d7040cf..a09fdfbc 100644 --- a/twe/func.php +++ b/twe/func.php @@ -1797,7 +1797,7 @@ function adminMsg($connect, $skin=1) { } function getOnlineNum() { - return newDB()->queryFirstField('select `online` from `game` where `no`=1'); + return getDB()->queryFirstField('select `online` from `game` where `no`=1'); } function onlinegen($connect) { @@ -2133,7 +2133,7 @@ function CutDay($date) { function increateRefreshEx($type, $cnt=1){ - $db = newDB(); + $db = getDB(); $db->query("update `game` set `refresh` = `refresh` + %d_p_id where `no` = %d_cnt", array( 'p_id'=>$p_id, @@ -2317,12 +2317,12 @@ function CheckOverhead($connect) { } function isLock() { - return newDB()->queryFirstField("select plock from plock where no=1") != 0; + return getDB()->queryFirstField("select plock from plock where no=1") != 0; } function tryLock() { //NOTE: 게임 로직과 관련한 모든 insert, update 함수들은 lock을 거칠것을 권장함. - $db = newDB(); + $db = getDB(); //테이블 락 $db->query("lock tables plock write"); // 잠금 @@ -2340,7 +2340,7 @@ function tryLock() { function unlock() { // 풀림 //NOTE: unlock에는 table lock이 필요없는가? - newDB()->query("update plock set plock=0 where no=1"); + getDB()->query("update plock set plock=0 where no=1"); } function timeover($connect) { diff --git a/twe/func_converter.php b/twe/func_converter.php index c231e076..d0c37e05 100644 --- a/twe/func_converter.php +++ b/twe/func_converter.php @@ -8,7 +8,7 @@ function getScenario() { //FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함. - $scenario = newDB()->queryFirstColumn('select `scenario` from `game` where no=1'); + $scenario = getDB()->queryFirstColumn('select `scenario` from `game` where no=1'); switch($scenario) { case 0: $str = '공백지모드'; break; @@ -629,7 +629,7 @@ function getBill($dedication) { function getCost($armtype) { //FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함. //TODO: 병종 값이 column으로 들어있는건 전혀 옳지 않음. key->value 형태로 바꿔야함 - return newDB()->queryFirstColumn('select cst%l from game where no=1', intval($armtype)); + return getDB()->queryFirstColumn('select cst%l from game where no=1', intval($armtype)); } function TechLimit($startyear, $year, $tech) { diff --git a/twe/func_message.php b/twe/func_message.php index 791af99d..7ec2ba47 100644 --- a/twe/func_message.php +++ b/twe/func_message.php @@ -75,7 +75,7 @@ function getRawMessage($mailbox, $limit=30, $fromTime=NULL){ } //TODO: table 네임의 prefix를 처리할 수 있도록 개선 - $result = newDB()->query($sql, [ + $result = getDB()->query($sql, [ 'mailbox' => $mailbox, 'limit' => $limit, 'time' => $fromTime @@ -100,7 +100,7 @@ function getMessage($msgType, $limit=30, $fromTime=NULL){ return getRawMessage($genID, $limit, $fromTime); } else if($msgType === 'national'){ - $nationID = newDB()->queryFirstField( + $nationID = getDB()->queryFirstField( 'select `nation` from `general` where user_id = %i', $genID ); diff --git a/twe/func_template.php b/twe/func_template.php index ff93547e..10462806 100644 --- a/twe/func_template.php +++ b/twe/func_template.php @@ -66,7 +66,7 @@ function CoreTurnTable() { function allButton() { global $_basecolor2; - $npcmode = newDB()->queryFirstField("select npcmode from game where no='1'"); + $npcmode = getDB()->queryFirstField("select npcmode from game where no='1'"); if($npcmode == 1) { $site = "a_npcList.php"; $call = "빙의일람"; @@ -109,7 +109,7 @@ function commandButton() { if($generalID === NULL){ return ''; } - $db = newDB(); + $db = getDB(); $me = $db->queryFirstRow("select skin,no,nation,level,belong from general where user_id=%i", $generalID); diff --git a/twe/j_msgsubmit.php b/twe/j_msgsubmit.php index fbf13863..65d86121 100644 --- a/twe/j_msgsubmit.php +++ b/twe/j_msgsubmit.php @@ -34,7 +34,7 @@ if(!CheckLoginEx($db)){ } -$db = newDB(); +$db = getDB(); $connect = dbConn(); increaseRefresh($connect, '서신전달', 1);