newRootDB(), newDB가 이전의 코드 수정으로 new를 수행하는 경우가 줄어들었으므로 getRootDB(), newDB() 로 이름 변경
This commit is contained in:
@@ -6,7 +6,7 @@ require(__dir__.'/../vendor/autoload.php');
|
|||||||
*
|
*
|
||||||
* @return MeekroDB
|
* @return MeekroDB
|
||||||
*/
|
*/
|
||||||
function newRootDB(){
|
function getRootDB(){
|
||||||
$host = '_host_';
|
$host = '_host_';
|
||||||
$user = '_user_';
|
$user = '_user_';
|
||||||
$password = '_password_';
|
$password = '_password_';
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ switch($btn) {
|
|||||||
$gen = MYDB_fetch_array($result);
|
$gen = MYDB_fetch_array($result);
|
||||||
$uid[$i] = $gen['user_id'];
|
$uid[$i] = $gen['user_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$connect = dbConn("sammo");
|
$connect = dbConn("sammo");
|
||||||
$date = date('Y-m-d H:i:s');
|
$date = date('Y-m-d H:i:s');
|
||||||
for($i=0; $i < sizeof($uid); $i++) {
|
for($i=0; $i < sizeof($uid); $i++) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ require_once(__dir__.'/../../d_setting/conf.php');
|
|||||||
*
|
*
|
||||||
* @return MeekroDB
|
* @return MeekroDB
|
||||||
*/
|
*/
|
||||||
function newDB(){
|
function getDB(){
|
||||||
$host = '_host_';
|
$host = '_host_';
|
||||||
$user = '_user_';
|
$user = '_user_';
|
||||||
$password = '_password_';
|
$password = '_password_';
|
||||||
|
|||||||
+5
-5
@@ -1797,7 +1797,7 @@ function adminMsg($connect, $skin=1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getOnlineNum() {
|
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) {
|
function onlinegen($connect) {
|
||||||
@@ -2133,7 +2133,7 @@ function CutDay($date) {
|
|||||||
|
|
||||||
|
|
||||||
function increateRefreshEx($type, $cnt=1){
|
function increateRefreshEx($type, $cnt=1){
|
||||||
$db = newDB();
|
$db = getDB();
|
||||||
|
|
||||||
$db->query("update `game` set `refresh` = `refresh` + %d_p_id where `no` = %d_cnt", array(
|
$db->query("update `game` set `refresh` = `refresh` + %d_p_id where `no` = %d_cnt", array(
|
||||||
'p_id'=>$p_id,
|
'p_id'=>$p_id,
|
||||||
@@ -2317,12 +2317,12 @@ function CheckOverhead($connect) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isLock() {
|
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() {
|
function tryLock() {
|
||||||
//NOTE: 게임 로직과 관련한 모든 insert, update 함수들은 lock을 거칠것을 권장함.
|
//NOTE: 게임 로직과 관련한 모든 insert, update 함수들은 lock을 거칠것을 권장함.
|
||||||
$db = newDB();
|
$db = getDB();
|
||||||
//테이블 락
|
//테이블 락
|
||||||
$db->query("lock tables plock write");
|
$db->query("lock tables plock write");
|
||||||
// 잠금
|
// 잠금
|
||||||
@@ -2340,7 +2340,7 @@ function tryLock() {
|
|||||||
function unlock() {
|
function unlock() {
|
||||||
// 풀림
|
// 풀림
|
||||||
//NOTE: unlock에는 table lock이 필요없는가?
|
//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) {
|
function timeover($connect) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
function getScenario() {
|
function getScenario() {
|
||||||
//FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함.
|
//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) {
|
switch($scenario) {
|
||||||
case 0: $str = '공백지모드'; break;
|
case 0: $str = '공백지모드'; break;
|
||||||
@@ -629,7 +629,7 @@ function getBill($dedication) {
|
|||||||
function getCost($armtype) {
|
function getCost($armtype) {
|
||||||
//FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함.
|
//FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함.
|
||||||
//TODO: 병종 값이 column으로 들어있는건 전혀 옳지 않음. key->value 형태로 바꿔야함
|
//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) {
|
function TechLimit($startyear, $year, $tech) {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ function getRawMessage($mailbox, $limit=30, $fromTime=NULL){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO: table 네임의 prefix를 처리할 수 있도록 개선
|
//TODO: table 네임의 prefix를 처리할 수 있도록 개선
|
||||||
$result = newDB()->query($sql, [
|
$result = getDB()->query($sql, [
|
||||||
'mailbox' => $mailbox,
|
'mailbox' => $mailbox,
|
||||||
'limit' => $limit,
|
'limit' => $limit,
|
||||||
'time' => $fromTime
|
'time' => $fromTime
|
||||||
@@ -100,7 +100,7 @@ function getMessage($msgType, $limit=30, $fromTime=NULL){
|
|||||||
return getRawMessage($genID, $limit, $fromTime);
|
return getRawMessage($genID, $limit, $fromTime);
|
||||||
}
|
}
|
||||||
else if($msgType === 'national'){
|
else if($msgType === 'national'){
|
||||||
$nationID = newDB()->queryFirstField(
|
$nationID = getDB()->queryFirstField(
|
||||||
'select `nation` from `general` where user_id = %i',
|
'select `nation` from `general` where user_id = %i',
|
||||||
$genID
|
$genID
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ function CoreTurnTable() {
|
|||||||
function allButton() {
|
function allButton() {
|
||||||
|
|
||||||
global $_basecolor2;
|
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) {
|
if($npcmode == 1) {
|
||||||
$site = "a_npcList.php";
|
$site = "a_npcList.php";
|
||||||
$call = "빙의일람";
|
$call = "빙의일람";
|
||||||
@@ -109,7 +109,7 @@ function commandButton() {
|
|||||||
if($generalID === NULL){
|
if($generalID === NULL){
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$db = newDB();
|
$db = getDB();
|
||||||
|
|
||||||
$me = $db->queryFirstRow("select skin,no,nation,level,belong from general where user_id=%i", $generalID);
|
$me = $db->queryFirstRow("select skin,no,nation,level,belong from general where user_id=%i", $generalID);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ if(!CheckLoginEx($db)){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$db = newDB();
|
$db = getDB();
|
||||||
|
|
||||||
$connect = dbConn();
|
$connect = dbConn();
|
||||||
increaseRefresh($connect, '서신전달', 1);
|
increaseRefresh($connect, '서신전달', 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user