From 72f2bd58ce25fafd360f4871721e94919398ea65 Mon Sep 17 00:00:00 2001 From: jose <627622230@qq.com> Date: Wed, 3 Jul 2019 18:35:24 +0800 Subject: [PATCH] Adjust the directory deletion process --- class/plugin_deployment.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/class/plugin_deployment.py b/class/plugin_deployment.py index 59acbce8..54ae54a4 100644 --- a/class/plugin_deployment.py +++ b/class/plugin_deployment.py @@ -167,10 +167,11 @@ class plugin_deployment: #取本地包信息 def GetPackageOther(self,get): + p_name = get.p_name jsonFile = self.__setupPath + '/deployment_list_other.json'; if not os.path.exists(jsonFile): public.returnMsg(False,'could not find [%s]' % p_name) data = json.loads(public.readFile(jsonFile)); - p_name = get.p_name + for i in range(len(data)): if data[i]['name'] == p_name: return data[i] return public.returnMsg(False,'could not find [%s]' % p_name) @@ -276,7 +277,7 @@ class plugin_deployment: self.WriteLogs(json.dumps({'name':'Setting permissions','total':0,'used':0,'pre':0,'speed':0})); os.system('chmod -R 755 ' + path); os.system('chown -R www.www ' + path); - if pinfo['chmod'] != "": + if pinfo['chmod']: for chm in pinfo['chmod']: os.system('chmod -R ' + str(chm['mode']) + ' ' + (path + '/' + chm['path']).replace('//','/')); @@ -284,7 +285,7 @@ class plugin_deployment: self.WriteLogs(json.dumps({'name':'Install the necessary PHP extensions','total':0,'used':0,'pre':0,'speed':0})); import files mfile = files.files(); - pinfo['php_ext'] = pinfo['php_ext'].strip().split(',') + if type(pinfo['php_ext']) == str : pinfo['php_ext'] = pinfo['php_ext'].strip().split(',') for ext in pinfo['php_ext']: if ext == 'pathinfo': import config @@ -301,6 +302,7 @@ class plugin_deployment: #解禁PHP函数 if 'enable_functions' in pinfo: try: + if type(pinfo['enable_functions']) == str : pinfo['enable_functions'] = pinfo['enable_functions'].strip().split(',') php_f = public.GetConfigValue('setup_path') + '/php/' + php_version + '/etc/php.ini' php_c = public.readFile(php_f) rep = "disable_functions\s*=\s{0,1}(.*)\n" @@ -319,7 +321,7 @@ class plugin_deployment: #执行额外shell进行依赖安装 self.WriteLogs(json.dumps({'name':'Execute extra SHELL','total':0,'used':0,'pre':0,'speed':0})); if os.path.exists(path+'/install.sh'): - os.system('cd '+path+' && bash ' + 'install.sh ' + find['name']); + os.system('cd '+path+' && bash ' + 'install.sh ' + find['name'] + " &> install.log"); os.system('rm -f ' + path+'/install.sh') #是否执行Composer @@ -381,6 +383,7 @@ class plugin_deployment: #清理文件和目录 self.WriteLogs(json.dumps({'name':'清理多余的文件','total':0,'used':0,'pre':0,'speed':0})); + if type(pinfo['remove_file']) == str : pinfo['remove_file'] = pinfo['remove_file'].strip().split(',') for f_path in pinfo['remove_file']: filename = (path + '/' + f_path).replace('//','/') if os.path.exists(filename):