게임 오픈 시 logs에 서브 디렉토리를 사용하도록 변경
This commit is contained in:
Vendored
+1
-1
@@ -5,7 +5,7 @@
|
||||
"**/.hg": true,
|
||||
"**/CVS": true,
|
||||
"**/.DS_Store": true,
|
||||
"**/logs/*.txt": true,
|
||||
"**/logs/**/*.txt": true,
|
||||
"**/session/sess*":true,
|
||||
"/che":true,
|
||||
"/kwe":true,
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ increaseRefresh("갱신정보", 2);
|
||||
|
||||
$admin = $gameStor->getValues(['year','month','refresh','maxrefresh','maxonline']);
|
||||
|
||||
$log = getRawFileLogRecent(__dir__.'/logs/_traffic.txt', 11, 100);
|
||||
$log = getRawFileLogRecent(__dir__.'/logs/'.UniqueConst::$serverID.'/_traffic.txt', 11, 100);
|
||||
|
||||
$date = [];
|
||||
$year = [];
|
||||
|
||||
+3
-3
@@ -1266,7 +1266,7 @@ function increaseRefresh($type="", $cnt=1) {
|
||||
$date2 = substr($date, 0, 10);
|
||||
$online = getOnlineNum();
|
||||
file_put_contents(
|
||||
__dir__."/logs/_{$date2}_refresh.txt",
|
||||
__dir__."/logs/".UniqueConst::$serverID."/_{$date2}_refresh.txt",
|
||||
sprintf(
|
||||
"%s, %s, %s, %s, %s, %d\n",
|
||||
$date,
|
||||
@@ -1303,7 +1303,7 @@ function increaseRefresh($type="", $cnt=1) {
|
||||
}
|
||||
if($str != "") {
|
||||
file_put_contents(
|
||||
__dir__."/logs/_{$date2}_ipcheck.txt",
|
||||
__dir__."/logs/".UniqueConst::$serverID."/_{$date2}_ipcheck.txt",
|
||||
sprintf(
|
||||
"%s, %s, %s%s\n",
|
||||
$session->userName,
|
||||
@@ -1338,7 +1338,7 @@ function updateTraffic() {
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
//일시|년|월|총갱신|접속자|최다갱신자
|
||||
file_put_contents(__dir__."/logs/_traffic.txt",
|
||||
file_put_contents(__dir__."/logs/".UniqueConst::$serverID."/_traffic.txt",
|
||||
Json::encode([
|
||||
$date,
|
||||
$admin['year'],
|
||||
|
||||
+18
-18
@@ -5,7 +5,7 @@ namespace sammo;
|
||||
|
||||
function delStepLog() {
|
||||
$date = date('Y_m_d');
|
||||
@unlink(__dir__."/logs/_{$date}_steplog.txt");
|
||||
@unlink(__dir__."/logs/".UniqueConst::$serverID."/_{$date}_steplog.txt");
|
||||
}
|
||||
|
||||
function pushRawFileLog($path, $lines){
|
||||
@@ -50,81 +50,81 @@ function eraseTnmtFightLogAll(){
|
||||
}
|
||||
|
||||
function eraseTnmtFightLog(int $group){
|
||||
$filepath = __dir__."/logs/fight{$group}.txt";
|
||||
$filepath = __dir__."/logs/".UniqueConst::$serverID."/fight{$group}.txt";
|
||||
if(file_exists($filepath)){
|
||||
@unlink($filepath);
|
||||
}
|
||||
}
|
||||
|
||||
function pushTnmtFightLog(int $group, $log) {
|
||||
pushRawFileLog(__dir__."/logs/fight{$group}.txt", $log);
|
||||
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/fight{$group}.txt", $log);
|
||||
}
|
||||
|
||||
function getTnmtFightLogAll(int $group) {
|
||||
return join('<br>',getFormattedFileLogAll(__dir__."/logs/fight{$group}.txt"));
|
||||
return join('<br>',getFormattedFileLogAll(__dir__."/logs/".UniqueConst::$serverID."/fight{$group}.txt"));
|
||||
}
|
||||
|
||||
function pushSabotageLog($log) {
|
||||
pushRawFileLog(__dir__."/logs/_sabotagelog.txt", $log);
|
||||
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/_sabotagelog.txt", $log);
|
||||
}
|
||||
|
||||
function getSabotageLogRecent($count) {
|
||||
return join('<br>', getFormattedFileLogRecent(__dir__."/logs/_sabotagelog.txt", $count, 150));
|
||||
return join('<br>', getFormattedFileLogRecent(__dir__."/logs/".UniqueConst::$serverID."/_sabotagelog.txt", $count, 150));
|
||||
}
|
||||
|
||||
function pushProcessLog($log) {
|
||||
$date = date('Y_m_d');
|
||||
pushRawFileLog(__dir__."/logs/_{$date}_processlog.txt", $log);
|
||||
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/_{$date}_processlog.txt", $log);
|
||||
}
|
||||
|
||||
|
||||
function pushStepLog($log) {
|
||||
$date = date('Y_m_d');
|
||||
pushRawFileLog(__dir__."/logs/_{$date}_steplog.txt", $log);
|
||||
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/_{$date}_steplog.txt", $log);
|
||||
}
|
||||
|
||||
function pushLockLog($log) {
|
||||
$date = date('Y_m_d');
|
||||
pushRawFileLog(__dir__."/logs/_{$date}_locklog.txt", $log);
|
||||
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/_{$date}_locklog.txt", $log);
|
||||
}
|
||||
|
||||
function pushAdminLog($log) {
|
||||
pushRawFileLog(__dir__."/logs/_adminlog.txt", $log);
|
||||
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/_adminlog.txt", $log);
|
||||
}
|
||||
|
||||
function pushAuctionLog($log) {
|
||||
pushRawFileLog(__dir__."/logs/_auctionlog.txt", $log);
|
||||
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/_auctionlog.txt", $log);
|
||||
}
|
||||
|
||||
function getAuctionLogRecent(int $count) {
|
||||
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/_auctionlog.txt", $count, 300)));
|
||||
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/".UniqueConst::$serverID."/_auctionlog.txt", $count, 300)));
|
||||
}
|
||||
|
||||
function pushGenLog($general, $log) {
|
||||
$no = Util::toInt($general['no']);
|
||||
pushRawFileLog(__dir__."/logs/gen{$no}.txt", $log);
|
||||
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/gen{$no}.txt", $log);
|
||||
}
|
||||
|
||||
function getGenLogRecent(int $no, int $count) {
|
||||
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/gen{$no}.txt", $count, 300)));
|
||||
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/".UniqueConst::$serverID."/gen{$no}.txt", $count, 300)));
|
||||
}
|
||||
|
||||
function pushBatRes($general, $log) {
|
||||
$no = Util::toInt($general['no']);
|
||||
pushRawFileLog(__dir__."/logs/batres{$no}.txt", $log);
|
||||
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/batres{$no}.txt", $log);
|
||||
}
|
||||
|
||||
function getBatResRecent(int $no, int $count) {
|
||||
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/batres{$no}.txt", $count, 300)));
|
||||
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/".UniqueConst::$serverID."/batres{$no}.txt", $count, 300)));
|
||||
}
|
||||
|
||||
function pushBatLog($general, $log) {
|
||||
$no = Util::toInt($general['no']);
|
||||
pushRawFileLog(__dir__."/logs/batlog{$no}.txt", $log);
|
||||
pushRawFileLog(__dir__."/logs/".UniqueConst::$serverID."/batlog{$no}.txt", $log);
|
||||
}
|
||||
|
||||
function getBatLogRecent(int $no, int $count) {
|
||||
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/batlog{$no}.txt", $count, 300)));
|
||||
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/".UniqueConst::$serverID."/batlog{$no}.txt", $count, 300)));
|
||||
}
|
||||
|
||||
//DB-based
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ function Error($message='', $url="")
|
||||
if (!$url) {
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
}
|
||||
file_put_contents(__dir__."/logs/_db_bug.txt", "{\"url\":\"$url\",\"msg\":\"$message\"}\n", FILE_APPEND);
|
||||
file_put_contents(__dir__."/logs/".UniqueConst::$serverID."/_db_bug.txt", "{\"url\":\"$url\",\"msg\":\"$message\"}\n", FILE_APPEND);
|
||||
|
||||
$templates = new \League\Plates\Engine(__dir__.'/templates');
|
||||
|
||||
|
||||
@@ -55,13 +55,15 @@ class ResetHelper{
|
||||
$db = DB::db();
|
||||
$mysqli_obj = $db->get();
|
||||
|
||||
FileUtil::delInDir($servRoot."/logs");
|
||||
FileUtil::delInDir($servRoot."/data");
|
||||
$serverID = DB::prefix().'_'.Util::randomStr(12);
|
||||
|
||||
mkdir($servRoot.'/logs/'.$serverID, 0644);
|
||||
mkdir($servRoot.'/data/'.$serverID, 0644);
|
||||
|
||||
$result = Util::generateFileUsingSimpleTemplate(
|
||||
$servRoot.'/d_setting/UniqueConst.orig.php',
|
||||
$servRoot.'/d_setting/UniqueConst.php',[
|
||||
'serverID'=>DB::prefix().'_'.Util::randomStr(8),
|
||||
'serverID'=>$serverID,
|
||||
'serverName'=>AppConf::getList()[$prefix]->getKorName(),
|
||||
], true
|
||||
);
|
||||
|
||||
@@ -376,9 +376,40 @@ create table if not exists hall (
|
||||
UNIQUE INDEX `type` (`type`, `rank`)
|
||||
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE if not exists `ng_hall` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`server_id` CHAR(20) NOT NULL,
|
||||
`scenario` INT(11) NOT NULL,
|
||||
`general_no` INT(11) NOT NULL,
|
||||
`type` INT(11) NOT NULL,
|
||||
`value` INT(11) NOT NULL,
|
||||
`owner` INT(11) NULL DEFAULT NULL,
|
||||
`aux` TEXT NOT NULL DEFAULT '{}',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `server_general` (`server_id`, `type`, `general_no`),
|
||||
UNIQUE INDEX `owner` (`owner`, `server_id`),
|
||||
INDEX `server_show` (`server_id`, `type`, `value`),
|
||||
INDEX `scenario` (`scenario`, `type`, `value`)
|
||||
)
|
||||
ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
###########################################################################
|
||||
## 왕조 테이블
|
||||
###########################################################################
|
||||
|
||||
CREATE TABLE if not exists `ng_games` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`server_id` CHAR(20) NOT NULL,
|
||||
`date` DATETIME NOT NULL,
|
||||
`united` INT(1) NOT NULL DEFAULT '0',
|
||||
`aux` TEXT NOT NULL COMMENT 'json',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `server_id` (`server_id`),
|
||||
INDEX `date` (`date`)
|
||||
)
|
||||
ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
create table if not exists emperior (
|
||||
no int(6) not null auto_increment,
|
||||
phase char(255) default '',
|
||||
|
||||
Reference in New Issue
Block a user