From edd5752de2b2653ad3cb4ae8596791bdfacc589a Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 14 Nov 2021 13:20:19 +0900 Subject: [PATCH] =?UTF-8?q?misc:=20=EB=AF=B8=ED=99=9C=EC=9A=A9=20=ED=95=A8?= =?UTF-8?q?=EC=88=98/=EC=83=81=EC=88=98=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_history.php | 39 ++++++++++++++------------------------- hwe/lib.php | 6 +----- 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/hwe/func_history.php b/hwe/func_history.php index 49d9e299..66e2b0da 100644 --- a/hwe/func_history.php +++ b/hwe/func_history.php @@ -77,12 +77,6 @@ function pushProcessLog($log) { pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/_{$date}_processlog.txt", $log); } - -function pushStepLog($log) { - $date = date('Y_m_d'); - pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/_{$date}_steplog.txt", $log); -} - function pushLockLog($log) { $date = date('Y_m_d'); pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/_{$date}_locklog.txt", $log); @@ -105,15 +99,15 @@ function formatHistoryToHTML(array $history, ?string $type=null):string{ $result = []; if($type){ foreach($history as $seq=>$item){ - $result[] = "
".ConvertLog($item).'
'; + $result[] = "
".ConvertLog($item).'
'; } } else{ foreach($history as $seq=>$item){ - $result[] = '
'.ConvertLog($item).'
'; + $result[] = '
'.ConvertLog($item).'
'; } } - + return join('', $result); } @@ -242,7 +236,7 @@ function pushGeneralHistoryLog(int $generalID, ?array $history, $year=null, $mon return; } $db = DB::db(); - + if($year === null || $month === null){ $gameStor = KVStorage::getStorage($db, 'game_env'); list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']); @@ -278,7 +272,7 @@ function pushNationHistoryLog(int $nationID, ?array $history, ?int $year=null, ? return; } $db = DB::db(); - + if($year === null || $month === null){ $gameStor = KVStorage::getStorage($db, 'game_env'); list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']); @@ -304,7 +298,7 @@ function pushGlobalHistoryLog(?array $history, $year=null, $month=null) { return; } $db = DB::db(); - + if($year === null || $month === null){ $gameStor = KVStorage::getStorage($db, 'game_env'); list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']); @@ -325,8 +319,8 @@ function getGlobalHistoryLogWithDate(int $year, int $month):array { $db = DB::db(); $texts = $db->queryFirstColumn( - 'SELECT `text` from world_history where nation_id = 0 AND year = %i and month = %i order by id desc', - $year, + 'SELECT `text` from world_history where nation_id = 0 AND year = %i and month = %i order by id desc', + $year, $month ); @@ -342,7 +336,7 @@ function pushGlobalActionLog(?array $history, ?int $year=null, ?int $month=null) return; } $db = DB::db(); - + if($year === null || $month === null){ $gameStor = KVStorage::getStorage($db, 'game_env'); list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']); @@ -366,8 +360,8 @@ function getGlobalActionLogWithDate(int $year, int $month):array { $db = DB::db(); $texts = $db->queryFirstColumn( - 'SELECT `text` from general_record where general_id = 0 AND log_type = "history" AND year = %i and month = %i order by id desc', - $year, + 'SELECT `text` from general_record where general_id = 0 AND log_type = "history" AND year = %i and month = %i order by id desc', + $year, $month ); @@ -378,8 +372,6 @@ function getGlobalActionLogWithDate(int $year, int $month):array { } function LogHistory($isFirst=0) { - if(STEP_LOG) pushStepLog(TimeUtil::now().', LogHistory Start'); - $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); $obj = $gameStor->getValues(['startyear', 'year', 'month']); @@ -401,16 +393,16 @@ function LogHistory($isFirst=0) { if($map['month'] == 0){ $map['month'] = 12; $map['year'] -= 1; - } + } } $year = $map['year']; $month = $map['month']; - + $globalHistory = getGlobalHistoryLogWithDate($year, $month); $globalAction = getGlobalActionLogWithDate($year, $month); - + $nations = getAllNationStaticInfo(); $nations[0] = getNationStaticInfo(0); @@ -426,8 +418,6 @@ function LogHistory($isFirst=0) { return -($lhs['power']<=>$rhs['power']); }); - if(STEP_LOG) pushStepLog(TimeUtil::now().', contents collected'); - $db->insert('ng_history', [ 'server_id' => UniqueConst::$serverID, 'year' => $year, @@ -438,6 +428,5 @@ function LogHistory($isFirst=0) { 'nations' => Json::encode($nations), ]); - if(STEP_LOG) pushStepLog(TimeUtil::now().', LogHistory Finish'); return true; } diff --git a/hwe/lib.php b/hwe/lib.php index 8ffbf14c..c276da27 100644 --- a/hwe/lib.php +++ b/hwe/lib.php @@ -20,10 +20,6 @@ $loader->addClassMap((function () { //디버그용 매크로 ini_set("session.cache_expire", 10080); // minutes -// 각종 변수 -define('STEP_LOG', true); -define('PROCESS_LOG', true); - ob_start(); // 에러 메세지 출력 @@ -69,6 +65,6 @@ function prepareDir(string $dirPath, bool $forceCreate=true):bool{ } return mkdir($dirPath); } - + return mkdir($dirPath, 0777, true); } \ No newline at end of file