From d777a29d8c204b8a5f339af1fc80f0ab702df8dd Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 4 Mar 2023 21:47:12 +0800 Subject: [PATCH 1/8] Update update.sh --- scripts/update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update.sh b/scripts/update.sh index 623c1f03d0..aff7619d3a 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -78,7 +78,7 @@ CP_CMD=/usr/bin/cp if [ -f /bin/cp ];then CP_CMD=/bin/cp fi -$CP_CMD -rf /tmp/mdserver-web-dev/* /www/server/mdserver-web +$CP_CMD -rf /tmp/mdserver-web-master/* /www/server/mdserver-web rm -rf /tmp/master.zip rm -rf /tmp/mdserver-web-master From 4082f29424bc655edfdf679a9c6596bb868c934e Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 4 Mar 2023 23:07:23 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E5=86=99=E5=85=A5=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/core/mw.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/class/core/mw.py b/class/core/mw.py index f8b6621d0d..8e4bb0e99b 100755 --- a/class/core/mw.py +++ b/class/core/mw.py @@ -22,6 +22,8 @@ import shlex import datetime import subprocess +import glob + import re import db from random import Random @@ -555,6 +557,35 @@ def writeLog(stype, msg, args=()): return writeDbLog(stype, msg, args, uid) +def writeFileLog(msg, path=None, limit_size=50 * 1024 * 1024, save_limit=3): + log_file = getServerDir() + '/mdserver-web/logs/debug.log' + if path != None: + log_file = path + + if os.path.exists(log_file): + size = os.path.getsize(log_file) + if size > limit_size: + log_file_rename = log_file + "_" + \ + time.strftime("%Y-%m-%d_%H%M%S") + '.log' + os.rename(log_file, log_file_rename) + logs = sorted(glob.glob(log_file + "_*")) + count = len(logs) + save_limit = count - save_limit + for i in range(count): + if i > save_limit: + break + os.remove(logs[i]) + # print('|---多余日志[' + logs[i] + ']已删除!') + + f = open(log_file, 'ab+') + msg += "\n" + if __name__ == '__main__': + print(msg) + f.write(msg.encode('utf-8')) + f.close() + return True + + def writeDbLog(stype, msg, args=(), uid=1): try: import time From 79c9865a5d889ded44a6844a1d920de9c4fc7df5 Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 4 Mar 2023 23:53:54 +0800 Subject: [PATCH 3/8] Update index.py --- plugins/supervisor/index.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/supervisor/index.py b/plugins/supervisor/index.py index 7344be95fc..debc7c7ec0 100755 --- a/plugins/supervisor/index.py +++ b/plugins/supervisor/index.py @@ -342,7 +342,9 @@ def restartJob(): status = args['status'] action = "启动" - cmd = supCtl + " restart " + name + cmd = supCtl + " stop " + name + data = mw.execShell(cmd) + cmd = supCtl + " start " + name data = mw.execShell(cmd) if data[1] != '': From c1cd45a5f30c2f3377c8d1db5cb1cce5269da673 Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 5 Mar 2023 00:00:59 +0800 Subject: [PATCH 4/8] Update my8.0.cnf --- plugins/mysql/conf/my8.0.cnf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mysql/conf/my8.0.cnf b/plugins/mysql/conf/my8.0.cnf index 4437d17699..b8f01c3637 100644 --- a/plugins/mysql/conf/my8.0.cnf +++ b/plugins/mysql/conf/my8.0.cnf @@ -71,7 +71,7 @@ log_replica_updates = 1 # Prevent replication from starting automatically with MySQL #skip_replica_start = 1 #replicate-do-db -slave_skip_errors=1062 +replica_skip_errors=1062 replicate-ignore-db = information_schema replicate-ignore-db = performance_schema replicate-ignore-db = mysql From 5016aedb0fea3de20a8765b6d62866be8cc9845f Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 5 Mar 2023 02:08:04 +0800 Subject: [PATCH 5/8] Update index.py --- plugins/supervisor/index.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/supervisor/index.py b/plugins/supervisor/index.py index debc7c7ec0..00d20a90fb 100755 --- a/plugins/supervisor/index.py +++ b/plugins/supervisor/index.py @@ -341,7 +341,6 @@ def restartJob(): name = args['name'] status = args['status'] - action = "启动" cmd = supCtl + " stop " + name data = mw.execShell(cmd) cmd = supCtl + " start " + name From 3e244ed22701e5aa0022378bb145c4fd91f8fc16 Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 5 Mar 2023 14:04:16 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/mysql-apt/index.py | 3 ++- plugins/mysql-yum/index.py | 3 ++- plugins/mysql/index.py | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/mysql-apt/index.py b/plugins/mysql-apt/index.py index 8bfc48fa2b..e5f7047ee3 100755 --- a/plugins/mysql-apt/index.py +++ b/plugins/mysql-apt/index.py @@ -2474,7 +2474,8 @@ def doFullSyncUser(version=''): if not os.path.exists(bak_file): dump_sql_data = getServerDir() + "/bin/mysqldump " + dmp_option + " --force --opt --default-character-set=utf8 --single-transaction -h" + ip + " -P" + \ - port + " -u" + user + " -p" + apass + " " + sync_db + " > " + bak_file + port + " -u" + user + " -p" + apass + \ + " --ssl-mode=DISABLED " + sync_db + " > " + bak_file mw.execShell(dump_sql_data) writeDbSyncStatus({'code': 2, 'msg': '本地导入数据...', 'progress': 40}) diff --git a/plugins/mysql-yum/index.py b/plugins/mysql-yum/index.py index b544454230..4f4b790c40 100755 --- a/plugins/mysql-yum/index.py +++ b/plugins/mysql-yum/index.py @@ -2434,7 +2434,8 @@ def doFullSyncUser(version=''): if not os.path.exists(bak_file): dump_sql_data = getServerDir() + "/bin/mysqldump " + dmp_option + " --force --opt --default-character-set=utf8 --single-transaction -h" + ip + " -P" + \ - port + " -u" + user + " -p" + apass + " " + sync_db + " > " + bak_file + port + " -u" + user + " -p" + apass + \ + " --ssl-mode=DISABLED " + sync_db + " > " + bak_file mw.execShell(dump_sql_data) writeDbSyncStatus({'code': 2, 'msg': '本地导入数据...', 'progress': 40}) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 9fc117c2bf..87056073cb 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -2665,8 +2665,10 @@ def doFullSyncUser(version=''): writeDbSyncStatus({'code': 1, 'msg': '远程导出数据...', 'progress': 20}) if not os.path.exists(bak_file): - dump_sql_data = getServerDir() + "/bin/mysqldump " + dmp_option + " --force --opt --default-character-set=utf8 --single-transaction -h" + ip + " -P" + \ - port + " -u" + user + " -p\"" + apass + "\" " + sync_db + " > " + bak_file + dump_sql_data = getServerDir() + "/bin/mysqldump " + dmp_option + " --force --opt --default-character-set=utf8 --single-transaction -h" + ip + " -P" + \ + port + " -u" + user + " -p\"" + apass + \ + "\" --ssl-mode=DISABLED " + sync_db + " > " + bak_file + # print(dump_sql_data) mw.execShell(dump_sql_data) writeDbSyncStatus({'code': 2, 'msg': '本地导入数据...', 'progress': 40}) From 046389df99164cecd1e1d14c4fa4204576b83591 Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 5 Mar 2023 17:37:01 +0800 Subject: [PATCH 7/8] Update init.lua --- plugins/op_waf/waf/lua/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/op_waf/waf/lua/init.lua b/plugins/op_waf/waf/lua/init.lua index 33ded01ade..4a6792e1f6 100644 --- a/plugins/op_waf/waf/lua/init.lua +++ b/plugins/op_waf/waf/lua/init.lua @@ -346,7 +346,7 @@ local function waf_cc_increase() if params['uri_request_args']['token'] then local args_token = params['uri_request_args']['token'] if args_token == make_token then - ngx.shared.waf_limit:set(cache_token, 1, config['safe_verify']['time']) + ngx.shared.waf_limit:set(cache_token, 1, tonumber(config['safe_verify']['time'])) local data = get_return_state(0, "ok") ngx.say(json.encode(data)) ngx.exit(200) From c69674286679973570a466e39123d3a6204f9a0e Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 5 Mar 2023 18:03:41 +0800 Subject: [PATCH 8/8] Update init.lua --- plugins/op_waf/waf/lua/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/op_waf/waf/lua/init.lua b/plugins/op_waf/waf/lua/init.lua index 4a6792e1f6..ff13b6c085 100644 --- a/plugins/op_waf/waf/lua/init.lua +++ b/plugins/op_waf/waf/lua/init.lua @@ -344,6 +344,7 @@ local function waf_cc_increase() local make_uri = "/"..make_uri_str if params['uri_request_args']['token'] then + ngx.header.content_type = "application/json" local args_token = params['uri_request_args']['token'] if args_token == make_token then ngx.shared.waf_limit:set(cache_token, 1, tonumber(config['safe_verify']['time'])) @@ -351,6 +352,14 @@ local function waf_cc_increase() ngx.say(json.encode(data)) ngx.exit(200) end + + -- C:D("debug[args]:"..tostring(params['uri_request_args']['debug'])) + -- if params['uri_request_args']['debug'] == 'ok' then + -- ngx.header.content_type = "application/json" + -- local data = get_return_state(0, "ok") + -- ngx.say(json.encode(data)) + -- ngx.exit(200) + -- end end local cc_html = ngx.re.gsub(cc_safe_js_html, "{uri}", make_uri_str)