diff --git a/.gitignore b/.gitignore index c791b941..6fe772bf 100644 --- a/.gitignore +++ b/.gitignore @@ -49,4 +49,5 @@ src/static/js/*.js src/apps/special/*.html src/static/flink/*.png src/static/rss/*.xml -src/a/baidunews.xml \ No newline at end of file +src/a/baidunews.xml +src/data/backupfile* diff --git a/src/admin/api.php b/src/admin/api.php index ad37366a..63388931 100644 --- a/src/admin/api.php +++ b/src/admin/api.php @@ -4,7 +4,7 @@ define('DEDEADMIN', str_replace("\\", '/', dirname(__FILE__))); require_once(DEDEADMIN.'/../system/common.inc.php'); require_once(DEDEINC.'/userlogin.class.php'); AjaxHead(); -$action = isset($action) && in_array($action, array('is_need_check_code','has_new_version','get_changed_files'))? $action : ''; +$action = isset($action) && in_array($action, array('is_need_check_code','has_new_version','get_changed_files','update_backup','get_update_versions'))? $action : ''; /** * 登录鉴权 * @@ -66,5 +66,45 @@ if ($action === 'is_need_check_code') { ), )); exit; +} else if($action === 'update_backup'){ + require_once(DEDEINC.'/libraries/dedehttpdown.class.php'); + checkLogin(); + // 获取本地更改过的文件 + $hashUrl = DEDEBIZCDN.'/release/'.$cfg_version_detail.'.json'; + $dhd = new DedeHttpDown(); + $dhd->OpenUrl($hashUrl); + $data = $dhd->GetJSON(); + $changedFiles = array(); + $enkey = substr(md5(substr($cfg_cookie_encode, 0, 5)), 0, 10); + $backupPath = DEDEDATA."/backupfile_{$enkey}"; + RmRecurse($backupPath); + mkdir($backupPath); + foreach ($data as $file) { + $realFile = DEDEROOT. str_replace("\\", '/', $file->filename); + if ( file_exists($realFile) && md5_file($realFile) !== $file->hash) { + // 备份文件 + $dstFile = $backupPath.'/'.str_replace("\\", '/', $file->filename); + @MkdirAll(dirname($dstFile),777); + copy($realFile, $dstFile); + } + } + echo json_encode(array( + "code" => 0, + "msg" => "", + "data" => array( + "backupdir" => "data/backupfile_{$enkey}", + ), + )); + exit; +} else if($action === 'get_update_versions'){ + require_once(DEDEINC.'/libraries/dedehttpdown.class.php'); + checkLogin(); + // 获取本地更改过的文件 + $offUrl = DEDEBIZURL."/versions?version={$cfg_version_detail}"; + $dhd = new DedeHttpDown(); + $dhd->OpenUrl($offUrl); + $data = $dhd->GetHtml(); + echo $data; + exit; } ?> \ No newline at end of file diff --git a/src/admin/templets/index_body.htm b/src/admin/templets/index_body.htm index bacf0daa..d540c1ba 100644 --- a/src/admin/templets/index_body.htm +++ b/src/admin/templets/index_body.htm @@ -26,10 +26,20 @@ cursor: pointer; } - #_fileList{ + #_fileList,#_verList { height: 200px; overflow-y: scroll; } + + #_msgInfo { + display: none; + } + + @media (min-width:480px) { + .modal-dialog { + max-width: 55%; + } + } @@ -201,31 +211,48 @@
更新诊断出数据结构有问题,可能无法正常使用后台,是否尝试修复数据? | +软件发下以下版本的更新文件。 | +
+ ...
+ |