mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
ipdate
This commit is contained in:
+16
-5
@@ -538,25 +538,36 @@ def getLibConf(version):
|
||||
|
||||
def installLib(version):
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['type', 'name'])
|
||||
data = checkArgs(args, ['name'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
name = args['name']
|
||||
stype = args['type']
|
||||
execstr = "cd " + getPluginDir() + '/versions/' + version + " && /bin/bash " + \
|
||||
name + '.sh' + " " + stype + " " + version
|
||||
name + '.sh' + ' install ' + version
|
||||
|
||||
rettime = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
insert_info = (None, '安装[' + name + '-' + version + ']',
|
||||
'execshell', '0', rettime, execstr)
|
||||
public.M('tasks').add('id,name,type,status,addtime,execstr', insert_info)
|
||||
# print execstr
|
||||
return public.returnJson(True, '已将下载任务添加到队列!')
|
||||
|
||||
|
||||
def uninstallLib(version):
|
||||
return 'ok'
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['name'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
name = args['name']
|
||||
execstr = "cd " + getPluginDir() + '/versions/' + version + " && /bin/bash " + \
|
||||
name + '.sh' + ' uninstall ' + version
|
||||
|
||||
rettime = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
insert_info = (None, '安装[' + name + '-' + version + ']',
|
||||
'execshell', '0', rettime, execstr)
|
||||
public.M('tasks').add('id,name,type,status,addtime,execstr', insert_info)
|
||||
return public.returnJson(True, '已将卸载载任务添加到队列!')
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
||||
+63
-77
@@ -469,92 +469,79 @@ function phpLibConfig(version){
|
||||
|
||||
|
||||
//PHP扩展配置
|
||||
function setPHPConfig(version, pathinfo, go) {
|
||||
$.get('/ajax?action=GetPHPConfig&version=' + version, function(rdata) {
|
||||
var body = ""
|
||||
var opt = ""
|
||||
for (var i = 0; i < rdata.libs.length; i++) {
|
||||
if (rdata.libs[i].versions.indexOf(version) == -1) continue;
|
||||
if (rdata.libs[i]['task'] == '-1' && rdata.libs[i].phpversions.indexOf(version) != -1) {
|
||||
opt = '<a style="color:green;" href="javascript:messageBox();">' + lan.soft.the_install + '</a>'
|
||||
} else if (rdata.libs[i]['task'] == '0' && rdata.libs[i].phpversions.indexOf(version) != -1) {
|
||||
opt = '<a style="color:#C0C0C0;" href="javascript:messageBox();">' + lan.soft.sleep_install + '</a>'
|
||||
} else if (rdata.libs[i].status) {
|
||||
opt = '<a style="color:red;" href="javascript:UninstallPHPLib(\'' + version + '\',\'' + rdata.libs[i].name + '\',\'' + rdata.libs[i].title + '\',' + pathinfo + ');">' + lan.soft.uninstall + '</a>'
|
||||
} else {
|
||||
opt = '<a class="btlink" href="javascript:InstallPHPLib(\'' + version + '\',\'' + rdata.libs[i].name + '\',\'' + rdata.libs[i].title + '\',' + pathinfo + ');">' + lan.soft.install + '</a>'
|
||||
}
|
||||
// function setPHPConfig(version, pathinfo, go) {
|
||||
// $.get('/ajax?action=GetPHPConfig&version=' + version, function(rdata) {
|
||||
// var body = ""
|
||||
// var opt = ""
|
||||
// for (var i = 0; i < rdata.libs.length; i++) {
|
||||
// if (rdata.libs[i].versions.indexOf(version) == -1) continue;
|
||||
// if (rdata.libs[i]['task'] == '-1' && rdata.libs[i].phpversions.indexOf(version) != -1) {
|
||||
// opt = '<a style="color:green;" href="javascript:messageBox();">' + lan.soft.the_install + '</a>'
|
||||
// } else if (rdata.libs[i]['task'] == '0' && rdata.libs[i].phpversions.indexOf(version) != -1) {
|
||||
// opt = '<a style="color:#C0C0C0;" href="javascript:messageBox();">' + lan.soft.sleep_install + '</a>'
|
||||
// } else if (rdata.libs[i].status) {
|
||||
// opt = '<a style="color:red;" href="javascript:UninstallPHPLib(\'' + version + '\',\'' + rdata.libs[i].name + '\',\'' + rdata.libs[i].title + '\',' + pathinfo + ');">' + lan.soft.uninstall + '</a>'
|
||||
// } else {
|
||||
// opt = '<a class="btlink" href="javascript:InstallPHPLib(\'' + version + '\',\'' + rdata.libs[i].name + '\',\'' + rdata.libs[i].title + '\',' + pathinfo + ');">' + lan.soft.install + '</a>'
|
||||
// }
|
||||
|
||||
body += '<tr>' +
|
||||
'<td>' + rdata.libs[i].name + '</td>' +
|
||||
'<td>' + rdata.libs[i].type + '</td>' +
|
||||
'<td>' + rdata.libs[i].msg + '</td>' +
|
||||
'<td><span class="ico-' + (rdata.libs[i].status ? 'start' : 'stop') + ' glyphicon glyphicon-' + (rdata.libs[i].status ? 'ok' : 'remove') + '"></span></td>' +
|
||||
'<td style="text-align: right;">' + opt + '</td>' +
|
||||
'</tr>'
|
||||
}
|
||||
// body += '<tr>' +
|
||||
// '<td>' + rdata.libs[i].name + '</td>' +
|
||||
// '<td>' + rdata.libs[i].type + '</td>' +
|
||||
// '<td>' + rdata.libs[i].msg + '</td>' +
|
||||
// '<td><span class="ico-' + (rdata.libs[i].status ? 'start' : 'stop') + ' glyphicon glyphicon-' + (rdata.libs[i].status ? 'ok' : 'remove') + '"></span></td>' +
|
||||
// '<td style="text-align: right;">' + opt + '</td>' +
|
||||
// '</tr>'
|
||||
// }
|
||||
|
||||
var pathinfoOpt = '<a style="color:red;" href="javascript:SetPathInfo(\'' + version + '\',\'off\');">' + lan.soft.off + '</a>'
|
||||
if (!rdata.pathinfo) {
|
||||
pathinfoOpt = '<a class="btlink" href="javascript:SetPathInfo(\'' + version + '\',\'on\');">' + lan.soft.on + '</a>'
|
||||
}
|
||||
var pathinfo1 = '<tr id="pathInfo"><td>PATH_INFO</td><td>' + lan.soft.php_menu_ext + '</td><td>' + lan.soft.mvc_ps + '</td><td><span class="ico-' + (rdata.pathinfo ? 'start' : 'stop') + ' glyphicon glyphicon-' + (rdata.pathinfo ? 'ok' : 'remove') + '"></span></td><td style="text-align: right;" width="50">' + pathinfoOpt + '</td></tr>';
|
||||
var con = '<div class="divtable" id="phpextdiv" style="margin-right:10px;height: 420px; overflow: auto; margin-right: 0px;">' +
|
||||
'<table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">' +
|
||||
'<thead>' +
|
||||
'<tr>' +
|
||||
'<th>' + lan.soft.php_ext_name + '</th>' +
|
||||
'<th width="64">' + lan.soft.php_ext_type + '</th>' +
|
||||
'<th>' + lan.soft.php_ext_ps + '</th>' +
|
||||
'<th width="40">' + lan.soft.php_ext_status + '</th>' +
|
||||
'<th style="text-align: right;" width="50">' + lan.public.action + '</th>' +
|
||||
'</tr>' +
|
||||
'</thead>' +
|
||||
'<tbody>' + pathinfo1 + body + '</tbody>' +
|
||||
'</table>' +
|
||||
'</div>' +
|
||||
'<ul class="help-info-text c7 pull-left"><li>请按实际需求安装扩展,不要安装不必要的PHP扩展,这会影响PHP执行效率,甚至出现异常</li><li>Redis扩展只允许在1个PHP版本中使用,安装到其它PHP版本请在[软件管理]重装Redis</li><li>opcache/xcache/apc等脚本缓存扩展,请只安装其中1个,否则可能导致您的站点程序异常</li></ul>';
|
||||
var divObj = document.getElementById('phpextdiv');
|
||||
var scrollTopNum = 0;
|
||||
if (divObj) scrollTopNum = divObj.scrollTop;
|
||||
$(".soft-man-con").html(con);
|
||||
document.getElementById('phpextdiv').scrollTop = scrollTopNum;
|
||||
});
|
||||
// var pathinfoOpt = '<a style="color:red;" href="javascript:SetPathInfo(\'' + version + '\',\'off\');">' + lan.soft.off + '</a>'
|
||||
// if (!rdata.pathinfo) {
|
||||
// pathinfoOpt = '<a class="btlink" href="javascript:SetPathInfo(\'' + version + '\',\'on\');">' + lan.soft.on + '</a>'
|
||||
// }
|
||||
// var pathinfo1 = '<tr id="pathInfo"><td>PATH_INFO</td><td>' + lan.soft.php_menu_ext + '</td><td>' + lan.soft.mvc_ps + '</td><td><span class="ico-' + (rdata.pathinfo ? 'start' : 'stop') + ' glyphicon glyphicon-' + (rdata.pathinfo ? 'ok' : 'remove') + '"></span></td><td style="text-align: right;" width="50">' + pathinfoOpt + '</td></tr>';
|
||||
// var con = '<div class="divtable" id="phpextdiv" style="margin-right:10px;height: 420px; overflow: auto; margin-right: 0px;">' +
|
||||
// '<table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">' +
|
||||
// '<thead>' +
|
||||
// '<tr>' +
|
||||
// '<th>' + lan.soft.php_ext_name + '</th>' +
|
||||
// '<th width="64">' + lan.soft.php_ext_type + '</th>' +
|
||||
// '<th>' + lan.soft.php_ext_ps + '</th>' +
|
||||
// '<th width="40">' + lan.soft.php_ext_status + '</th>' +
|
||||
// '<th style="text-align: right;" width="50">' + lan.public.action + '</th>' +
|
||||
// '</tr>' +
|
||||
// '</thead>' +
|
||||
// '<tbody>' + pathinfo1 + body + '</tbody>' +
|
||||
// '</table>' +
|
||||
// '</div>' +
|
||||
// '<ul class="help-info-text c7 pull-left"><li>请按实际需求安装扩展,不要安装不必要的PHP扩展,这会影响PHP执行效率,甚至出现异常</li><li>Redis扩展只允许在1个PHP版本中使用,安装到其它PHP版本请在[软件管理]重装Redis</li><li>opcache/xcache/apc等脚本缓存扩展,请只安装其中1个,否则可能导致您的站点程序异常</li></ul>';
|
||||
// var divObj = document.getElementById('phpextdiv');
|
||||
// var scrollTopNum = 0;
|
||||
// if (divObj) scrollTopNum = divObj.scrollTop;
|
||||
// $(".soft-man-con").html(con);
|
||||
// document.getElementById('phpextdiv').scrollTop = scrollTopNum;
|
||||
// });
|
||||
|
||||
if (go == undefined) {
|
||||
setTimeout(function() {
|
||||
if ($(".bgw #phpext").html() != '安装扩展') {
|
||||
return;
|
||||
}
|
||||
SetPHPConfig(version, pathinfo);
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
// if (go == undefined) {
|
||||
// setTimeout(function() {
|
||||
// if ($(".bgw #phpext").html() != '安装扩展') {
|
||||
// return;
|
||||
// }
|
||||
// SetPHPConfig(version, pathinfo);
|
||||
// }, 3000);
|
||||
// }
|
||||
// }
|
||||
|
||||
//安装扩展
|
||||
function installPHPLib(version, name, title, pathinfo) {
|
||||
layer.confirm('您真的要安装{1}吗?'.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() {
|
||||
name = name.toLowerCase();
|
||||
var data = "name=" + name + "&version=" + version + "&type=1";
|
||||
// var loadT = layer.msg('正在添加到安装器...', { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
// $.post('/files?action=InstallSoft', data, function(rdata) {
|
||||
// setTimeout(function() {
|
||||
// layer.close(loadT);
|
||||
// SetPHPConfig(version, pathinfo, true);
|
||||
// setTimeout(function() {
|
||||
// layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
// }, 1000);
|
||||
// }, 1000);
|
||||
// });
|
||||
|
||||
phpPost('install_lib', version, data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
console.log(rdata);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
getTaskCount();
|
||||
});
|
||||
|
||||
// fly("bi-btn");
|
||||
// installTips();
|
||||
getTaskCount();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -563,11 +550,10 @@ function uninstallPHPLib(version, name, title, pathinfo) {
|
||||
layer.confirm('您真的要安装{1}吗?'.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() {
|
||||
name = name.toLowerCase();
|
||||
var data = 'name=' + name + '&version=' + version;
|
||||
var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/files?action=UninstallSoft', data, function(rdata) {
|
||||
layer.close(loadT);
|
||||
phpPost('uninstall_lib', version, data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
SetPHPConfig(version, pathinfo, true);
|
||||
getTaskCount();
|
||||
});
|
||||
});
|
||||
}
|
||||
Regular → Executable
+31
-64
@@ -2,58 +2,42 @@
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source/php
|
||||
echo $serverPath,$sourcePath
|
||||
Install_yaf()
|
||||
{
|
||||
case "${version}" in
|
||||
'54')
|
||||
extFile='/www/server/php/54/lib/php/extensions/no-debug-non-zts-20100525/yaf.so'
|
||||
;;
|
||||
'55')
|
||||
extFile='/www/server/php/55/lib/php/extensions/no-debug-non-zts-20121212/yaf.so'
|
||||
;;
|
||||
'56')
|
||||
extFile='/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/yaf.so'
|
||||
;;
|
||||
'70')
|
||||
extFile='/www/server/php/70/lib/php/extensions/no-debug-non-zts-20151012/yaf.so'
|
||||
;;
|
||||
'71')
|
||||
extFile='/www/server/php/71/lib/php/extensions/no-debug-non-zts-20160303/yaf.so'
|
||||
;;
|
||||
'71')
|
||||
extFile='/www/server/php/71/lib/php/extensions/no-debug-non-zts-20160303/yaf.so'
|
||||
;;
|
||||
'72')
|
||||
extFile='/www/server/php/72/lib/php/extensions/no-debug-non-zts-20170718/yaf.so'
|
||||
;;
|
||||
esac
|
||||
|
||||
isInstall=`cat /www/server/php/$version/etc/php.ini|grep 'yaf.so'`
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20131226/yaf.so
|
||||
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep 'yaf.so'`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$vphp 已安装yaf,请选择其它版本!"
|
||||
echo "php-$version 已安装yaf,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
public_file=/www/server/panel/install/public.sh
|
||||
if [ ! -f $public_file ];then
|
||||
wget -O $public_file http://download.bt.cn/install/public.sh -T 5;
|
||||
fi
|
||||
. $public_file
|
||||
|
||||
download_Url=$NODE_URL
|
||||
|
||||
wafV='2.3.5';
|
||||
if [ "$version" = '70' ] || [ "$version" = '71' ] || [ "$version" = '72' ];then
|
||||
wafV='3.0.7';
|
||||
fi
|
||||
wget -O yaf-$wafV.tgz $download_Url/src/yaf-$wafV.tgz
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
wget -O $php_lib/yaf-$wafV.tgz http://pecl.php.net/get/yaf-$wafV.tgz
|
||||
cd $php_lib
|
||||
tar xvf yaf-$wafV.tgz
|
||||
cd yaf-$wafV
|
||||
|
||||
/www/server/php/$version/bin/phpize
|
||||
./configure --with-php-config=/www/server/php/$version/bin/php-config
|
||||
echo "$serverPath/php/$version/bin/phpize"
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make && make install
|
||||
cd ..
|
||||
rm -rf yaf-*
|
||||
@@ -64,9 +48,10 @@ Install_yaf()
|
||||
echo "ERROR!"
|
||||
return;
|
||||
fi
|
||||
echo "extension=$extFile" >> /www/server/php/$version/etc/php.ini
|
||||
echo "extension=$extFile"
|
||||
echo "extension=$extFile" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
service php-fpm-$version reload
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
@@ -74,39 +59,22 @@ Install_yaf()
|
||||
|
||||
Uninstall_yaf()
|
||||
{
|
||||
if [ ! -f "/www/server/php/$version/bin/php-config" ];then
|
||||
echo "php-$vphp 未安装,请选择其它版本!"
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
case "${version}" in
|
||||
'54')
|
||||
extFile='/www/server/php/54/lib/php/extensions/no-debug-non-zts-20100525/yaf.so'
|
||||
;;
|
||||
'55')
|
||||
extFile='/www/server/php/55/lib/php/extensions/no-debug-non-zts-20121212/yaf.so'
|
||||
;;
|
||||
'56')
|
||||
extFile='/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/yaf.so'
|
||||
;;
|
||||
'70')
|
||||
extFile='/www/server/php/70/lib/php/extensions/no-debug-non-zts-20151012/yaf.so'
|
||||
;;
|
||||
'71')
|
||||
extFile='/www/server/php/71/lib/php/extensions/no-debug-non-zts-20160303/yaf.so'
|
||||
;;
|
||||
'72')
|
||||
extFile='/www/server/php/72/lib/php/extensions/no-debug-non-zts-20170718/yaf.so'
|
||||
esac
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20131226/yaf.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$vphp 未安装yaf,请选择其它版本!"
|
||||
echo "php$version 未安装yaf,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
sed -i '/yaf.so/d' /www/server/php/$version/etc/php.ini
|
||||
echo $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' '/yaf.so/d' $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -f $extFile
|
||||
/etc/init.d/php-fpm-$version reload
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
@@ -114,7 +82,6 @@ Uninstall_yaf()
|
||||
|
||||
actionType=$1
|
||||
version=$2
|
||||
vphp=${version:0:1}.${version:1:1}
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_yaf
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
|
||||
Reference in New Issue
Block a user