1 Star 0 Fork 89

DevOps / YoungxjTools

forked from Young小杰 / YoungxjTools 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
UpdateAction.php 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
Young小杰 提交于 2018-07-12 22:05 . 1.3发布
<?php
include 'function.base.php';
$CONF = require('function.config.php');
define('VERSION', $CONF['config']['VERSION']);
// 应用目录为当前目录
define('APP_PATH', __DIR__ . '/');
function UpdateAction(){
include 'Autoupdate.class.php';
$update = new Autoupdate(APP_PATH,false);
$update->currentVersion = VERSION;
$update->updateUrl = 'https://api.yum6.cn/service/';
$latest = $update->checkUpdate();
if ($latest !== false) {
if ($latest > $update->currentVersion) {
if ($update->update()) {
if($update->replaceupdate()){
$res=['code'=>'0000','msg'=>'更新成功,欢迎体验最新的YoungxjTools系统^_^'];
}else{
$res=['code'=>'0004','msg'=>'更新文件效验失败!'];
}
}else {
$res=['code'=>'0002','msg'=>'在线更新失败,请尝试手动更新!信息:'.$update->getLastError()];
}
}else {
$res=['code'=>'0001','msg'=>'没有发现可用的新版本!'];
}
} else {
$res=['code'=>'0003','msg'=>$update->getLastError()];
}
echo json_encode($res);
}
if($_POST['token']==md5(md5((int)(time()/1200)).'YoungxjTools')){
UpdateAction();
}else{
exit('非法请求');
}
PHP
1
https://gitee.com/podipod/YoungxjTools.git
git@gitee.com:podipod/YoungxjTools.git
podipod
YoungxjTools
YoungxjTools
master

搜索帮助