Merge pull request #492 from midoks/dev

centos8 mongodb安装优化
pull/543/head
Mr Chen 2 years ago committed by GitHub
commit 1cd7667f7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 71
      class/core/plugins_api.py
  2. 2
      plugins/mongodb/init.d/mongodb.service.tpl
  3. 13
      route/static/app/soft.js
  4. 6
      route/templates/default/files.html

@ -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)

@ -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

@ -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 = '<a class="btlink" onclick="addVersion(\'' + plugin.name + '\',\'' + version_info + '\',\'' + plugin.tip + '\',this,\'' + plugin.title + '\',' + plugin.install_pre_inspection + ')">安装</a>';
if (plugin.setup == true) {
@ -118,9 +117,15 @@ function getSList(isdisplay) {
softPath = '<span class="glyphicon glyphicon-folder-open" title="' + plugin.path + '" onclick="openPath(\'' + plugin.path + '\')"></span>';
if (plugin.coexist){
indexshow = '<div class="index-item"><input class="btswitch btswitch-ios" id="index_' + plugin.name + plugin.versions + '" type="checkbox" ' + checked + '><label class="btswitch-btn" for="index_' + plugin.name + plugin.versions + '" onclick="toIndexDisplay(\'' + plugin.name + '\',\'' + plugin.versions + '\',\'' + plugin.coexist +'\')"></label></div>';
indexshow = '<div class="index-item">\
<input class="btswitch btswitch-ios" id="index_' + plugin.name + plugin.versions + '" type="checkbox" ' + checked + '>\
<label class="btswitch-btn" for="index_' + plugin.name + plugin.versions + '" onclick="toIndexDisplay(\'' + plugin.name + '\',\'' + plugin.versions + '\',\'' + plugin.coexist +'\')"></label>\
</div>';
} else {
indexshow = '<div class="index-item"><input class="btswitch btswitch-ios" id="index_' + plugin.name + '" type="checkbox" ' + checked + '><label class="btswitch-btn" for="index_' + plugin.name + '" onclick="toIndexDisplay(\'' + plugin.name + '\',\'' + plugin.setup_version + '\')"></label></div>';
indexshow = '<div class="index-item">\
<input class="btswitch btswitch-ios" id="index_' + plugin.name + '" type="checkbox" ' + checked + '>\
<label class="btswitch-btn" for="index_' + plugin.name + '" onclick="toIndexDisplay(\'' + plugin.name + '\',\'' + plugin.setup_version + '\')"></label>\
</div>';
}
if (plugin.status == true) {

@ -64,6 +64,12 @@
<script src="/static/js/jquery.contextify.min.js?v={{config.version}}"></script>
<script type="text/javascript">
$("#SearchValue").focus().keyup(function(e){
if(e.keyCode == 13) searchFile(1);
});
setTimeout(function() {
getDisk();
}, 500);

Loading…
Cancel
Save