misc: 미활용 함수/상수 제거

This commit is contained in:
2021-11-14 13:20:19 +09:00
parent a560ee6f0a
commit edd5752de2
2 changed files with 15 additions and 30 deletions
+14 -25
View File
@@ -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[] = "<div class='log_{$type}' id='log_{$type}_{$seq}' data-seq='{$seq}'>".ConvertLog($item).'</div>';
$result[] = "<div class='log_{$type}' id='log_{$type}_{$seq}' data-seq='{$seq}'>".ConvertLog($item).'</div>';
}
}
else{
foreach($history as $seq=>$item){
$result[] = '<div>'.ConvertLog($item).'</div>';
$result[] = '<div>'.ConvertLog($item).'</div>';
}
}
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;
}
+1 -5
View File
@@ -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);
}