pull/109/head
Mr Chen 6 years ago
parent 72516ce785
commit b113c7fd07
  1. 30
      class/core/files_api.py
  2. 1
      class/core/plugins_api.py
  3. 90
      plugins/php/versions/72/redis.sh
  4. 3
      plugins/php/versions/phplib.conf
  5. 33
      route/static/app/public.js

@ -134,6 +134,36 @@ class files_api:
# self.setFileAccept(path + '/' + filename)
return public.returnJson(True, '已将下载任务添加到队列!')
def removeTaskApi(self):
mid = request.form.get('id', '').encode('utf-8')
try:
name = public.M('tasks').where('id=?', (mid,)).getField('name')
status = public.M('tasks').where('id=?', (mid,)).getField('status')
public.M('tasks').delete(mid)
if status == '-1':
os.system(
"kill `ps -ef |grep 'python panelSafe.pyc'|grep -v grep|grep -v panelExec|awk '{print $2}'`")
os.system(
"kill `ps aux | grep 'python task.pyc$'|awk '{print $2}'`")
os.system('''
pids=`ps aux | grep 'sh'|grep -v grep|grep install|awk '{print $2}'`
arr=($pids)
for p in ${arr[@]}
do
kill -9 $p
done
''')
os.system(
'rm -f ' + name.replace('扫描目录[', '').replace(']', '') + '/scan.pl')
isTask = public.getRootDir() + '/tmp/panelTask.pl'
public.writeFile(isTask, 'True')
os.system('/etc/init.d/mw start')
except:
os.system('/etc/init.d/mw start')
return public.returnJson(True, '任务已删除!')
def getRecycleBinApi(self):
rPath = self.rPath
if not os.path.exists(rPath):

@ -232,7 +232,6 @@ class plugins_api:
return isTask
def checkStatus(self, info):
if not info['setup']:
return False

@ -0,0 +1,90 @@
#!/bin/bash
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
LIBNAME=redis
sysName=`uname`
actionType=$1
version=$2
extDir=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20170718/
Install_lib()
{
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
if [ "${isInstall}" != "" ];then
echo "php$version 已安装${LIBNAME},请选择其它版本!"
return
fi
extFile=$extDir${LIBNAME}.so
if [ ! -f "$extFile" ];then
php_lib=$sourcePath/php_${version}_lib
mkdir -p $php_lib
if [ ! -f $php_lib/redis-4.2.0.tgz ];then
wget -O $php_lib/redis-4.2.0.tgz http://pecl.php.net/get/redis-4.2.0.tgz
fi
cd $php_lib && tar xvf redis-4.2.0.tgz
cd redis-4.2.0
$serverPath/php/$version/bin/phpize
./configure --with-php-config=$serverPath/php/$version/bin/php-config
make && make install
cd $php_lib
rm -rf redis-*
rm -f package.xml
fi
sleep 1
if [ ! -f "$extFile" ];then
echo "ERROR!"
return
fi
echo "extension=redis.so" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
echo '==========================================================='
echo 'successful!'
}
Uninstall_lib()
{
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
echo "php$version 未安装,请选择其它版本!"
return
fi
extFile=$extDir${LIBNAME}.so
if [ ! -f "$extFile" ];then
echo "php$version 未安装${LIBNAME},请选择其它版本!"
echo "php-$vphp not install memcache, Plese select other version!"
return
fi
sed -i '_bak' '/redis.so/d' $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi

@ -112,7 +112,8 @@
"55",
"56",
"70",
"71"
"71",
"72"
],
"type": "缓存器",
"msg": "更强大的内容缓存器,支持集群",

@ -681,17 +681,17 @@ function ActionTask() {
}
function removeTask(b) {
var a = layer.msg(lan.public.the_del, {
var a = layer.msg('正在删除,请稍候...', {
icon: 16,
time: 0,
shade: [0.3, "#000"]
});
$.post("/files?action=RemoveTask", "id=" + b, function(c) {
$.post("/files/remove_task", "id=" + b, function(c) {
layer.close(a);
layer.msg(c.msg, {
icon: c.status ? 1 : 5
});
}).error(function(){
},'json').error(function(){
layer.msg(lan.bt.task_close,{icon:1});
});
}
@ -990,7 +990,7 @@ function execLog(){
function remind(a){
a = a == undefined ? 1 : a;
$.post("/task/list", "tojs=remind&table=tasks&result=2,4,6,8&limit=8&p=" + a, function(g) {
$.post("/task/list", "table=tasks&result=2,4,6,8&limit=10&p=" + a, function(g) {
var e = "";
var f = false;
var task_count = 0;
@ -1006,7 +1006,11 @@ function remind(a){
<tbody id="remind">'+e+'</tbody>\
</table></div>\
<div class="mtb15" style="height:32px">\
<div class="pull-left buttongroup" style="display:none;"><button class="btn btn-default btn-sm mr5 rs-del" disabled="disabled">'+lan.public.del+'</button><button class="btn btn-default btn-sm mr5 rs-read" disabled="disabled">'+lan.bt.task_tip_read+'</button><button class="btn btn-default btn-sm">'+lan.bt.task_tip_all+'</button></div>\
<div class="pull-left buttongroup" style="display:none;">\
<button class="btn btn-default btn-sm mr5 rs-del" disabled="disabled">'+lan.public.del+'</button>\
<button class="btn btn-default btn-sm mr5 rs-read" disabled="disabled">'+lan.bt.task_tip_read+'</button>\
<button class="btn btn-default btn-sm">'+lan.bt.task_tip_all+'</button>\
</div>\
<div id="taskPage" class="page"></div>\
</div>';
@ -1062,15 +1066,15 @@ function getReloads() {
c += f[e] + "<br>"
}
if(h.task[g].name.indexOf("扫描") != -1) {
b = "<li><span class='titlename'>" + h.task[g].name + "</span><span class='state'>正在扫描<img src='/static/img/ing.gif'> | <a href=\"javascript:RemoveTask(" + h.task[g].id + ")\">关闭</a></span><span class='opencmd'></span><div class='cmd'>" + c + "</div></li>"
b = "<li><span class='titlename'>" + h.task[g].name + "</span><span class='state'>正在扫描<img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + h.task[g].id + ")\">关闭</a></span><span class='opencmd'></span><div class='cmd'>" + c + "</div></li>"
} else {
b = "<li><span class='titlename'>" + h.task[g].name + "</span><span class='state'>正在安装<img src='/static/img/ing.gif'> | <a href=\"javascript:RemoveTask(" + h.task[g].id + ")\">关闭</a></span><div class='cmd'>" + c + "</div></li>"
b = "<li><span class='titlename'>" + h.task[g].name + "</span><span class='state'>正在安装<img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + h.task[g].id + ")\">关闭</a></span><div class='cmd'>" + c + "</div></li>"
}
} else {
b = "<li><div class='line-progress' style='width:" + h.msg.pre + "%'></div><span class='titlename'>" + h.task[g].name + "<a style='margin-left:130px;'>" + (toSize(h.msg.used) + "/" + toSize(h.msg.total)) + "</a></span><span class='com-progress'>" + h.msg.pre + "%</span><span class='state'>"+lan.bt.task_downloading+" <img src='/static/img/ing.gif'> | <a href=\"javascript:RemoveTask(" + h.task[g].id + ")\">"+lan.public.close+"</a></span></li>"
}
} else {
d += "<li><span class='titlename'>" + h.task[g].name + "</span><span class='state'>等待 | <a style='color:green' href=\"javascript:RemoveTask(" + h.task[g].id + ')">删除</a></span></li>'
d += "<li><span class='titlename'>" + h.task[g].name + "</span><span class='state'>等待 | <a style='color:green' href=\"javascript:removeTask(" + h.task[g].id + ')">删除</a></span></li>'
}
}
$(".cmdlist").html(b + d);
@ -1102,10 +1106,11 @@ function RscheckSelect(){
function tasklist(a){
var con='<ul class="cmdlist"></ul><span style="position: fixed;bottom: 13px;">若任务长时间未执行,请尝试在首页点【重启面板】来重置任务队列</span>';
var con='<ul class="cmdlist"></ul>\
<span style="position: fixed;bottom: 13px;">若任务长时间未执行请尝试在首页点重启面板来重置任务队列</span>';
$(".taskcon").html(con);
a = a == undefined ? 1 : a;
$.post("/task/list", "tojs=GetTaskList&table=tasks&limit=10&p=" + a, function(g) {
$.post("/task/list", "tojs=getTaskList&table=tasks&limit=10&p=" + a, function(g) {
var e = "";
var b = "";
var c = "";
@ -1116,14 +1121,14 @@ function tasklist(a){
case "-1":
f = true;
if(g.data[d].type != "download") {
b = "<li><span class='titlename'>" + g.data[d].name + "</span><span class='state pull-right c6'>"+lan.bt.task_install+" <img src='/static/img/ing.gif'> | <a class='btlink' href=\"javascript:RemoveTask(" + g.data[d].id + ")\">"+lan.public.close+"</a></span><span class='opencmd'></span><pre class='cmd'></pre></li>"
b = "<li><span class='titlename'>" + g.data[d].name + "</span><span class='state pull-right c6'>正在安装<img src='/static/img/ing.gif'> | <a class='btlink' href=\"javascript:removeTask(" + g.data[d].id + ")\">关闭</a></span><span class='opencmd'></span><pre class='cmd'></pre></li>"
} else {
b = "<li><div class='line-progress' style='width:0%'></div><span class='titlename'>" + g.data[d].name + "<a id='speed' style='margin-left:130px;'>0.0M/12.5M</a></span><span class='com-progress'>0%</span><span class='state'>"+lan.bt.task_downloading+" <img src='/static/img/ing.gif'> | <a href=\"javascript:RemoveTask(" + g.data[d].id + ")\">"+lan.public.close+"</a></span></li>"
b = "<li><div class='line-progress' style='width:0%'></div><span class='titlename'>" + g.data[d].name + "<a id='speed' style='margin-left:130px;'>0.0M/12.5M</a></span><span class='com-progress'>0%</span><span class='state'>下载中 <img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + g.data[d].id + ")\">关闭</a></span></li>"
}
task_count++;
break;
case "0":
c += "<li><span class='titlename'>" + g.data[d].name + "</span><span class='state pull-right c6'>"+lan.bt.task_sleep+"</span> | <a href=\"javascript:RemoveTask(" + g.data[d].id + ")\" class='btlink'>"+lan.public.del+"</a></li>";
c += "<li><span class='titlename'>" + g.data[d].name + "</span><span class='state pull-right c6'>等待</span> | <a href=\"javascript:removeTask(" + g.data[d].id + ")\" class='btlink'>"+lan.public.del+"</a></li>";
task_count++;
break;
}
@ -1134,7 +1139,7 @@ function tasklist(a){
$(".cmdlist").html(b + c);
getReloads();
return f
},'json')
},'json');
}
//检查登陆状态

Loading…
Cancel
Save