This commit is contained in:
midoks
2018-11-04 23:02:45 +08:00
parent c5dcd09712
commit 350df66aab
4 changed files with 9 additions and 11 deletions
-4
View File
@@ -72,10 +72,6 @@ def GetRandomString(length):
return str
def retJson(status, msg, data=()):
return jsonify({'status': status, 'msg': msg, 'data': data})
def getJson(data):
import json
return json.dumps(data)
+1 -2
View File
@@ -1,8 +1,7 @@
{
"sort": 7,
"ps": "最流行的SVN代码共享管理软件",
"install": "install.sh",
"uninstall": "uninstall.sh",
"shell": "install.sh",
"name": "csvn",
"title": "CSVN",
"default": false,
+1 -2
View File
@@ -5,8 +5,7 @@
"type":"扩展",
"ps":"测试服务器基础性能!",
"versions":"1.3",
"install":"install.sh",
"uninstall":"uninstall.sh",
"shell":"install.sh",
"checks":"/www/server/panel/plugin/score",
"author":"mdserver-web",
"home":"github.com/midoks/mdserver-web",
+7 -3
View File
@@ -77,6 +77,7 @@ def install():
rundir = public.getRunDir()
name = request.form.get('name', '')
version = request.form.get('version', '')
mmsg = '安装'
if hasattr(request.form, 'upgrade'):
@@ -84,7 +85,10 @@ def install():
mmsg = 'upgrade'
if name.strip() == '':
return public.retJson(-1, "缺少name数据!", ())
return public.returnJson(-1, "缺少name数据!", ())
if version.strip() == '':
return public.returnJson(-1, "缺少版本信息!", ())
infoJsonPos = __plugin_name + '/' + name + '/' + 'info.json'
@@ -94,9 +98,9 @@ def install():
pluginInfo = json.loads(public.readFile(infoJsonPos))
execstr = "cd " + os.getcwd() + "/plugins/" + \
name + " && /bin/bash " + pluginInfo["install"]
name + " && /bin/bash " + pluginInfo["shell"] + " install" + version
taskAdd = (None, mmsg + '[' + name + '-' + "1" + ']',
taskAdd = (None, mmsg + '[' + name + '-' + version + ']',
'execshell', '0', time.strftime('%Y-%m-%d %H:%M:%S'), execstr)
public.M('tasks').add('id,name,type,status,addtime, execstr', taskAdd)