MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / remove_project

Method remove_project

class/projectModel/nodejsModel.py:727–758  ·  view source on GitHub ↗

@name 删除指定项目 @author hwliang<2021-08-09> @param get { project_name: string<项目名称> } @return dict

(self,get)

Source from the content-addressed store, hash-verified

725
726
727 def remove_project(self,get):
728 ''&#x27;
729 @name 删除指定项目
730 @author hwliang<2021-08-09>
731 @param get<dict_obj>{
732 project_name: string<项目名称>
733 }
734 @return dict
735 ''&#x27;
736 project_find = self.get_project_find(get.project_name)
737 if not project_find:
738 return public.return_error('指定项目不存在: {}'.format(get.project_name))
739
740 self.stop_project(get)
741 self.clear_config(get.project_name)
742 public.M('domain').where('pid=?',(project_find['id'],)).delete()
743 public.M('sites').where('name=?',(get.project_name,)).delete()
744
745 pid_file = "{}/{}.pid".format(self._node_pid_path,get.project_name)
746 if os.path.exists(pid_file): os.remove(pid_file)
747 script_file = '{}/{}.sh'.format(self._node_run_scripts,get.project_name)
748 if os.path.exists(script_file): os.remove(script_file)
749 if "log_path" not in project_find['project_config']:
750 log_file = "{}/{}.log".format(self._node_logs, project_find["name"])
751 else:
752 log_file = "{}/{}.log".format(project_find['project_config']["log_path"], project_find["name"])
753 if os.path.exists(log_file): os.remove(log_file)
754 self.del_crontab(get.project_name.strip())
755 from mod.base.web_conf import remove_sites_service_config
756 remove_sites_service_config(get.project_name, "node_")
757 public.WriteLog(self._log_name,'删除Node.js项目{}'.format(get.project_name))
758 return public.return_data(True,'删除项目成功')
759
760
761 def project_get_domain(self,get):

Callers

nothing calls this directly

Calls 12

get_project_findMethod · 0.95
stop_projectMethod · 0.95
clear_configMethod · 0.95
del_crontabMethod · 0.95
formatMethod · 0.45
deleteMethod · 0.45
whereMethod · 0.45
MMethod · 0.45
existsMethod · 0.45
removeMethod · 0.45
return_dataMethod · 0.45

Tested by

no test coverage detected