lylme_spage/admin/update.php

84 lines
4.2 KiB
PHP
Raw Normal View History

2022-03-05 13:58:09 +08:00
<?php
$title = '检查更新';
include './head.php';
2022-05-21 05:53:31 +08:00
@unlink('log.txt');
2022-05-03 14:16:31 +08:00
$update = update();
2022-03-05 13:58:09 +08:00
?>
<!--页面主要内容-->
<main class="lyear-layout-content">
<div class="container-fluid">
<?php
2022-03-27 03:01:44 +08:00
if(getver($update['version']) > getver($conf['version']) && !empty($update['version']) ) {
2022-05-23 12:43:10 +08:00
echo '<div class="alert alert-info" role="alert">发现新版本:'.$update['version'].'&nbsp;&nbsp;当前版本:</b>'.$conf['version'].'&nbsp;&nbsp;<a href="https://gitee.com/LyLme/lylme_spage/releases" target="_blant" class="alert-link">查看发行版</a></div>
2022-03-27 03:01:44 +08:00
<div class="card"><div class="card-header"><h4>更新说明</h4></div><ul class="list-group">
'.$update['update_log'].'
2022-05-23 12:43:10 +08:00
<li class="list-group-item"><button onclick="update()" class="btn btn-primary">更新</button></li>';
2022-03-27 03:01:44 +08:00
} else if(!empty($update['version'])) {
echo '<div class="alert alert-success" role="alert">当前已是最新版本!&nbsp;&nbsp;<a href="https://gitee.com/LyLme/lylme_spage/releases" target="_blant" class="alert-link">查看发行版</a></div>
2022-03-05 13:58:09 +08:00
<div class="card"><div class="card-header"><h4>版本更新</h4></div><ul class="list-group">
<li class="list-group-item"><b>当前版本:</b>'.$conf['version'].'</li>
<li class="list-group-item"><b>最新版本:</b>'.$update['version'].'</li>';
2022-03-27 03:01:44 +08:00
} else {
echo '<div class="alert alert-danger" role="alert">检查更新失败!</div>
2022-03-05 13:58:09 +08:00
<div class="card"><div class="card-header"><h4>版本更新</h4></div><ul class="list-group">
<li class="list-group-item"><b>当前版本:</b>'.$conf['version'].'</li>
2022-05-23 12:43:10 +08:00
<li class="list-group-item"><b>手动更新:</b>请前往<a href="https://gitee.com/LyLme/lylme_spage/releases" target="_blant" class="alert-link">码云</a>下载最新版本<code>lylme_spage_update.zip</code>后缀的更新包上传到网站根目录解压即可,程序会自动更新数据库</a></li>';
2022-03-05 13:58:09 +08:00
}
2022-03-27 03:01:44 +08:00
?>
2022-03-05 13:58:09 +08:00
</ul></div>
</div>
</main>
</div>
</div>
2022-05-23 12:43:10 +08:00
<?php
2022-03-27 03:01:44 +08:00
include './footer.php';
2022-05-23 12:43:10 +08:00
?>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.1.1/layer.min.js" type="application/javascript"></script>
<script type="text/javascript" src="js/lightyear.js"></script>
<script src="js/bootstrap-notify.min.js"></script>
<link href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery-confirm/3.3.0/jquery-confirm.min.css" type="text/css" rel="stylesheet" />
<script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery-confirm/3.3.0/jquery-confirm.min.js" type="application/javascript"></script>
<script>
function update() {
$.confirm({
title: '更新',
content: '<p><b>注意:更新会替换大部分文件(不会删除原有文件)</b></p><p>若您修改了源码的内容,为防止丢失请先进行备份</p><p>另外不建议通过修改源码的方式来修改内容本程序预留了自定义JS的功能建议通过JS的方式来修改内容欢迎加群讨论获取',
type: 'orange',
buttons: {
omg: {
text: '更新',
btnClass: 'btn-orange',
action: function(){
lightyear.loading('show');
$.ajax({
url:"ajax_link.php?submit=update",
method:"POST",
data:{file:"<?php echo $update['file'] ?>"},
success:function(data){
if(data == 'success'){
lightyear.loading('hide');
lightyear.notify('更新成功!', 'success', 1000);
window.location.replace("./");
return true;
}else{
lightyear.loading('hide');
lightyear.notify(data, 'warning', 2000);
return false;
}
},
error:function(data){
layer.msg('服务器错误');
lightyear.loading('hide');
return false;
}
});
}
},
close: {
text: '取消',
}
}
});
}
</script>