diff --git a/plugins/gitea/index.py b/plugins/gitea/index.py index b16b39a5f..1f480729d 100755 --- a/plugins/gitea/index.py +++ b/plugins/gitea/index.py @@ -170,12 +170,12 @@ def initDreplace(): def getRootUrl(): content = mw.readFile(getConf()) - rep = 'ROOT_URL\s*=\s*(.*)' + rep = r'ROOT_URL\s*=\s*(.*)' tmp = re.search(rep, content) if tmp: return tmp.groups()[0] - rep = 'EXTERNAL_URL\s*=\s*(.*)' + rep = r'EXTERNAL_URL\s*=\s*(.*)' tmp = re.search(rep, content) if tmp: return tmp.groups()[0] @@ -184,7 +184,7 @@ def getRootUrl(): def getSshPort(): content = mw.readFile(getConf()) - rep = 'SSH_PORT\s*=\s*(.*)' + rep = r'SSH_PORT\s*=\s*(.*)' tmp = re.search(rep, content) if not tmp: return '' @@ -193,7 +193,7 @@ def getSshPort(): def getHttpPort(): content = mw.readFile(getConf()) - rep = 'HTTP_PORT\s*=\s*(.*)' + rep = r'HTTP_PORT\s*=\s*(.*)' tmp = re.search(rep, content) if not tmp: return '' @@ -202,7 +202,7 @@ def getHttpPort(): def getRootPath(): content = mw.readFile(getConf()) - rep = 'ROOT\s*=\s*(.*)' + rep = r'ROOT\s*=\s*(.*)' tmp = re.search(rep, content) if not tmp: return '' @@ -215,7 +215,7 @@ def getDbConfValue(): return {} content = mw.readFile(conf) - rep_scope = "\[database\](.*?)\[" + rep_scope = r"\[database\](.*?)\[" tmp = re.findall(rep_scope, content, re.S) rep = '(\w*)\s*=\s*(.*)' diff --git a/plugins/gogs/index.py b/plugins/gogs/index.py index ef103e29c..2424250dc 100755 --- a/plugins/gogs/index.py +++ b/plugins/gogs/index.py @@ -173,12 +173,12 @@ def initDreplace(): def getRootUrl(): content = mw.readFile(getConf()) - rep = 'ROOT_URL\s*=\s*(.*)' + rep = r'ROOT_URL\s*=\s*(.*)' tmp = re.search(rep, content) if tmp: return tmp.groups()[0] - rep = 'EXTERNAL_URL\s*=\s*(.*)' + rep = r'EXTERNAL_URL\s*=\s*(.*)' tmp = re.search(rep, content) if tmp: return tmp.groups()[0] @@ -187,7 +187,7 @@ def getRootUrl(): def getSshPort(): content = mw.readFile(getConf()) - rep = 'SSH_PORT\s*=\s*(.*)' + rep = r'SSH_PORT\s*=\s*(.*)' tmp = re.search(rep, content) if not tmp: return '' @@ -196,7 +196,7 @@ def getSshPort(): def getHttpPort(): content = mw.readFile(getConf()) - rep = 'HTTP_PORT\s*=\s*(.*)' + rep = r'HTTP_PORT\s*=\s*(.*)' tmp = re.search(rep, content) if not tmp: return '' @@ -205,7 +205,7 @@ def getHttpPort(): def getRootPath(): content = mw.readFile(getConf()) - rep = 'ROOT\s*=\s*(.*)' + rep = r'ROOT\s*=\s*(.*)' tmp = re.search(rep, content) if not tmp: return '' @@ -218,10 +218,10 @@ def getDbConfValue(): return {} content = mw.readFile(conf) - rep_scope = "\[database\](.*?)\[" + rep_scope = r"\[database\](.*?)\[" tmp = re.findall(rep_scope, content, re.S) - rep = '(\w*)\s*=\s*(.*)' + rep = r'(\w*)\s*=\s*(.*)' tmp = re.findall(rep, tmp[0]) r = {} for x in range(len(tmp)): diff --git a/plugins/keepalived/index.py b/plugins/keepalived/index.py index d1d3a2d24..12455677b 100755 --- a/plugins/keepalived/index.py +++ b/plugins/keepalived/index.py @@ -253,7 +253,7 @@ def getPort(): conf = getServerDir() + '/keepalived.conf' content = mw.readFile(conf) - rep = "^(" + 'port' + ')\s*([.0-9A-Za-z_& ~]+)' + rep = r"^(" + 'port' + r')\s*([.0-9A-Za-z_& ~]+)' tmp = re.search(rep, content, re.M) if tmp: return tmp.groups()[1] diff --git a/plugins/webstats/index.py b/plugins/webstats/index.py index 674dcd53d..3c272cce5 100755 --- a/plugins/webstats/index.py +++ b/plugins/webstats/index.py @@ -331,7 +331,7 @@ def getGlobalConf(): def openLuaNeedRequestBody(): conf = luaConf() content = mw.readFile(conf) - content = re.sub("lua_need_request_body (.*);", + content = re.sub(r"lua_need_request_body (.*);", 'lua_need_request_body on;', content) mw.writeFile(conf, content) @@ -339,7 +339,7 @@ def openLuaNeedRequestBody(): def closeLuaNeedRequestBody(): conf = luaConf() content = mw.readFile(conf) - content = re.sub("lua_need_request_body (.*);", + content = re.sub(r"lua_need_request_body (.*);", 'lua_need_request_body off;', content) mw.writeFile(conf, content) diff --git a/plugins/xhprof/index.py b/plugins/xhprof/index.py index 40711dd8f..cbe06fd73 100755 --- a/plugins/xhprof/index.py +++ b/plugins/xhprof/index.py @@ -51,7 +51,7 @@ def getConf(): def getPort(): file = getConf() content = mw.readFile(file) - rep = 'listen\s*(.*);' + rep = r'listen\s*(.*);' tmp = re.search(rep, content) return tmp.groups()[0].strip() @@ -193,7 +193,7 @@ def setXhPort(): if not os.path.exists(file): return mw.returnJson(False, '插件未启动!') content = mw.readFile(file) - rep = 'listen\s*(.*);' + rep = r'listen\s*(.*);' content = re.sub(rep, "listen " + port + ';', content) mw.writeFile(file, content) mw.restartWeb() diff --git a/plugins/zabbix/index.py b/plugins/zabbix/index.py index 493d3d764..e7901729b 100755 --- a/plugins/zabbix/index.py +++ b/plugins/zabbix/index.py @@ -75,7 +75,7 @@ def checkArgs(data, ck=[]): def getPidFile(): file = getConf() content = mw.readFile(file) - rep = 'pidfile\s*(.*)' + rep = r'pidfile\s*(.*)' tmp = re.search(rep, content) return tmp.groups()[0].strip() @@ -131,14 +131,14 @@ def getMySQLConf(): def getMySQLPort(): file = getMySQLConf() content = mw.readFile(file) - rep = 'port\s*=\s*(.*)' + rep = r'port\s*=\s*(.*)' tmp = re.search(rep, content) return tmp.groups()[0].strip() def getMySQLSocketFile(): file = getMySQLConf() content = mw.readFile(file) - rep = 'socket\s*=\s*(.*)' + rep = r'socket\s*=\s*(.*)' tmp = re.search(rep, content) return tmp.groups()[0].strip() @@ -201,7 +201,7 @@ def getInstalledPhpConfDir(): return 'php-80' def isInstalledPhp(): - phpver = ["80","81","82","83","84"] + phpver = ["80","81","82","83","84","85"] php_type = ['php-apt','php-yum', 'php']; for pt in php_type: @@ -438,7 +438,7 @@ def runLog(): zs_conf = zabbixServerConf() content = mw.readFile(zs_conf) - rep = 'LogFile=\s*(.*)' + rep = r'LogFile=\s*(.*)' tmp = re.search(rep, content) if tmp.groups(): @@ -449,7 +449,7 @@ def zabbixAgentLog(): za_conf = zabbixAgentConf() content = mw.readFile(za_conf) - rep = 'LogFile=\s*(.*)' + rep = r'LogFile=\s*(.*)' tmp = re.search(rep, content) if tmp.groups(): diff --git a/plugins/zabbix_agent/index.py b/plugins/zabbix_agent/index.py index 0597d465b..2b48cd444 100755 --- a/plugins/zabbix_agent/index.py +++ b/plugins/zabbix_agent/index.py @@ -66,7 +66,7 @@ def checkArgs(data, ck=[]): def getPidFile(): file = getConf() content = mw.readFile(file) - rep = 'pidfile\s*(.*)' + rep = r'pidfile\s*(.*)' tmp = re.search(rep, content) return tmp.groups()[0].strip() @@ -90,7 +90,7 @@ def runLog(): za_conf = zabbixAgentConf() content = mw.readFile(za_conf) - rep = 'LogFile=\s*(.*)' + rep = r'LogFile=\s*(.*)' tmp = re.search(rep, content) if tmp.groups() == 0: