업데이트 서버 코드 추가

- VersionGit 양식 변경
- 서버 입구 버전 표기
- FileTail 추가
Vscode에서 che, kwe, pwe, twe 무시
This commit is contained in:
2018-04-01 20:12:22 +09:00
parent 6ee8066c80
commit 77ff1d9e9a
9 changed files with 117 additions and 15 deletions
+27
View File
@@ -5,17 +5,20 @@ class Setting {
private $basepath;
private $settingFile;
private $htaccessFile;
private $versionFile;
private $exist = false;
private $running = false;
private $shortName;
private $korName;
private $color;
private $version = null;
public function __construct(string $basepath, string $korName, string $color, string $name=null) {
$this->basepath = $basepath;
$this->settingFile = realpath($basepath.'/d_setting/DB.php');
$this->htaccessFile = realpath($basepath.'/.htaccess');
$this->versionFile = realpath($basepath.'/d_setting/VersionGit.php');
$this->korName = $korName;
$this->color = $color;
@@ -62,6 +65,30 @@ class Setting {
public function getSettingFile() {
return $this->settingFile;
}
public function getVersion(){
if($this->version !== null){
return $this->version;
}
if(!file_exists($this->versionFile)){
$this->version = 'noVersionFile';
return $this->version;
}
$tail = new FileTail($this->versionFile);
$version = 'noVersionJson';
foreach ($tail->smart(5, 100, true) as $line) {
if(Util::starts_with($line, '//{')){
$version = Json::decode(substr($line, 2));
$version = Util::array_get($version['version'], 'noVersionValue');
break;
}
}
$this->version = $version;
return $version;
}
}