diff --git a/class/core/config_api.py b/class/core/config_api.py index a418db113..9ad508b4a 100755 --- a/class/core/config_api.py +++ b/class/core/config_api.py @@ -17,7 +17,8 @@ class config_api: # 本版解决自启动问题 # openresty 自启动 done - __version = '0.5.0' + # php 自动 done + __version = '0.5.2' def __init__(self): pass diff --git a/plugins/php/index.html b/plugins/php/index.html index e7aa1d6db..2243a9543 100755 --- a/plugins/php/index.html +++ b/plugins/php/index.html @@ -3,6 +3,7 @@
服务
+自启动
安装扩展
配置修改
上传限制
@@ -25,5 +26,4 @@ $.getScript( "/plugins/file?name=php&f=js/php.js", function(){ pluginService('php', $('.plugin_version').attr('version')); }); - \ No newline at end of file diff --git a/plugins/php/index.py b/plugins/php/index.py index e313f39bf..56d3d30bb 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -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': diff --git a/plugins/php/init.d/php.tpl b/plugins/php/init.d/php.tpl index 90b82b840..bbf46fddd 100644 --- a/plugins/php/init.d/php.tpl +++ b/plugins/php/init.d/php.tpl @@ -1,4 +1,6 @@ #! /bin/sh +# chkconfig: 2345 55 25 +# description: PHP Service ### BEGIN INIT INFO # Provides: php-fpm diff --git a/route/static/app/public.js b/route/static/app/public.js index 2a860c97a..3ec256472 100755 --- a/route/static/app/public.js +++ b/route/static/app/public.js @@ -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 ='当前状态:'+(status ? '已加载' : '未加载' )+ '