From ca566576ed677a39f3baa32bcc5a0de9dce2da85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Mon, 30 Mar 2026 08:25:11 +0300 Subject: [PATCH] feat: implement IPC handlers for service lifecycle management including Nginx, PHP, and MySQL orchestration --- src/main/ipc/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/ipc/index.ts b/src/main/ipc/index.ts index 9d99df1..6ad77c4 100644 --- a/src/main/ipc/index.ts +++ b/src/main/ipc/index.ts @@ -426,6 +426,16 @@ export function registerIpcHandlers(): void { return result }) ipcMain.handle('projects:update', async (_event, project) => { + // Clean up old config file if host changed + const projects = projectService.getProjects() + const oldProject = projects.find(p => p.id === project.id) + if (oldProject && oldProject.host !== project.host) { + const oldConfigPath = path.join(configService.getBasePath(), 'generated_configs', 'projects', `${oldProject.host}.conf`) + if (fs.existsSync(oldConfigPath)) { + try { fs.unlinkSync(oldConfigPath) } catch (e) { console.error('Error deleting old config:', e) } + } + } + const result = projectService.updateProject(project) // Trigger Nginx restart await restartNginx()