diff --git a/class/core/task_api.py b/class/core/task_api.py
index 43d1d81d6..e742a8523 100755
--- a/class/core/task_api.py
+++ b/class/core/task_api.py
@@ -10,6 +10,9 @@ import json
import pwd
+from flask import request
+
+
class task_api:
def __init__(self):
@@ -20,8 +23,16 @@ class task_api:
return str(c)
def listApi(self):
- _list = public.M('tasks').where('', ()).field('id,name,type,status,addtime,start,end').limit(
- '0,5').order('id desc').select()
+
+ p = request.form.get('p', '1').encode('utf-8')
+ limit = request.form.get('limit', '10').strip()
+ search = request.form.get('search', '').strip()
+
+ start = (int(p) - 1) * int(limit)
+ limit_str = str(start) + ',' + str(limit)
+
+ _list = public.M('tasks').where('', ()).field(
+ 'id,name,type,status,addtime,start,end').limit(limit_str).order('id desc').select()
_ret = {}
_ret['data'] = _list
@@ -29,6 +40,7 @@ class task_api:
_page = {}
_page['count'] = count
_page['tojs'] = 'remind'
+ _page['p'] = p
_ret['page'] = public.getPage(_page)
return public.getJson(_ret)
diff --git a/plugins/php/index.py b/plugins/php/index.py
index 45008b784..32f960448 100755
--- a/plugins/php/index.py
+++ b/plugins/php/index.py
@@ -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__":
diff --git a/plugins/php/js/php.js b/plugins/php/js/php.js
index 52d736cad..4798ee2f8 100755
--- a/plugins/php/js/php.js
+++ b/plugins/php/js/php.js
@@ -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 = '' + lan.soft.the_install + ''
- } else if (rdata.libs[i]['task'] == '0' && rdata.libs[i].phpversions.indexOf(version) != -1) {
- opt = '' + lan.soft.sleep_install + ''
- } else if (rdata.libs[i].status) {
- opt = '' + lan.soft.uninstall + ''
- } else {
- opt = '' + lan.soft.install + ''
- }
-
- body += '
' +
- '' + rdata.libs[i].name + ' | ' +
- '' + rdata.libs[i].type + ' | ' +
- '' + rdata.libs[i].msg + ' | ' +
- ' | ' +
- '' + opt + ' | ' +
- '
'
- }
+// 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 = '' + lan.soft.the_install + ''
+// } else if (rdata.libs[i]['task'] == '0' && rdata.libs[i].phpversions.indexOf(version) != -1) {
+// opt = '' + lan.soft.sleep_install + ''
+// } else if (rdata.libs[i].status) {
+// opt = '' + lan.soft.uninstall + ''
+// } else {
+// opt = '' + lan.soft.install + ''
+// }
+
+// body += '' +
+// '' + rdata.libs[i].name + ' | ' +
+// '' + rdata.libs[i].type + ' | ' +
+// '' + rdata.libs[i].msg + ' | ' +
+// ' | ' +
+// '' + opt + ' | ' +
+// '
'
+// }
- var pathinfoOpt = '' + lan.soft.off + ''
- if (!rdata.pathinfo) {
- pathinfoOpt = '' + lan.soft.on + ''
- }
- var pathinfo1 = 'PATH_INFO | ' + lan.soft.php_menu_ext + ' | ' + lan.soft.mvc_ps + ' | | ' + pathinfoOpt + ' |
';
- var con = '' +
- '
' +
- '' +
- '' +
- '' + lan.soft.php_ext_name + ' | ' +
- '' + lan.soft.php_ext_type + ' | ' +
- '' + lan.soft.php_ext_ps + ' | ' +
- '' + lan.soft.php_ext_status + ' | ' +
- '' + lan.public.action + ' | ' +
- '
' +
- '' +
- '' + pathinfo1 + body + '' +
- '
' +
- '
' +
- '- 请按实际需求安装扩展,不要安装不必要的PHP扩展,这会影响PHP执行效率,甚至出现异常
- Redis扩展只允许在1个PHP版本中使用,安装到其它PHP版本请在[软件管理]重装Redis
- opcache/xcache/apc等脚本缓存扩展,请只安装其中1个,否则可能导致您的站点程序异常
';
- 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 = '' + lan.soft.off + ''
+// if (!rdata.pathinfo) {
+// pathinfoOpt = '' + lan.soft.on + ''
+// }
+// var pathinfo1 = 'PATH_INFO | ' + lan.soft.php_menu_ext + ' | ' + lan.soft.mvc_ps + ' | | ' + pathinfoOpt + ' |
';
+// var con = '' +
+// '
' +
+// '' +
+// '' +
+// '' + lan.soft.php_ext_name + ' | ' +
+// '' + lan.soft.php_ext_type + ' | ' +
+// '' + lan.soft.php_ext_ps + ' | ' +
+// '' + lan.soft.php_ext_status + ' | ' +
+// '' + lan.public.action + ' | ' +
+// '
' +
+// '' +
+// '' + pathinfo1 + body + '' +
+// '
' +
+// '
' +
+// '- 请按实际需求安装扩展,不要安装不必要的PHP扩展,这会影响PHP执行效率,甚至出现异常
- Redis扩展只允许在1个PHP版本中使用,安装到其它PHP版本请在[软件管理]重装Redis
- opcache/xcache/apc等脚本缓存扩展,请只安装其中1个,否则可能导致您的站点程序异常
';
+// 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();
});
});
}
\ No newline at end of file
diff --git a/plugins/php/versions/56/yaf.sh b/plugins/php/versions/56/yaf.sh
old mode 100644
new mode 100755
index 67add87aa..b0c7b2af2
--- a/plugins/php/versions/56/yaf.sh
+++ b/plugins/php/versions/56/yaf.sh
@@ -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