From f11fcfa4f6d80497f47459636466afe5b842c548 Mon Sep 17 00:00:00 2001 From: levinsv Date: Mon, 8 Sep 2025 11:33:26 +0500 Subject: [PATCH] Support execute plugin for not connected server. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавлена возможность запускать плагины не поключаясь к БД. Это нужно например чтобы запустить ssh клиента или сделать ssh тоннель. Поддерживаются 3 переменные $$HOSTNAME,$$USERNAME,$$PORT. Вот пример описания plugins.ini для запуска ssh клиента: ; ; Putty (Windows): ; Title=Putty Console Command="C:\Program Files\PuTTY\putty.exe" postgres@"$$HOSTNAME" Description=Open a Putty console to the current database hostname. KeyFile=C:\Program Files\PuTTY\putty.exe Platform=windows ServerType=postgresql Database=No SetPassword=No ; --- frm/plugins.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frm/plugins.cpp b/frm/plugins.cpp index 06180a0..25593d6 100644 --- a/frm/plugins.cpp +++ b/frm/plugins.cpp @@ -295,7 +295,14 @@ wxWindow *pluginUtilityFactory::StartDialog(frmMain *form, pgObject *obj) else { // Blank the rest - execCmd.Replace(wxT("$$HOSTNAME"), wxEmptyString); + if (obj && obj->GetMetaType() == PGM_SERVER) { + pgServer* srv = (pgServer*) obj; + execCmd.Replace(wxT("$$HOSTNAME"), srv->GetName()); + execCmd.Replace(wxT("$$USERNAME"), srv->GetUsername()); + execCmd.Replace(wxT("$$PORT"), NumToStr((long)srv->GetPort())); + } else + execCmd.Replace(wxT("$$HOSTNAME"), wxEmptyString); + execCmd.Replace(wxT("$$HOSTADDR"), wxEmptyString); execCmd.Replace(wxT("$$PORT"), wxEmptyString); execCmd.Replace(wxT("$$SSLMODE"), wxEmptyString);