파일 경로를 절대 경로로 변경

This commit is contained in:
2018-04-17 19:21:30 +09:00
parent 7ec3fcc78e
commit bfd79f479e
3 changed files with 23 additions and 23 deletions
+3 -3
View File
@@ -1138,7 +1138,7 @@ function PushMsg($type, $nation, $picture, $imgsvr, $from, $fromcolor, $to, $toc
$date = date('Y-m-d H:i:s');
if($type == 1) { $file = "_all_msg.txt"; }
else { $file = "_nation_msg{$nation}.txt"; }
$fp = fopen("logs/{$file}", "a");
$fp = fopen(__dir__."/logs/{$file}", "a");
//로그 파일에 기록
$str = "{$type}|".StringUtil::padStringAlignRight($from,12," ")."|".StringUtil::padStringAlignRight($to,12," ")."|".$date."|".$msg."|".$fromcolor."|".$tocolor."|".$picture."|".$imgsvr;
fwrite($fp, "{$str}\n");
@@ -1287,7 +1287,7 @@ function increaseRefresh($type="", $cnt=1) {
$date2 = substr($date, 0, 10);
$online = getOnlineNum();
file_put_contents(
"logs/_{$date2}_refresh.txt",
__dir__."/logs/_{$date2}_refresh.txt",
sprintf(
"%s, %s, %s, %s, %s, %d\n",
$date,
@@ -1324,7 +1324,7 @@ function increaseRefresh($type="", $cnt=1) {
}
if($str != "") {
file_put_contents(
"logs/_{$date2}_ipcheck.txt",
__dir__."/logs/_{$date2}_ipcheck.txt",
sprintf(
"%s, %s, %s%s\n",
$session->userName,
+18 -18
View File
@@ -5,7 +5,7 @@ namespace sammo;
function delStepLog() {
$date = date('Y_m_d');
@unlink("logs/_{$date}_steplog.txt");
@unlink(__dir__."/logs/_{$date}_steplog.txt");
}
function pushRawFileLog($path, $lines){
@@ -50,81 +50,81 @@ function eraseTnmtFightLogAll(){
}
function eraseTnmtFightLog(int $group){
$filepath = "logs/fight{$group}.txt";
$filepath = __dir__."/logs/fight{$group}.txt";
if(file_exists($filepath)){
@unlink($filepath);
}
}
function pushTnmtFightLog(int $group, $log) {
pushRawFileLog("logs/fight{$group}.txt", $log);
pushRawFileLog(__dir__."/logs/fight{$group}.txt", $log);
}
function getTnmtFightLogAll(int $group) {
return join('<br>',getFormattedFileLogAll("logs/fight{$group}.txt"));
return join('<br>',getFormattedFileLogAll(__dir__."/logs/fight{$group}.txt"));
}
function pushSabotageLog($log) {
pushRawFileLog("logs/_sabotagelog.txt", $log);
pushRawFileLog(__dir__."/logs/_sabotagelog.txt", $log);
}
function getSabotageLogRecent($count) {
return join('<br>', getFormattedFileLogRecent("logs/_sabotagelog.txt", $count, 150));
return join('<br>', getFormattedFileLogRecent(__dir__."/logs/_sabotagelog.txt", $count, 150));
}
function pushProcessLog($log) {
$date = date('Y_m_d');
pushRawFileLog("logs/_{$date}_processlog.txt", $log);
pushRawFileLog(__dir__."/logs/_{$date}_processlog.txt", $log);
}
function pushStepLog($log) {
$date = date('Y_m_d');
pushRawFileLog("logs/_{$date}_steplog.txt", $log);
pushRawFileLog(__dir__."/logs/_{$date}_steplog.txt", $log);
}
function pushLockLog($log) {
$date = date('Y_m_d');
pushRawFileLog("logs/_{$date}_locklog.txt", $log);
pushRawFileLog(__dir__."/logs/_{$date}_locklog.txt", $log);
}
function pushAdminLog($log) {
pushRawFileLog("logs/_adminlog.txt", $log);
pushRawFileLog(__dir__."/logs/_adminlog.txt", $log);
}
function pushAuctionLog($log) {
pushRawFileLog("logs/_auctionlog.txt", $log);
pushRawFileLog(__dir__."/logs/_auctionlog.txt", $log);
}
function getAuctionLogRecent(int $count) {
return join('<br>', array_reverse(getFormattedFileLogRecent("logs/_auctionlog.txt", $count, 300)));
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/_auctionlog.txt", $count, 300)));
}
function pushGenLog($general, $log) {
$no = Util::toInt($general['no']);
pushRawFileLog("logs/gen{$no}.txt", $log);
pushRawFileLog(__dir__."/logs/gen{$no}.txt", $log);
}
function getGenLogRecent(int $no, int $count) {
return join('<br>', array_reverse(getFormattedFileLogRecent("logs/gen{$no}.txt", $count, 300)));
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/gen{$no}.txt", $count, 300)));
}
function pushBatRes($general, $log) {
$no = Util::toInt($general['no']);
pushRawFileLog("logs/batres{$no}.txt", $log);
pushRawFileLog(__dir__."/logs/batres{$no}.txt", $log);
}
function getBatResRecent(int $no, int $count) {
return join('<br>', array_reverse(getFormattedFileLogRecent("logs/batres{$no}.txt", $count, 300)));
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/batres{$no}.txt", $count, 300)));
}
function pushBatLog($general, $log) {
$no = Util::toInt($general['no']);
pushRawFileLog("logs/batlog{$no}.txt", $log);
pushRawFileLog(__dir__."/logs/batlog{$no}.txt", $log);
}
function getBatLogRecent(int $no, int $count) {
return join('<br>', array_reverse(getFormattedFileLogRecent("logs/batlog{$no}.txt", $count, 300)));
return join('<br>', array_reverse(getFormattedFileLogRecent(__dir__."/logs/batlog{$no}.txt", $count, 300)));
}
//DB-based
+2 -2
View File
@@ -100,8 +100,8 @@ $mysqli_obj = $db->get();
$scenarioObj = new Scenario($scenario, false);
$startyear = $scenarioObj->getYear()??GameConst::$defaultStartYear;
FileUtil::delInDir("logs");
FileUtil::delInDir("data");
FileUtil::delInDir(__dir__."/logs");
FileUtil::delInDir(__dir__."/data");
$result = Util::generateFileUsingSimpleTemplate(
__DIR__.'/d_setting/UniqueConst.orig.php',