Skip to content

Commit

Permalink
Merge pull request #638 from midoks/dev
Browse files Browse the repository at this point in the history
常见优化
  • Loading branch information
midoks authored Dec 14, 2024
2 parents b819f34 + 6fb93b1 commit c53390d
Show file tree
Hide file tree
Showing 16 changed files with 401 additions and 15 deletions.
3 changes: 2 additions & 1 deletion panel_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ def mwcli(mw_input=0):
mw.writeFile(php_conf, cont)
mw.echoInfo("执行PHP52隐藏成功!")
elif mw_input == 200:
os.system(INIT_CMD + " mirror")
os.system("bash <(curl -sSL https://linuxmirrors.cn/main.sh)")
# os.system(INIT_CMD + " mirror")
elif mw_input == 201:
os.system('curl -Lso- bench.sh | bash')

Expand Down
14 changes: 14 additions & 0 deletions plugins/data_query/sql_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def inner():
@singleton
class nosqlMySQL():

__sid = None

__DB_PASS = None
__DB_USER = None
__DB_PORT = 3306
Expand All @@ -37,9 +39,19 @@ def __init__(self):
pass

def setSid(self, sid):
self.__sid = sid
self.__config = self.get_options(sid=sid)

def conn(self):

if self.__sid is None:
return False

if self.__sid is not None:
mycnf_path = "{}/{}/etc/my.cnf".format(mw.getServerDir(),self.__sid)
if not os.path.exists(mycnf_path):
return False

self.__DB_PORT = int(self.__config['port'])
self.__DB_USER = self.__config['username']
self.__DB_PASS = self.__config['password']
Expand Down Expand Up @@ -74,6 +86,8 @@ def get_options(self, sid=None):

if sid in ['mysql', 'mysql-apt', 'mysql-yum']:
my_cnf_path = "{}/{}/etc/my.cnf".format(mw.getServerDir(),sid)
if not os.path.exists(my_cnf_path):
return False

mydb_content = mw.readFile(my_cnf_path)
if not mydb_content: return False
Expand Down
2 changes: 1 addition & 1 deletion plugins/gdrive/js/gdrive.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function gdList(file_id){
if(rdata.status === false){
showMsg(rdata.msg,function(){
authApi();
},{icon:2},2000);
},{icon:2});
return;
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/mysql-apt/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type":"运行环境",
"ps":"一种关系数据库管理系统[debian,ubuntu](极速安装)",
"todo_versions":["5.7","8.0"],
"versions":["5.7","8.0","8.2","8.3","8.4","9.0"],
"versions":["5.7","8.0","8.2","8.3","8.4","9.0","9.1"],
"shell":"install.sh",
"install_pre_inspection":true,
"uninstall_pre_inspection":true,
Expand Down
2 changes: 1 addition & 1 deletion plugins/mysql-apt/versions/8.4/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ chown mysql -R /var/run/mysqld
# https://cdn.mysql.com/archives/mysql-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
# https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar

wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar

Expand Down
7 changes: 4 additions & 3 deletions plugins/mysql-apt/versions/9.0/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ mkdir -p $serverPath/mysql-apt/bin
mkdir -p /var/run/mysqld
chown mysql -R /var/run/mysqld

# https://cdn.mysql.com/archives/mysql-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
# https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
# https://dev.mysql.com/get/Downloads/MySQL-9.0/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
# https://cdn.mysql.com/archives/mysql-9.0/mysql-server_9.0.1-1debian12_amd64.deb-bundle.tar

wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://cdn.mysql.com/archives/mysql-9.0/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
# wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-9.1/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar

Expand Down
138 changes: 138 additions & 0 deletions plugins/mysql-apt/versions/9.1/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# -*- coding: utf-8 -*-
#!/bin/bash

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
export DEBIAN_FRONTEND=noninteractive

# https://downloads.mysql.com/archives/community/

curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`

myDir=${serverPath}/source/mysql-apt

bash ${rootPath}/scripts/getos.sh
OSNAME=`cat ${rootPath}/data/osname.pl`
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`

# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 9.0

# 暂时debian12没有标准版,先用11使用
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
# echo "暂时不支持该${OSNAME}${VERSION_ID}"
# exit 1
# fi


ARCH="amd64"
TMP_ARCH=`arch`
if [ "$TMP_ARCH" == "x86_64" ];then
ARCH="amd64"
elif [ "$TMP_ARCH" == "aarch64" ];then
ARCH="arm64"
else
ARCH="amd64"
fi

if [ "$ARCH" != "amd64" ];then
echo "暂时不支持该${ARCH}"
exit 1
fi


MYSQL_VER=9.1.0
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH}


# /lib/systemd/system/mysql.service
# /etc/mysql/my.cnf

APT_INSTALL()
{
########
mkdir -p $myDir
mkdir -p $serverPath/mysql-apt/bin

mkdir -p /var/run/mysqld
chown mysql -R /var/run/mysqld

# https://cdn.mysql.com/archives/mysql-9.1/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
# https://dev.mysql.com/get/Downloads/MySQL-9.1/mysql-server_${SUFFIX_NAME}.deb-bundle.tar

wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-9.1/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar

apt update -y
apt install -y libnuma1 libaio1 libmecab2

# 安装
dpkg -X mysql-common_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin



dpkg -X mysql-community-client-plugins_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
dpkg -X mysql-community-client-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
dpkg -X mysql-community-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
dpkg -X mysql-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin

dpkg -X mysql-community-server-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin

dpkg -X mysql-community-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
dpkg -X mysql-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin

# 测试时可关闭
rm -rf $myDir
#######
}

APT_UNINSTALL()
{
###
rm -rf $myDir
# apt remove -y mysql-server
###
}


Install_mysql()
{
echo '正在安装脚本文件...'

isApt=`which apt`
if [ "$isApt" != "" ];then
APT_INSTALL
fi

if [ "$?" == "0" ];then
mkdir -p $serverPath/mysql-apt
echo '9.0' > $serverPath/mysql-apt/version.pl
echo '安装完成'
else
echo '9.0' > $serverPath/mysql-apt/version.pl
echo "暂时不支持该系统"
fi
}

Uninstall_mysql()
{

isApt=`which apt`
if [ "$isApt" != "" ];then
APT_UNINSTALL
fi

rm -rf $serverPath/mysql-apt
echo '卸载完成'
}

action=$1
if [ "${1}" == 'install' ];then
Install_mysql
else
Uninstall_mysql
fi
4 changes: 2 additions & 2 deletions plugins/mysql/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"checks": "server/mysql/VERSION/bin/mysql",
"path": "server/mysql/VERSION",
"todo_versions":["5.6","5.7","8.0","8.2"],
"versions":["5.5", "5.6", "5.7","8.0","8.2","8.3","8.4","9.0"],
"updates":["5.5.62","5.6.50", "5.7.32","8.0.34","8.2.0","8.3.0","9.0.1"],
"versions":["5.5", "5.6", "5.7","8.0","8.2","8.3","8.4","9.0","9.1"],
"updates":["5.5.62","5.6.50", "5.7.32","8.0.34","8.2.0","8.3.0","9.0.1","9.1.0"],
"shell":"install.sh",
"checks":"server/mysql",
"path":"server/mysql",
Expand Down
Loading

0 comments on commit c53390d

Please sign in to comment.