该系统为使用PHP开发的基于web的Subversion(SVN)服务器端管理工具。支持功能:SVN仓库管理、SVN用户管理、SVN分组管理、目录授权、目录浏览、Hooks管理、在线dump备份、在线备份恢复、SVN用户禁用、服务器状态管理、日志管理、消息通知、更新检测...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

85 lines
2.6 KiB

<?php
declare(strict_types=1);
/*
* 与系统更新操作相关
*/
class Update extends Controller
{
function __construct()
{
/*
* 避免子类的构造函数覆盖父类的构造函数
*/
parent::__construct();
/*
* 其它自定义操作
*/
$this->Config = new Config();
}
/**
* 获取当前版本信息
*/
function GetVersionInfo($requestPayload)
{
$data['status'] = 1;
$data['message'] = '成功';
$data['data'] = array(
'current_verson' => VERSION,
'github' => 'https://github.com/witersen/svnAdminV2.0',
'gitee' => 'https://gitee.com/witersen/SvnAdminV2.0',
'author' => 'https://www.witersen.com'
);
return $data;
}
/**
* 检测新版本
*/
function CheckUpdate($requestPayload)
{
foreach (UPDATE_SERVER as $key => $value) {
$versionInfo = FunCurlRequest($value);
if ($versionInfo != null) {
$versionInfo = json_decode($versionInfo, true);
$latestVersion = $versionInfo['latestVersion'];
if ($latestVersion == VERSION) {
$data['status'] = 1;
$data['message'] = '当前版本为最新版';
$data['data'] = null;
return $data;
} else if ($latestVersion > VERSION) {
$data['status'] = 1;
$data['message'] = '有更新';
$data['data'] = array(
'latestVersion' => $versionInfo['latestVersion'],
'fixedContent' => implode('<br>', $versionInfo['fixedContent']) == '' ? '暂无内容' : implode('<br>', $versionInfo['fixedContent']),
'newContent' => implode('<br>', $versionInfo['newContent']) == '' ? '暂无内容' : implode('<br>', $versionInfo['newContent']),
'updateType' => $versionInfo['updateType'],
'updateStep' => $versionInfo['updateStep']
);
return $data;
} else if ($latestVersion < VERSION) {
$data['status'] = 0;
$data['message'] = '系统版本错误';
$data['data'] = null;
return $data;
}
}
}
$data['status'] = 0;
$data['message'] = '检测更新超时';
return $data;
}
/**
* 确认更新
*/
function StartUpdate($requestPayload)
{
}
}