pull/628/head
Mr Chen 7 months ago
parent a35ae6df9e
commit 7812c4983f
  1. 16
      web/core/mw.py
  2. 13
      web/utils/mwplugin.py

@ -69,17 +69,23 @@ def getRunDir():
def getRootDir(): def getRootDir():
return os.path.dirname(getRunDir()) return os.path.dirname(getRunDir())
def getPanelDir():
return getRootDir()
def getFatherDir():
return os.path.dirname(os.path.dirname(getPanelDir()))
def getPluginDir(): def getPluginDir():
return getRootDir() + '/plugins' return getPanelDir() + '/plugins'
def getPanelDataDir(): def getPanelDataDir():
return getRootDir() + '/data' return getPanelDir() + '/data'
def getMWLogs(): def getMWLogs():
return getRootDir() + '/logs' return getPanelDir() + '/logs'
def getPanelTmp(): def getPanelTmp():
return getRootDir() + '/tmp' return getPanelDir() + '/tmp'
def getServerDir(): def getServerDir():
@ -145,7 +151,7 @@ def isNumber(s):
pass pass
return False return False
def getPathSuffix(path): def getPathSuffix(path):
return os.path.splitext(path)[-1] return os.path.splitext(path)[-1]

@ -103,6 +103,7 @@ class MwPlugin(object):
def getVersion(self, path): def getVersion(self, path):
version_t = path + '/version.pl' version_t = path + '/version.pl'
print(version_t)
if os.path.exists(version_t): if os.path.exists(version_t):
return mw.readFile(version_t).strip() return mw.readFile(version_t).strip()
return '' return ''
@ -152,11 +153,16 @@ class MwPlugin(object):
path = '' path = ''
coexist = False coexist = False
if info["checks"].startswith('/'):
checks = info["checks"]
else:
checks = mw.getFatherDir() + '/' + info['checks']
if 'path' in info: if 'path' in info:
path = info['path'] path = info['path']
if not path.startswith('/'): if not path.startswith('/'):
path = mw.getRootDir() + '/' + path path = mw.getFatherDir() + '/' + path
if 'coexist' in info and info['coexist']: if 'coexist' in info and info['coexist']:
coexist = True coexist = True
@ -192,9 +198,14 @@ class MwPlugin(object):
if checks.find('VERSION') > -1: if checks.find('VERSION') > -1:
pInfo['install_checks'] = checks.replace('VERSION', info['versions']) pInfo['install_checks'] = checks.replace('VERSION', info['versions'])
if path.find('VERSION') > -1:
pInfo['path'] = path.replace('VERSION', info['versions'])
pInfo['display'] = self.checkDisplayIndex(info['name'], pInfo['versions'], coexist) pInfo['display'] = self.checkDisplayIndex(info['name'], pInfo['versions'], coexist)
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: else:

Loading…
Cancel
Save