mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 11:11:39 +09:00
설치된 파일과 설치된 버전의 공식 패키지의 파일을 비교하는 tool추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4374 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
e3ec34e1aa
commit
f1a891558e
7 changed files with 259 additions and 1 deletions
|
|
@ -54,7 +54,7 @@
|
|||
function dispAdminIndex() {
|
||||
// 공식사이트에서 최신 뉴스를 가져옴
|
||||
$newest_news_url = sprintf("http://news.zeroboard.com/%s/news.php", Context::getLangType());
|
||||
$cache_file = sprintf("./files/cache/newest_news.%s.cache.php", Context::getLangType());
|
||||
$cache_file = sprintf("%sfiles/cache/newest_news.%s.cache.php", _XE_PATH_,Context::getLangType());
|
||||
|
||||
// 1시간 단위로 캐싱 체크
|
||||
if(!file_exists($cache_file) || filemtime($cache_file)+ 60*60 < time()) {
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
135
tools/validator/index.php
Normal file
135
tools/validator/index.php
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
<?php
|
||||
/**
|
||||
* @file tools/validator.php
|
||||
* @author zero <zero@zeroboard.com>
|
||||
* @brief 현재 설치된 버전에 해당하는 XE 파일 비교
|
||||
**/
|
||||
|
||||
/**
|
||||
* @brief 기본적인 상수 선언, 웹에서 직접 호출되는 것을 막기 위해 체크하는 상수 선언
|
||||
**/
|
||||
define('__ZBXE__', true);
|
||||
|
||||
/**
|
||||
* @brief 필요한 설정 파일들을 include
|
||||
**/
|
||||
require_once('../../config/config.inc.php');
|
||||
|
||||
// id/ password 구함
|
||||
$id = $_POST['id'];
|
||||
$pw = $_POST['pw'];
|
||||
|
||||
// 저장되어 있는 비밀번호와 비교
|
||||
$oContext = &Context::getInstance();
|
||||
$oContext->init();
|
||||
$db_info = $oContext->getDBInfo();
|
||||
|
||||
// install 모듈의 언어파일을 로드
|
||||
Context::loadLang(_XE_PATH_.'modules/install/lang');
|
||||
Context::loadLang(_XE_PATH_.'modules/admin/lang');
|
||||
Context::loadLang(_XE_PATH_.'tools/validator/lang');
|
||||
|
||||
// 설치가 되어 있지 않을 경우
|
||||
if(!Context::isInstalled()) {
|
||||
|
||||
$msg = Context::getLang('msg_db_not_setted');
|
||||
|
||||
// 인증 정보가 없을 경우
|
||||
} elseif(!isset($id) || !isset($pw)) {
|
||||
|
||||
|
||||
// 입력된 정보와 저장된 정보 비교
|
||||
} else if($id !== $db_info->db_userid || $pw !== $db_info->db_password) {
|
||||
|
||||
if($id !== $db_info->db_userid) $msg = sprintf($lang->filter->equalto, Context::getLang('user_id'));
|
||||
else $msg = sprintf($lang->filter->equalto, Context::getLang('password'));
|
||||
|
||||
// 출력
|
||||
} else if($id === $db_info->db_userid && $pw === $db_info->db_password) {
|
||||
|
||||
// 현재 버전을 구함
|
||||
$ver = __ZBXE_VERSION__;
|
||||
|
||||
// 현재 버전에 맞는 배포 정보를 구함
|
||||
$header = "GET /validatorLogs/{$ver}.log HTTP/1.0\r\nHost: news.zeroboard.com\r\n\r\n";
|
||||
$is_started = false;
|
||||
$f = fsockopen('news.zeroboard.com', 80);
|
||||
fputs($f, $header);
|
||||
while($buff = fgets($f, 1024)) {
|
||||
if(!trim($buff)) $is_started = true;
|
||||
if($is_started && trim($buff)) {
|
||||
$buff = trim($buff);
|
||||
$pos = strpos($buff,',');
|
||||
$size = (int)substr($buff,0,$pos);
|
||||
$filename = substr($buff,$pos+1);
|
||||
if($filename && $size) $source[$filename] = $size;
|
||||
}
|
||||
}
|
||||
fclose($f);
|
||||
|
||||
if(!count($source)) $msg = Context::getLang('msg_cannot_get_source_files');
|
||||
else {
|
||||
|
||||
// 현재 설치된 디렉토리와 비교
|
||||
$avoid_path = array(_XE_PATH_.'files');
|
||||
getFiles(_XE_PATH_, _XE_PATH_, $avoid_path, $target);
|
||||
if(!count($target)) $msg = Context::getLang('msg_cannot_get_target_files');
|
||||
else {
|
||||
// 파일 수를 지정
|
||||
Context::set('source_cnt', count($source));
|
||||
Context::set('target_cnt', count($target));
|
||||
|
||||
// 최신 버전 정보 구함
|
||||
$oAdminView = &getAdminView('admin');
|
||||
$oAdminView->dispAdminIndex();
|
||||
|
||||
// 누락된 파일 구함
|
||||
$leaveouts = array();
|
||||
foreach($source as $key => $val) {
|
||||
if(!isset($target[$key])) $leaveouts[] = $key;
|
||||
}
|
||||
Context::set('leaveouts', $leaveouts);
|
||||
|
||||
// 수정된 파일 구함
|
||||
$modified = array();
|
||||
foreach($source as $key => $val) {
|
||||
if(isset($target[$key]) && $val!=$target[$key]) $modified[] = $key;
|
||||
}
|
||||
Context::set('modified', $modified);
|
||||
|
||||
// 추가된 파일 구함
|
||||
$added = array();
|
||||
foreach($target as $key => $val) {
|
||||
if(!isset($source[$key])) $added[] = $key;
|
||||
}
|
||||
Context::set('added', $added);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context::set('msg', $msg);
|
||||
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
print $oTemplate->compile('./tools/validator/','validator');
|
||||
|
||||
// recursive하게 돌면서 파일 정보 수집
|
||||
function getFiles($path, $base_path, $avoid_path, &$buff) {
|
||||
if(substr($path,-1)=='/') $path = substr($path,0,-1);
|
||||
if(substr($base_path,-1)=='/') $base_path = substr($base_path,0,-1);
|
||||
if(in_array($path, $avoid_path)) return;
|
||||
|
||||
$oDir = dir($path);
|
||||
while($item = $oDir->read()) {
|
||||
if(substr($item,0,1)=='.' && $item != '.htaccess' ) continue;
|
||||
$new_path = $path.'/'.$item;
|
||||
if(!is_dir($new_path)) {
|
||||
$filesize = filesize($new_path);
|
||||
$filename = substr($new_path, strlen($base_path)+1);
|
||||
$buff[$filename] = $filesize;
|
||||
} else {
|
||||
getFiles($new_path, $base_path, $avoid_path, $buff);
|
||||
}
|
||||
}
|
||||
$oDir->close();
|
||||
}
|
||||
?>
|
||||
13
tools/validator/lang/ko.lang.php
Normal file
13
tools/validator/lang/ko.lang.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
$lang->msg_cannot_get_source_files = '원본 파일을 다운로드 하지 못했습니다';
|
||||
$lang->msg_cannot_get_target_files = '설치된 대상 파일의 목록을 구하지 못했습니다';
|
||||
|
||||
$lang->files_count = '파일 수';
|
||||
$lang->source_files = '원본 파일';
|
||||
$lang->target_files = '대상 파일';
|
||||
|
||||
$lang->leaveout_files = '누락된 파일';
|
||||
$lang->modified_files = '수정된 파일';
|
||||
$lang->additional_files = '추가된 파일';
|
||||
?>
|
||||
18
tools/validator/style.css
Normal file
18
tools/validator/style.css
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
h1 { font-size:1.5em; font-family:tahoma; margin:0; padding:0; }
|
||||
hr { border:none; border-top:1px solid #555555; border-bottom:1px solid #888888; margin:0; margin-bottom:10px; padding:0; }
|
||||
blockquote { border:1px solid red; color:red; width:280px; margin:0 0 10px 0; padding:10px;}
|
||||
|
||||
code { display:block; clear:both; margin-bottom:10px;}
|
||||
code label { float:left; display:block; width:150px; }
|
||||
code input { display:block; width:150px; border:1px solid #AAAAAA; }
|
||||
|
||||
input.submit { width:300px; border:1px solid #AAAAAA;}
|
||||
|
||||
div.back { font-size:9pt; text-align:right; margin-bottom:10px; }
|
||||
div.back a { text-decoration:none; color:#888888; }
|
||||
|
||||
table { width:100%; border:none; font-size:9pt; background-color:#CCCCCC; }
|
||||
table thead th { background-color:#EFEFEF; padding:3px 0 3px 0; }
|
||||
table tbody th { background-color:#F3F3F3; vertical-align:top; color:#888888; padding:3px 0 3px 0; }
|
||||
table tbody td { background-color:#FFFFFF; font-family:verdana; padding:3px; }
|
||||
|
||||
92
tools/validator/validator.html
Normal file
92
tools/validator/validator.html
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="Generator" content="XE" />
|
||||
<title>XE Cache Cleaner</title>
|
||||
<link rel="stylesheet" href="./style.css" type="text/css" charset="UTF-8" media="all" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>XE File Validator</h1>
|
||||
<hr />
|
||||
|
||||
<!--@if($msg)-->
|
||||
<blockquote>{$msg}</blockquote>
|
||||
<!--@end-->
|
||||
|
||||
<!--@if($source_cnt && $target_cnt)-->
|
||||
<div class="back">[<a href="./">{$lang->cmd_back}</a>]</div>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>{$lang->source_files}</th>
|
||||
<th>{$lang->target_files}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{$lang->current_version}</th>
|
||||
<td colspan="2">{__ZBXE_VERSION__}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{$lang->released_version}</th>
|
||||
<td colspan="2"><a href="{$download_link}" onclick="window.open(this.href);return false;">{$released_version}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{$lang->current_path}</th>
|
||||
<td colspan="2">{_XE_PATH_}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{$lang->files_count}</th>
|
||||
<td>{$source_cnt}</td>
|
||||
<td>{$target_cnt}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{$lang->leaveout_files} ({count($leaveouts)})</th>
|
||||
<td>
|
||||
<!--@foreach($leaveouts as $val)-->
|
||||
{$val}<br />
|
||||
<!--@end-->
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{$lang->modified_files} ({count($modified)})</th>
|
||||
<td> </td>
|
||||
<td>
|
||||
<!--@foreach($modified as $val)-->
|
||||
{$val}<br />
|
||||
<!--@end-->
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{$lang->additional_files} ({count($added)})</th>
|
||||
<td> </td>
|
||||
<td>
|
||||
<!--@foreach($added as $val)-->
|
||||
{$val}<br />
|
||||
<!--@end-->
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!--@else-->
|
||||
<form action="./index.php" method="post">
|
||||
<code>
|
||||
<label for="db_id">{$lang->db_userid}</label>
|
||||
<input type="text" id="db_id" name="id" />
|
||||
</code>
|
||||
<code>
|
||||
<label for="db_pw">{$lang->db_password}</label>
|
||||
<input type="password" id="db_pw" name="pw" />
|
||||
</code>
|
||||
|
||||
<input type="submit" value="validate" class="submit"/>
|
||||
|
||||
</form>
|
||||
<!--@end-->
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue