auto-sync: 2026-06-05 11:59:23
This commit is contained in:
@@ -177,6 +177,34 @@ class ProjectRegistry:
|
||||
status="deleted",
|
||||
)
|
||||
|
||||
def physical_delete_project(self, project_id: str) -> Optional[Dict[str, Any]]:
|
||||
"""物理删除项目(删目录 + 删 registry 条目)"""
|
||||
import shutil
|
||||
|
||||
info = self.get_project(project_id)
|
||||
if not info:
|
||||
return None
|
||||
|
||||
# 1. 删除项目目录
|
||||
project_dir = self.root / project_id
|
||||
dir_existed = project_dir.exists()
|
||||
if dir_existed:
|
||||
shutil.rmtree(project_dir, ignore_errors=True)
|
||||
|
||||
# 2. 从 registry.db 删除条目
|
||||
conn = self._connect()
|
||||
try:
|
||||
conn.execute("DELETE FROM projects WHERE id=?", (project_id,))
|
||||
conn.commit()
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
return {
|
||||
"project_id": project_id,
|
||||
"directory": str(project_dir),
|
||||
"directory_existed": dir_existed,
|
||||
}
|
||||
|
||||
# ===================================================================
|
||||
# 自动发现
|
||||
# ===================================================================
|
||||
|
||||
Reference in New Issue
Block a user