서버 운영자 페이지 수정

This commit is contained in:
2018-03-19 00:31:04 +09:00
parent 1c4709ea65
commit efa6cc2889
9 changed files with 167 additions and 112 deletions
+58
View File
@@ -0,0 +1,58 @@
<?php
// 외부 파라미터
require_once('_common.php');
require_once(ROOT.'/f_config/DB.php');
require_once(ROOT.'/f_config/SESSION.php');
$result = [];
foreach (getServerConfigList() as $server) {
list($serverKorName, $serverColor, $setting) = $server;
$serverPath = $setting->getBasePath();
$serverDir = $setting->getShortName();
//TODO: .htaccess가 서버 오픈에도 사용될 수 있으니 별도의 방법이 필요함
if (!is_dir($serverPath)) {
$state = [
'valid'=>false,
'run'=>false,
'reason'=>'디렉토리 없음'
];
} elseif (!file_exists($serverPath.'/index.php')) {
$state = [
'valid'=>false,
'run'=>false,
'reason'=>'index.php 없음'
];
} elseif (!$setting->isExists()) {
$state = [
'valid'=>false,
'run'=>false,
'reason'=>'설정 파일 없음'
];
} elseif (file_exists($serverPath.'/.htaccess')) {
// 폐쇄중
$state = [
'valid'=>true,
'run'=>false,
'reason'=>'폐쇄됨'
];
} else {
// 오픈중
$state = [
'valid'=>true,
'run'=>true,
'reason'=>'운영중'
];
}
$state = array_merge($state, [
'name' => $serverDir,
'korName' => $serverKorName,
'color' => $serverColor
]);
$result[] = $state;
}
returnJson($result);