update
This commit is contained in:
parent
e67bf38631
commit
22bc48141d
|
|
@ -17,7 +17,8 @@ class config_api:
|
|||
|
||||
# 本版解决自启动问题
|
||||
# openresty 自启动 done
|
||||
__version = '0.5.0'
|
||||
# php 自动 done
|
||||
__version = '0.5.2'
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="pluginService('php', $('.plugin_version').attr('version'));">服务</p>
|
||||
<p onclick="pluginInitD('php', $('.plugin_version').attr('version'));">自启动</p>
|
||||
<p onclick="phpLibConfig($('.plugin_version').attr('version'));">安装扩展</p>
|
||||
<p onclick="phpSetConfig($('.plugin_version').attr('version'));">配置修改</p>
|
||||
<p onclick="phpUploadLimitReq($('.plugin_version').attr('version'));">上传限制</p>
|
||||
|
|
@ -25,5 +26,4 @@
|
|||
$.getScript( "/plugins/file?name=php&f=js/php.js", function(){
|
||||
pluginService('php', $('.plugin_version').attr('version'));
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
@ -33,10 +33,10 @@ def getServerDir():
|
|||
return public.getServerDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getInitDFile():
|
||||
def getInitDFile(version):
|
||||
if app_debug:
|
||||
return '/tmp/' + getPluginName()
|
||||
return '/etc/init.d/' + getPluginName()
|
||||
return '/etc/init.d/' + getPluginName()+version
|
||||
|
||||
|
||||
def getArgs():
|
||||
|
|
@ -216,6 +216,41 @@ def reload(version):
|
|||
return phpOp(version, 'reload')
|
||||
|
||||
|
||||
def initdStatus(version):
|
||||
if not app_debug:
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
initd_bin = getInitDFile(version)
|
||||
if os.path.exists(initd_bin):
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
|
||||
|
||||
def initdInstall(version):
|
||||
import shutil
|
||||
if not app_debug:
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
source_bin = initReplace(version)
|
||||
initd_bin = getInitDFile(version)
|
||||
shutil.copyfile(source_bin, initd_bin)
|
||||
public.execShell('chmod +x ' + initd_bin)
|
||||
public.execShell('chkconfig --add ' + getPluginName()+version)
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdUinstall(version):
|
||||
if not app_debug:
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
public.execShell('chkconfig --del ' + getPluginName())
|
||||
initd_bin = getInitDFile(version)
|
||||
os.remove(initd_bin)
|
||||
return 'ok'
|
||||
|
||||
|
||||
def fpmLog(version):
|
||||
return getServerDir() + '/' + version + '/var/log/php-fpm.log'
|
||||
|
||||
|
|
@ -595,6 +630,12 @@ if __name__ == "__main__":
|
|||
print restart(version)
|
||||
elif func == 'reload':
|
||||
print reload(version)
|
||||
elif func == 'initd_status':
|
||||
print initdStatus(version)
|
||||
elif func == 'initd_install':
|
||||
print initdInstall(version)
|
||||
elif func == 'initd_uninstall':
|
||||
print initdUinstall(version)
|
||||
elif func == 'fpm_log':
|
||||
print fpmLog(version)
|
||||
elif func == 'fpm_slow_log':
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#! /bin/sh
|
||||
# chkconfig: 2345 55 25
|
||||
# description: PHP Service
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: php-fpm
|
||||
|
|
|
|||
|
|
@ -1773,9 +1773,13 @@ function pluginConfigSave(fileName) {
|
|||
}
|
||||
|
||||
|
||||
function pluginInitD(_name){
|
||||
|
||||
function pluginInitD(_name,_version){
|
||||
if (typeof _version == 'undefined'){
|
||||
_version = '';
|
||||
}
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
$.post('/plugins/run', {name:_name, func:'initd_status'}, function(data) {
|
||||
$.post('/plugins/run', {name:_name, func:'initd_status',version : _version}, function(data) {
|
||||
layer.close(loadT);
|
||||
if( !data.status ){
|
||||
layer.msg(data.msg,{icon:0,time:3000,shade: [0.3, '#000']});
|
||||
|
|
@ -1786,41 +1790,41 @@ function pluginInitD(_name){
|
|||
return;
|
||||
}
|
||||
if (data.data == 'ok'){
|
||||
pluginSetInitD(_name, true);
|
||||
pluginSetInitD(_name, _version, true);
|
||||
} else {
|
||||
pluginSetInitD(_name, false);
|
||||
pluginSetInitD(_name, _version, false);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
function pluginSetInitD(_name, status){
|
||||
function pluginSetInitD(_name, _version, status){
|
||||
var serviceCon ='<p class="status">当前状态:<span>'+(status ? '已加载' : '未加载' )+
|
||||
'</span><span style="color: '+
|
||||
(status?'#20a53a;':'red;')+
|
||||
' margin-left: 3px;" class="glyphicon ' + (status?'glyphicon glyphicon-play':'glyphicon-pause')+'"></span></p><div class="sfm-opt">\
|
||||
<button class="btn btn-default btn-sm" onclick="pluginOpInitD(\''+_name+'\',\''+(status?'initd_uninstall':'initd_install')+'\')">'+(status?'卸载':'加载')+'</button>\
|
||||
<button class="btn btn-default btn-sm" onclick="pluginOpInitD(\''+_name+'\',\''+_version+'\',\''+(status?'initd_uninstall':'initd_install')+'\')">'+(status?'卸载':'加载')+'</button>\
|
||||
</div>';
|
||||
$(".soft-man-con").html(serviceCon);
|
||||
}
|
||||
|
||||
function pluginOpInitD(a, b) {
|
||||
var c = "name=" + a + "&func=" + b;
|
||||
function pluginOpInitD(a, _version, b) {
|
||||
var c = "name=" + a + "&func=" + b + "&version="+_version;
|
||||
var d = "";
|
||||
switch(b) {
|
||||
case "initd_install":d = '加载';break;
|
||||
case "initd_uninstall":d = '卸载';break;
|
||||
}
|
||||
layer.confirm( msgTpl('您真的要{1}{2}服务吗?', [d,a]), {icon:3,closeBtn: 2}, function() {
|
||||
var e = layer.msg(msgTpl('正在{1}{2}服务,请稍候...',[d,a]), {icon: 16,time: 0});
|
||||
layer.confirm( msgTpl('您真的要{1}{2}{3}服务吗?', [d,a,_version]), {icon:3,closeBtn: 2}, function() {
|
||||
var e = layer.msg(msgTpl('正在{1}{2}{3}服务,请稍候...',[d,a,_version]), {icon: 16,time: 0});
|
||||
$.post("/plugins/run", c, function(g) {
|
||||
layer.close(e);
|
||||
var f = g.data == 'ok' ? msgTpl('{1}服务已{2}',[a,d]) : msgTpl('{1}服务{2}失败!',[a,d]);
|
||||
var f = g.data == 'ok' ? msgTpl('{1}{3}服务已{2}',[a,d,_version]) : msgTpl('{1}{3}服务{2}失败!',[a,d,_version]);
|
||||
layer.msg(f, {icon: g.data == 'ok' ? 1 : 2});
|
||||
|
||||
if ( b == 'initd_install' && g.data == 'ok' ) {
|
||||
pluginSetInitD(a, true);
|
||||
pluginSetInitD(a, _version, true);
|
||||
}else{
|
||||
pluginSetInitD(a, false);
|
||||
pluginSetInitD(a, _version, false);
|
||||
}
|
||||
if(g.data != 'ok') {
|
||||
layer.msg(g.data, {icon: 2,time: 0,shade: 0.3,shadeClose: true});
|
||||
|
|
|
|||
Loading…
Reference in New Issue