From fe0f3f63a2ad4f3c3a732fcec1bf068d6c329307 Mon Sep 17 00:00:00 2001 From: dami Date: Tue, 1 Apr 2025 22:02:42 +0800 Subject: [PATCH 1/6] Update index.py --- plugins/mysql/index.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index db1cb8c2c..7a6be653c 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -957,6 +957,9 @@ def __createUser(dbname, username, password, address): def getDbBackupListFunc(dbname=''): bkDir = mw.getBackupDir() + '/database' + if not os.path.exists(bkDir): + mw.execShell('mkdir -p ' + bkDir) + blist = os.listdir(bkDir) r = [] From 142f0fc6c95a328224c4c202c81e9b29d0dcfa08 Mon Sep 17 00:00:00 2001 From: dami Date: Wed, 2 Apr 2025 11:06:47 +0800 Subject: [PATCH 2/6] Update install.sh --- scripts/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 386f36c25..d13c94835 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -53,11 +53,11 @@ elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eqi "Amazon Linux" /etc/*-rele yum install -y wget curl zip unzip tar crontabs elif grep -Eqi "Debian" /etc/issue || grep -Eqi "Debian" /etc/os-release; then OSNAME='debian' - apt update -y + # apt update -y apt install -y wget curl zip unzip tar cron elif grep -Eqi "Ubuntu" /etc/issue || grep -Eqi "Ubuntu" /etc/os-release; then OSNAME='ubuntu' - apt update -y + # apt update -y apt install -y wget curl zip unzip tar cron else OSNAME='unknow' From 628b65a569ca9085f403db672a476f574eb36a2f Mon Sep 17 00:00:00 2001 From: dami Date: Wed, 2 Apr 2025 12:48:06 +0800 Subject: [PATCH 3/6] update --- plugins/mysql/index.py | 13 +++++++------ requirements.txt | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 7a6be653c..ebfcd7c99 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -10,6 +10,8 @@ import re import json +from packaging import version + web_dir = os.getcwd() + "/web" if os.path.exists(web_dir): sys.path.append(web_dir) @@ -854,8 +856,8 @@ def runInfo(version): return mw.getJson(result) -def myDbStatus(version): - if status(version) == 'stop': +def myDbStatus(ver): + if status(ver) == 'stop': return mw.returnJson(False, 'MySQL未启动', []) result = {} @@ -868,7 +870,7 @@ def myDbStatus(version): gets = ['table_open_cache', 'thread_cache_size', 'key_buffer_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', 'innodb_additional_mem_pool_size', 'innodb_log_buffer_size', 'max_connections', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size'] - if version != "8.0": + if version.parse(ver) < version.parse("8.0"): gets.append('query_cache_size') result['mem'] = {} @@ -881,12 +883,11 @@ def myDbStatus(version): return mw.getJson(result) -def setDbStatus(version): +def setDbStatus(ver): gets = ['key_buffer_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', 'innodb_log_buffer_size', 'max_connections', 'table_open_cache', 'thread_cache_size', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size'] - if version != "8.0": - # gets.append('query_cache_size') + if version.parse(ver) < version.parse("8.0"): gets = ['key_buffer_size', 'query_cache_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', 'innodb_log_buffer_size', 'max_connections', 'table_open_cache', 'thread_cache_size', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size'] diff --git a/requirements.txt b/requirements.txt index 65baed2fd..c1a3efeca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -43,3 +43,4 @@ pyTelegramBotAPI telebot pyyaml croniter +packaging From f4cda4ec36531aff1e0314c762653acea06c8843 Mon Sep 17 00:00:00 2001 From: dami Date: Wed, 2 Apr 2025 12:48:38 +0800 Subject: [PATCH 4/6] Update index.py --- plugins/mysql/index.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index ebfcd7c99..d1e03dbce 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -9,8 +9,7 @@ import subprocess import re import json - -from packaging import version +from packaging import pk_version web_dir = os.getcwd() + "/web" if os.path.exists(web_dir): @@ -870,7 +869,7 @@ def myDbStatus(ver): gets = ['table_open_cache', 'thread_cache_size', 'key_buffer_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', 'innodb_additional_mem_pool_size', 'innodb_log_buffer_size', 'max_connections', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size'] - if version.parse(ver) < version.parse("8.0"): + if pk_version.parse(ver) < pk_version.parse("8.0"): gets.append('query_cache_size') result['mem'] = {} @@ -887,7 +886,7 @@ def setDbStatus(ver): gets = ['key_buffer_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', 'innodb_log_buffer_size', 'max_connections', 'table_open_cache', 'thread_cache_size', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size'] - if version.parse(ver) < version.parse("8.0"): + if pk_version.parse(ver) < pk_version.parse("8.0"): gets = ['key_buffer_size', 'query_cache_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', 'innodb_log_buffer_size', 'max_connections', 'table_open_cache', 'thread_cache_size', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size'] From cef521390a7d12931e689bd6633eea226955423c Mon Sep 17 00:00:00 2001 From: dami Date: Wed, 2 Apr 2025 12:50:50 +0800 Subject: [PATCH 5/6] Update index.py --- plugins/mysql/index.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index d1e03dbce..2070075a7 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -9,7 +9,7 @@ import subprocess import re import json -from packaging import pk_version +from packaging import version as pk_version web_dir = os.getcwd() + "/web" if os.path.exists(web_dir): From b7aa774eb7acf1ab834e7b52e6c979b6040dc2e1 Mon Sep 17 00:00:00 2001 From: dami Date: Wed, 2 Apr 2025 12:53:11 +0800 Subject: [PATCH 6/6] Update index.py --- plugins/mysql-community/index.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/mysql-community/index.py b/plugins/mysql-community/index.py index bec36eb18..989524778 100755 --- a/plugins/mysql-community/index.py +++ b/plugins/mysql-community/index.py @@ -8,6 +8,7 @@ import subprocess import re import json +from packaging import version as pk_version web_dir = os.getcwd() + "/web" if os.path.exists(web_dir): @@ -726,7 +727,7 @@ def myDbStatus(version): gets = ['table_open_cache', 'thread_cache_size', 'key_buffer_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', 'innodb_additional_mem_pool_size', 'innodb_log_buffer_size', 'max_connections', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size'] - if version != "8.0": + if pk_version.parse(ver) < pk_version.parse("8.0"): gets.append('query_cache_size') result['mem'] = {} @@ -743,8 +744,7 @@ def setDbStatus(version): gets = ['key_buffer_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', 'innodb_log_buffer_size', 'max_connections', 'table_open_cache', 'thread_cache_size', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size'] - if version != "8.0": - # gets.append('query_cache_size') + if pk_version.parse(ver) < pk_version.parse("8.0"): gets = ['key_buffer_size', 'query_cache_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', 'innodb_log_buffer_size', 'max_connections', 'table_open_cache', 'thread_cache_size', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size']