pull/109/head
midoks 7 years ago
parent c5dcd09712
commit 350df66aab
  1. 4
      class/public.py
  2. 3
      plugins/csvn/info.json
  3. 3
      plugins/score/info.json
  4. 10
      route/plugins.py

@ -72,10 +72,6 @@ def GetRandomString(length):
return str return str
def retJson(status, msg, data=()):
return jsonify({'status': status, 'msg': msg, 'data': data})
def getJson(data): def getJson(data):
import json import json
return json.dumps(data) return json.dumps(data)

@ -1,8 +1,7 @@
{ {
"sort": 7, "sort": 7,
"ps": "最流行的SVN代码共享管理软件", "ps": "最流行的SVN代码共享管理软件",
"install": "install.sh", "shell": "install.sh",
"uninstall": "uninstall.sh",
"name": "csvn", "name": "csvn",
"title": "CSVN", "title": "CSVN",
"default": false, "default": false,

@ -5,8 +5,7 @@
"type":"扩展", "type":"扩展",
"ps":"测试服务器基础性能!", "ps":"测试服务器基础性能!",
"versions":"1.3", "versions":"1.3",
"install":"install.sh", "shell":"install.sh",
"uninstall":"uninstall.sh",
"checks":"/www/server/panel/plugin/score", "checks":"/www/server/panel/plugin/score",
"author":"mdserver-web", "author":"mdserver-web",
"home":"github.com/midoks/mdserver-web", "home":"github.com/midoks/mdserver-web",

@ -77,6 +77,7 @@ def install():
rundir = public.getRunDir() rundir = public.getRunDir()
name = request.form.get('name', '') name = request.form.get('name', '')
version = request.form.get('version', '')
mmsg = '安装' mmsg = '安装'
if hasattr(request.form, 'upgrade'): if hasattr(request.form, 'upgrade'):
@ -84,7 +85,10 @@ def install():
mmsg = 'upgrade' mmsg = 'upgrade'
if name.strip() == '': 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' infoJsonPos = __plugin_name + '/' + name + '/' + 'info.json'
@ -94,9 +98,9 @@ def install():
pluginInfo = json.loads(public.readFile(infoJsonPos)) pluginInfo = json.loads(public.readFile(infoJsonPos))
execstr = "cd " + os.getcwd() + "/plugins/" + \ 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) 'execshell', '0', time.strftime('%Y-%m-%d %H:%M:%S'), execstr)
public.M('tasks').add('id,name,type,status,addtime, execstr', taskAdd) public.M('tasks').add('id,name,type,status,addtime, execstr', taskAdd)

Loading…
Cancel
Save