pull/632/head
Mr Chen 5 months ago
parent 0bd476340a
commit ccb02f14a6
  1. 6
      plugins/webstats/index.py
  2. 5
      plugins/webstats/info.json
  3. 6
      plugins/webstats/install.sh
  4. 2
      plugins/webstats/tool_task.py
  5. 17
      web/utils/plugin.py

@ -1398,6 +1398,10 @@ def installPreInspection():
return "请先安装OpenResty" return "请先安装OpenResty"
return 'ok' return 'ok'
def uninstallPreInspection():
stop()
return 'ok'
if __name__ == "__main__": if __name__ == "__main__":
func = sys.argv[1] func = sys.argv[1]
if func == 'status': if func == 'status':
@ -1412,6 +1416,8 @@ if __name__ == "__main__":
print(reload()) print(reload())
elif func == 'install_pre_inspection': elif func == 'install_pre_inspection':
print(installPreInspection()) print(installPreInspection())
elif func == 'uninstall_pre_inspection':
print(uninstallPreInspection())
elif func == 'run_info': elif func == 'run_info':
print(runInfo()) print(runInfo())
elif func == 'get_global_conf': elif func == 'get_global_conf':

@ -16,10 +16,11 @@
"name": "webstats", "name": "webstats",
"title": "网站统计", "title": "网站统计",
"shell": "install.sh", "shell": "install.sh",
"versions":["0.2.5"], "versions":"0.2.5",
"tip": "soft", "tip": "soft",
"install_pre_inspection":true, "install_pre_inspection":true,
"checks": "server/webstats", "uninstall_pre_inspection":true,
"checks": "server/webstats/version.pl",
"path": "server/webstats", "path": "server/webstats",
"display": 1, "display": 1,
"author": "midoks", "author": "midoks",

@ -130,12 +130,12 @@ Install_App()
if [ -f $serverPath/source/webstats/GeoLite2-City.mmdb ];then if [ -f $serverPath/source/webstats/GeoLite2-City.mmdb ];then
cp -rf $serverPath/source/webstats/GeoLite2-City.mmdb $serverPath/webstats/GeoLite2-City.mmdb cp -rf $serverPath/source/webstats/GeoLite2-City.mmdb $serverPath/webstats/GeoLite2-City.mmdb
fi fi
echo "${VERSION}" > $serverPath/webstats/version.pl
cd $rootPath && python3 plugins/webstats/index.py start cd $rootPath && python3 plugins/webstats/index.py start
echo "${VERSION}" > $serverPath/webstats/version.pl
echo '网站统计安装完成' echo '网站统计安装完成'
# delete install data # delete install data
if [ -d $serverPath/source/webstats/lsqlite3_fsl09y ];then if [ -d $serverPath/source/webstats/lsqlite3_fsl09y ];then
rm -rf $serverPath/source/webstats/lsqlite3_fsl09y rm -rf $serverPath/source/webstats/lsqlite3_fsl09y

@ -93,7 +93,7 @@ def removeBgTask():
"id=?", (cfg["task_id"],)).find() "id=?", (cfg["task_id"],)).find()
if res and res["id"] == cfg["task_id"]: if res and res["id"] == cfg["task_id"]:
data = MwCrontab.instance().delete(cfg["task_id"]) data = MwCrontab.instance().delete(cfg["task_id"])
if data[0]: if data['status']:
# print(data[1]) # print(data[1])
cfg["task_id"] = -1 cfg["task_id"] = -1
mw.writeFile(getTaskConf(), json.dumps(cfg)) mw.writeFile(getTaskConf(), json.dumps(cfg))

@ -481,11 +481,13 @@ class plugin(object):
pInfo['setup'] = os.path.exists(pInfo['install_checks']) pInfo['setup'] = os.path.exists(pInfo['install_checks'])
if coexist and pInfo['setup']: if coexist and pInfo['setup']:
pInfo['setup_version'] = info['versions'] pInfo['setup_version'] = info['versions']
else: elif pInfo['setup']:
pInfo['setup_version'] = self.getVersion(pInfo['install_checks']) if os.path.isdir(pInfo['install_checks']):
pInfo['setup_version'] = self.getVersion(pInfo['install_checks'])
else:
pInfo['setup_version'] = mw.readFile(pInfo['install_checks']).strip()
if 'install_pre_inspection' in info: if 'install_pre_inspection' in info:
pInfo['install_pre_inspection'] = info['install_pre_inspection'] pInfo['install_pre_inspection'] = info['install_pre_inspection']
@ -792,7 +794,7 @@ class plugin(object):
if 'coexist' in info and info['coexist']: if 'coexist' in info and info['coexist']:
name = info['title'] + '-'+ version name = info['title'] + '-'+ version
if name in data: if name in data:
del(data[name]) del(data[name])
thisdb.setOption(self.__plugin_status_cachekey, json.dumps(data)) thisdb.setOption(self.__plugin_status_cachekey, json.dumps(data))
# shell/bash方式调用 # shell/bash方式调用
@ -801,6 +803,10 @@ class plugin(object):
args = '', args = '',
script = 'index', script = 'index',
): ):
if mw.inArray(['start','stop','restart','reload','uninstall_pre_inspection','install','uninstall'], func):
self.runByCache(name, func, version)
path = self.__plugin_dir + '/' + name + '/' + script + '.py' path = self.__plugin_dir + '/' + name + '/' + script + '.py'
if not os.path.exists(path): if not os.path.exists(path):
path = self.__plugin_dir + '/' + name + '/' + name + '.py' path = self.__plugin_dir + '/' + name + '/' + name + '.py'
@ -816,8 +822,7 @@ class plugin(object):
py_cmd = 'cd ' + mw.getPanelDir() + " && "+ py_cmd py_cmd = 'cd ' + mw.getPanelDir() + " && "+ py_cmd
data = mw.execShell(py_cmd) data = mw.execShell(py_cmd)
if mw.inArray(['start','stop','restart','reload'], func):
self.runByCache(name, func, version)
# print(data) # print(data)
if mw.isDebugMode(): if mw.isDebugMode():

Loading…
Cancel
Save