diff --git a/README.md b/README.md
index b89b5c640..340995ca9 100644
--- a/README.md
+++ b/README.md
@@ -137,7 +137,7 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts
- 卸载脚本
```
-curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/uninstall.sh | bash
+wget -O uninstall.sh https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/uninstall.sh && bash uninstall.sh
```
@@ -156,6 +156,7 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/qu
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install_dev.sh | bash
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
+wget -O uninstall.sh https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/uninstall.sh && bash uninstall.sh
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install_dev.sh | bash
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update_dev.sh | bash
diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh
index 64b57ce45..c2524650c 100755
--- a/plugins/openresty/install.sh
+++ b/plugins/openresty/install.sh
@@ -16,11 +16,10 @@ install_tmp=${rootPath}/tmp/mw_install.pl
openrestyDir=${serverPath}/source/openresty
if id www &> /dev/null ;then
- echo "www UID is `id -u www`"
- echo "www Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
+ echo "www uid is `id -u www`"
+ echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
else
groupadd www
- # useradd -g www -s /sbin/nologin www
useradd -g www -s /bin/bash www
fi
diff --git a/plugins/phpmyadmin/conf/config.inc.php b/plugins/phpmyadmin/conf/config.inc.php
index 5ebd5247c..ab6a8250f 100644
--- a/plugins/phpmyadmin/conf/config.inc.php
+++ b/plugins/phpmyadmin/conf/config.inc.php
@@ -10,7 +10,7 @@ $cfg['Servers'][$i]['socket'] = '{$SERVER_PATH}/{$CHOOSE_DB_DIR}/mysql.
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
-$cfg['TempDir'] = '{$SERVER_PATH}/phpmyadmin/tmp';
+$cfg['TempDir'] = '{$SERVER_PATH}/phpmyadmin/{$PMA_PATH}/tmp';
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>
diff --git a/plugins/phpmyadmin/index.py b/plugins/phpmyadmin/index.py
index 45b930dba..5b11ad07d 100755
--- a/plugins/phpmyadmin/index.py
+++ b/plugins/phpmyadmin/index.py
@@ -85,10 +85,16 @@ def getPhpVer(expect=55):
import json
v = site_api.site_api().getPhpVersion()
v = json.loads(v)
+ is_find = False
for i in range(len(v)):
t = int(v[i]['version'])
- if (t >= expect):
+ if (t == expect):
+ is_find = True
return str(t)
+ if not is_find:
+ if len(v) > 1:
+ return v[1]['version']
+ return v[0]['version']
return str(expect)
diff --git a/plugins/rsyncd/index.py b/plugins/rsyncd/index.py
index 88d18b752..cbbf8bc8d 100755
--- a/plugins/rsyncd/index.py
+++ b/plugins/rsyncd/index.py
@@ -363,6 +363,10 @@ def addRec():
args_path = args['path']
args_ps = args['ps']
+ if not mw.isAppleSystem():
+ mw.execShell("mkdir -p " + args_path)
+ mw.execShell("chown -R www:www " + args_path)
+
delRecBy(args_name)
auth_path = appAuthPwd(args_name)
@@ -506,9 +510,13 @@ def cmdRecCmd():
# ----------------------------- rsyncdSend start -------------------------
-
def lsyncdReload():
- mw.execShell('systemctl reload lsyncd')
+ data = mw.execShell(
+ "ps -ef|grep lsyncd |grep -v grep | grep -v python | awk '{print $2}'")
+ if data[0] == '':
+ mw.execShell('systemctl start lsyncd')
+ else:
+ mw.execShell('systemctl restart lsyncd')
def makeLsyncdConf(data):
@@ -692,6 +700,10 @@ def lsyncdAdd():
ip = args['ip']
path = args['path']
+ if not mw.isAppleSystem():
+ mw.execShell("mkdir -p " + path)
+ mw.execShell("chown -R www:www " + path)
+
conn_type = args['conn_type']
secret_key = args['secret_key']
delete = args['delete']
diff --git a/plugins/rsyncd/install.sh b/plugins/rsyncd/install.sh
index 4b64e15ff..4fe7f2f8e 100755
--- a/plugins/rsyncd/install.sh
+++ b/plugins/rsyncd/install.sh
@@ -16,6 +16,14 @@ bash ${rootPath}/scripts/getos.sh
OSNAME=`cat ${rootPath}/data/osname.pl`
+if id www &> /dev/null ;then
+ echo "www uid is `id -u www`"
+ echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
+else
+ groupadd www
+ useradd -g www -s /bin/bash www
+fi
+
echo $OSNAME
install_tmp=${rootPath}/tmp/mw_install.pl
Install_rsyncd()
@@ -58,6 +66,14 @@ Uninstall_rsyncd()
systemctl daemon-reload
fi
+ if [ -f /usr/lib/systemd/system/lsyncd.service ] || [ -f /lib/systemd/system/lsyncd.service ];then
+ systemctl stop lsyncd
+ systemctl disable lsyncd
+ rm -rf /usr/lib/systemd/system/lsyncd.service
+ rm -rf /lib/systemd/system/lsyncd.service
+ systemctl daemon-reload
+ fi
+
if [ -f $serverPath/rsyncd/initd/rsyncd ];then
$serverPath/rsyncd/initd/rsyncd stop
fi
diff --git a/plugins/rsyncd/js/rsyncd.js b/plugins/rsyncd/js/rsyncd.js
index d99120093..eb0c1c68c 100755
--- a/plugins/rsyncd/js/rsyncd.js
+++ b/plugins/rsyncd/js/rsyncd.js
@@ -1,18 +1,8 @@
-function str2Obj(str){
- var data = {};
- kv = str.split('&');
- for(i in kv){
- v = kv[i].split('=');
- data[v[0]] = v[1];
- }
- return data;
-}
-
function rsPost(method,args,callback, title){
var _args = null;
if (typeof(args) == 'string'){
- _args = JSON.stringify(str2Obj(args));
+ _args = JSON.stringify(toArrayObject(args));
} else {
_args = JSON.stringify(args);
}
@@ -537,7 +527,7 @@ function lsyncdSend(){
con += '
'+
'' + list[i]['name']+' | ' +
'' + list[i]['path']+' | ' +
- '' + list[i]['ip']+":"+"cc"+' | ' +
+ '' + list[i]['ip']+":"+list[i]['name']+' | ' +
'' + mode+' | ' +
'' + period +' | ' +
'\
diff --git a/requirements.txt b/requirements.txt
index b74735d7e..4484ef5bb 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -24,5 +24,6 @@ pymongo
pillow
Jinja2>=2.11.2
flask-caching>=1.10.1
+bcrypt==3.1.3
PyMySQL
mysql-connector-python
diff --git a/route/__init__.py b/route/__init__.py
index 57efed4fb..625b2924d 100755
--- a/route/__init__.py
+++ b/route/__init__.py
@@ -208,6 +208,7 @@ def doLogin():
login_cache_limit = cache.get('login_cache_limit')
code_msg = mw.getInfo("验证码错误,您还可以尝试[{1}]次!", (str(
login_cache_count - login_cache_limit)))
+ mw.writeLog('用户登录', code_msg)
return mw.returnJson(False, code_msg)
userInfo = mw.M('users').where(
diff --git a/scripts/init.d/mw.tpl b/scripts/init.d/mw.tpl
index e47242900..50d762106 100755
--- a/scripts/init.d/mw.tpl
+++ b/scripts/init.d/mw.tpl
@@ -14,7 +14,7 @@
PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
-# export LC_ALL="en_US.UTF-8"
+export LC_ALL=en_US.UTF-8
mw_path={$SERVER_PATH}
PATH=$PATH:$mw_path/bin
diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh
index 983900d1a..4e0549818 100644
--- a/scripts/install/debian.sh
+++ b/scripts/install/debian.sh
@@ -16,6 +16,13 @@ if grep -Eq "Debian" /etc/*-release; then
ln -sf /bin/bash /bin/sh
fi
+__GET_BIT=`getconf LONG_BIT`
+if [ "$__GET_BIT" == "32" ];then
+ # install rust | 32bit need
+ # curl https://sh.rustup.rs -sSf | sh
+ apt install -y rustc
+fi
+
# synchronize time first
apt-get install ntpdate -y
ntpdate time.nist.gov | logger -t NTP
diff --git a/scripts/lib.sh b/scripts/lib.sh
index 6aadbe183..0ee5004f2 100755
--- a/scripts/lib.sh
+++ b/scripts/lib.sh
@@ -102,7 +102,6 @@ fi
#面板需要的库
-
if [ ! -f /usr/local/bin/pip3 ];then
# python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
python3 -m pip install --upgrade pip setuptools wheel -i https://pypi.python.org/pypi
@@ -112,8 +111,7 @@ pip install --upgrade pip
pip3 install --upgrade setuptools
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
-pip3 install gevent-websocket==0.10.1
-pip3 install flask-caching==1.10.1
+# pip3 install flask-caching==1.10.1
# pip3 install mysqlclient
@@ -128,7 +126,6 @@ pip install --upgrade pip
pip3 install --upgrade setuptools
pip3 install -r /www/server/mdserver-web/requirements.txt
-pip3 install gevent-websocket==0.10.1
-pip3 install flask-caching==1.10.1
+# pip3 install flask-caching==1.10.1
# pip3 install mysqlclient
diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh
index 3368d9bf5..e70657287 100755
--- a/scripts/uninstall.sh
+++ b/scripts/uninstall.sh
@@ -1,7 +1,7 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
-# LANG=en_US.UTF-8
+export LANG=en_US.UTF-8
is64bit=`getconf LONG_BIT`
if [ -f /etc/motd ];then
@@ -18,14 +18,144 @@ if [ "$EUID" -ne 0 ]
exit
fi
+UNINSTALL_CHECK()
+{
+ echo -e "----------------------------------------------------"
+ echo -e "暂时只能卸载OpenResty/PHP/MySQL/Redis/Memcached"
+ echo -e "其他插件先手动卸载!"
+ echo -e "----------------------------------------------------"
+ echo -e "已知风险/输入yes强制卸载![yes/no]"
+ read -p "输入yes强制卸载: " yes;
+ if [ "$yes" != "yes" ];then
+ echo -e "------------"
+ echo "取消卸载"
+ exit 1
+ else
+ echo "开始卸载!"
+ fi
+}
-rm -rf /usr/bin/mw
-rm -rf /www
+UNINSTALL_MySQL()
+{
+ MYSQLD_CHECK=$(ps -ef |grep mysqld | grep -v grep | grep /www/server/mysql)
+ if [ "$MYSQLD_CHECK" != "" ];then
+ echo -e "----------------------------------------------------"
+ echo -e "检查已有MySQL环境,卸载可能影响现有站点及数据"
+ echo -e "----------------------------------------------------"
+ echo -e "已知风险/输入yes强制卸载![yes/no]"
+ read -p "输入yes强制卸载: " yes;
+ if [ "$yes" != "yes" ];then
+ echo -e "------------"
+ echo "取消卸载MySQL"
+ else
+ cd /www/server/mdserver-web/plugins/mysql && sh install.sh uninstall 8.0
+ echo "卸载MySQL成功!"
+ fi
+ fi
+}
+
+UNINSTALL_OP()
+{
+ if [ -f /www/server/openresty ];then
+ echo -e "----------------------------------------------------"
+ echo -e "检查已有OpenResty环境,卸载可能影响现有站点及数据"
+ echo -e "----------------------------------------------------"
+ echo -e "已知风险/输入yes强制卸载![yes/no]"
+ read -p "输入yes强制卸载: " yes;
+ if [ "$yes" != "yes" ];then
+ echo -e "------------"
+ echo "取消卸载OpenResty"
+ else
+ cd /www/server/mdserver-web/plugins/openresty && sh install.sh uninstall
+ echo "卸载OpenResty成功!"
+ fi
+ fi
+}
+
+UNINSTALL_PHP()
+{
+ if [ -d /www/server/php ];then
+ echo -e "----------------------------------------------------"
+ echo -e "检查已有PHP环境,卸载可能影响现有站点及数据"
+ echo -e "----------------------------------------------------"
+ read -p "输入yes强制卸载所有PHP[yes/no]: " yes;
+ if [ "$yes" != "yes" ];then
+ echo -e "------------"
+ echo "取消卸载PHP"
+ else
+ PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82)
+ for PHP_VER in ${PHP_VER_LIST[@]}; do
+ if [ -d /www/server/php/${PHP_VER} ];then
+ cd /www/server/mdserver-web/plugins/php && bash install.sh uninstall ${PHP_VER}
+ fi
+ echo "卸载PHP${PHP_VER}成功!"
+ done
+ fi
+ fi
+}
+
+UNINSTALL_MEMCACHED()
+{
+ if [ -d /www/server/memcached ];then
+ echo -e "----------------------------------------------------"
+ echo -e "检查已有Memcached环境,卸载可能影响现有站点及数据"
+ echo -e "----------------------------------------------------"
+ read -p "输入yes强制卸载所有Memcached[yes/no]: " yes;
+ if [ "$yes" != "yes" ];then
+ echo -e "------------"
+ echo "取消卸载Memcached"
+ else
+ cd /www/server/mdserver-web/plugins/memcached && bash install.sh uninstall
+ echo "卸载Memcached成功"
+ fi
+ fi
+}
+
+UNINSTALL_REDIS()
+{
+ if [ -d /www/server/redis ];then
+ echo -e "----------------------------------------------------"
+ echo -e "检查已有Redis环境,卸载可能影响现有站点及数据"
+ echo -e "----------------------------------------------------"
+ read -p "输入yes强制卸载所有Redis[yes/no]: " yes;
+ if [ "$yes" != "yes" ];then
+ echo -e "------------"
+ echo "取消卸载Redis"
+ else
+ cd /www/server/mdserver-web/plugins/redis && bash install.sh uninstall 7.0.4
+ echo "卸载Redis成功"
+ fi
+ fi
+}
+
+UNINSTALL_MW()
+{
+ echo -e "----------------------------------------------------"
+ echo -e "检查已有mderver-web环境,卸载可能影响现有站点及数据"
+ echo -e "----------------------------------------------------"
+ read -p "输入yes强制卸载面板: " yes;
+ if [ "$yes" != "yes" ];then
+ echo -e "------------"
+ echo "取消卸载面板"
+ else
+ rm -rf /usr/bin/mw
+ rm -rf /etc/init.d/mw
+ systemctl daemon-reload
+ rm -rf /www/server/mdserver-web
+ echo "卸载面板成功"
+ fi
+}
+
+UNINSTALL_CHECK
+
+UNINSTALL_OP
+UNINSTALL_PHP
+UNINSTALL_MySQL
+UNINSTALL_MEMCACHED
+UNINSTALL_REDIS
+UNINSTALL_MW
endTime=`date +%s`
((outTime=(${endTime}-${startTime})/60))
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
-
-
-systemctl daemon-reload
|