This commit is contained in:
2026-10-24 01:24:21 +08:00
parent 8a2a4d1a84
commit cd133fc278
2 changed files with 27 additions and 0 deletions

View File

@@ -850,6 +850,29 @@ def installPreInspection(version):
return 'ok'
def upgradeCheck(version):
info = getPluginDir() + '/info.json'
content = mw.readFile(info)
content = json.loads(content)
versions = content['versions']
updates = content['updates']
idx = versions.index(version)
full_verion = updates[idx]
# 找到本地版本信息对比
# /usr/bin/php5.6 -d display_startup_errors=0 -r 'echo PHP_VERSION;' 2>/dev/null
php_path = "/usr/bin/php"+version
if not os.path.exists(php_path):
return mw.returnJson(0,"pass")
cmd = php_path + " -d display_startup_errors=0 -r 'echo PHP_VERSION;' 2>/dev/null"
cmd_data = mw.execShell(cmd)
local_full_version = cmd_data[0].split("-")[0]
if local_full_version != full_verion:
return mw.returnJson(1, "有新版",full_verion)
return mw.returnJson(0,"pass")
if __name__ == "__main__":
if len(sys.argv) < 3:
@@ -879,6 +902,8 @@ if __name__ == "__main__":
print(initdInstall(version))
elif func == 'initd_uninstall':
print(initdUinstall(version))
elif func == "upgrade_check":
print(upgradeCheck(version))
elif func == 'fpm_log':
print(fpmLog(version))
elif func == 'fpm_slow_log':

View File

@@ -5,7 +5,9 @@
"name": "php-apt",
"title": "PHP[APT]",
"coexist": true,
"upgrade": true,
"versions": ["56","70","71","72","73","74","80","81","82","83","84", "85"],
"updates":["5.6.40","7.0.33","7.1.33","7.2.34","7.3.33","7.4.33","8.0.30","8.1.33","8.2.35","8.3.36","8.4.27","8.5.12"],
"install_pre_inspection":true,
"tip": "soft",
"checks": "server/php-apt/VERSION",