diff --git a/class/core/plugins_api.py b/class/core/plugins_api.py index 936c0b444..55ddf0352 100755 --- a/class/core/plugins_api.py +++ b/class/core/plugins_api.py @@ -52,6 +52,7 @@ class plugins_api: __plugin_dir = 'plugins' __type = 'data/json/type.json' __index = 'data/json/index.json' + __index_data = None setupPath = None def __init__(self): @@ -60,6 +61,14 @@ class plugins_api: self.__type = mw.getRunDir() + '/data/json/type.json' self.__index = mw.getRunDir() + '/data/json/index.json' + self.initIndexData() + + def initIndexData(self): + if not os.path.exists(self.__index): + mw.writeFile(self.__index, '[]') + + self.__index_data = json.loads(mw.readFile(self.__index)) + ##### ----- start ----- ### def listApi(self): sType = request.args.get('type', '0') @@ -615,20 +624,37 @@ class plugins_api: return plugins_info - def checkDisplayIndex(self, name, version): - if not os.path.exists(self.__index): - mw.writeFile(self.__index, '[]') + def checkIndexList(self, name, version): + indexList = self.__index_data + for i in indexList: + nv = i.split('-') + if nv[0] == name: + return True + return False - indexList = json.loads(mw.readFile(self.__index)) - if type(version) == list: - for index in range(len(version)): - vname = name + '-' + version[index] + def checkDisplayIndex(self, name, version, coexist): + # if not os.path.exists(self.__index): + # mw.writeFile(self.__index, '[]') + # indexList = json.loads(mw.readFile(self.__index)) + + indexList = self.__index_data + if coexist: + if type(version) == list: + for index in range(len(version)): + vname = name + '-' + version[index] + if vname in indexList: + return True + else: + vname = name + '-' + version if vname in indexList: return True + else: - vname = name + '-' + version - if vname in indexList: - return True + if type(version) == list: + for index in range(len(version)): + return self.checkIndexList(name, version) + else: + return self.checkIndexList(name, version) return False def getVersion(self, path): @@ -695,7 +721,7 @@ class plugins_api: pInfo['task'] = self.checkSetupTask( pInfo['name'], info['versions'], coexist) pInfo['display'] = self.checkDisplayIndex( - info['name'], pInfo['versions']) + info['name'], pInfo['versions'], coexist) pInfo['setup'] = os.path.exists(pInfo['install_checks']) @@ -800,10 +826,10 @@ class plugins_api: continue path = self.__plugin_dir + '/' + dirinfo if os.path.isdir(path): - json_file = path + '/info.json' - if os.path.exists(json_file): + info_file = path + '/info.json' + if os.path.exists(info_file): try: - data = json.loads(mw.readFile(json_file)) + data = json.loads(mw.readFile(info_file)) # 判断是否搜索 if kw != '' and not self.searchKey(data, kw): continue @@ -976,19 +1002,24 @@ class plugins_api: plugin_name = '-'.join(tmpArr) plugin_ver = tmp[tmp_len - 1] - json_file = self.__plugin_dir + '/' + plugin_name + '/info.json' - if os.path.exists(json_file): - content = mw.readFile(json_file) + read_json_file = self.__plugin_dir + '/' + plugin_name + '/info.json' + if os.path.exists(read_json_file): + content = mw.readFile(read_json_file) try: data = json.loads(content) data = self.makeList(data) for index in range(len(data)): - if data[index]['versions'] == plugin_ver or plugin_ver in data[index]['versions']: + if data[index]['coexist']: + if data[index]['versions'] == plugin_ver or plugin_ver in data[index]['versions']: + data[index]['display'] = True + plist.append(data[index]) + continue + else: data[index]['display'] = True plist.append(data[index]) - continue + except Exception as e: - print('getIndexList:', e) + print('getIndexList:', mw.getTracebackInfo()) # 使用gevent模式时,无法使用多进程 # plist = self.checkStatusMProcess(plist) diff --git a/plugins/mongodb/init.d/mongodb.service.tpl b/plugins/mongodb/init.d/mongodb.service.tpl index 65d164301..ceb19302f 100644 --- a/plugins/mongodb/init.d/mongodb.service.tpl +++ b/plugins/mongodb/init.d/mongodb.service.tpl @@ -9,7 +9,7 @@ User=root Group=root #EnvironmentFile=-/etc/default/mongod Environment="MONGODB_CONFIG_OVERRIDE_NOFORK=1" -Environment="LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/www/server/lib/openssl11/lib" +Environment="LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/www/server/lib/openssl11/lib" PIDFile={$SERVER_PATH}/mongodb/mongodb.pid ExecStart={$SERVER_PATH}/mongodb/bin/mongod -f {$SERVER_PATH}/mongodb/mongodb.conf ExecReload=/bin/kill -HUP $MAINPID diff --git a/route/static/app/soft.js b/route/static/app/soft.js index a107d360a..3dd364025 100755 --- a/route/static/app/soft.js +++ b/route/static/app/soft.js @@ -95,7 +95,7 @@ function getSList(isdisplay) { checked = plugin.display ? 'checked' : ''; - if (typeof plugin.versions == "string"){ + if (typeof(plugin.versions) == "string" ){ version_info += plugin.versions + '|'; } else { for (var j = 0; j < len; j++) { @@ -106,7 +106,6 @@ function getSList(isdisplay) { version_info = version_info.substring(0, version_info.length - 1); } - var handle = '安装'; if (plugin.setup == true) { @@ -118,9 +117,15 @@ function getSList(isdisplay) { softPath = ''; if (plugin.coexist){ - indexshow = '
'; + indexshow = '