From f6f57ca4823e9186ceb076aa32d636e56b62fd93 Mon Sep 17 00:00:00 2001 From: RomainLvr Date: Wed, 5 Nov 2025 16:22:22 +0100 Subject: [PATCH 1/5] Fix (Uninstall) - Restore mini-dashboard delete function --- src/Install.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Install.php b/src/Install.php index a3b8e478f..f78e27414 100644 --- a/src/Install.php +++ b/src/Install.php @@ -491,6 +491,25 @@ protected function deleteTables() { $displayPreference->deleteByCriteria(['itemtype' => 'PluginFormcreatorIssue']); } + protected function deleteMiniDashboard(): bool { + $dashboard = new Dashboard(); + + if ($dashboard->getFromDB('plugin_formcreator_issue_counters') === false) { + // The dashboard does not exists, nothing to delete + return true; + } + + $dashboard->delete([ + 'key' => 'plugin_formcreator_issue_counters' + ]); + if ($dashboard->getFromDB('plugin_formcreator_issue_counters') !== false) { + // Failed to delete the dashboard + return false; + } + + return true; + } + /** * http://stackoverflow.com/questions/834303/startswith-and-endswith-functions-in-php * @param string $haystack @@ -508,6 +527,7 @@ public function uninstall() { $this->deleteTicketRelation(); $this->deleteTables(); $this->deleteNotifications(); + $this->deleteMiniDashboard(); $config = new Config(); $config->deleteByCriteria(['context' => 'formcreator']); From 2d04acd2206edb0505e6726cfdca18686d32cedf Mon Sep 17 00:00:00 2001 From: RomainLvr Date: Wed, 5 Nov 2025 16:47:07 +0100 Subject: [PATCH 2/5] Fix phpstan --- src/Install.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Install.php b/src/Install.php index f78e27414..640de46a2 100644 --- a/src/Install.php +++ b/src/Install.php @@ -494,7 +494,7 @@ protected function deleteTables() { protected function deleteMiniDashboard(): bool { $dashboard = new Dashboard(); - if ($dashboard->getFromDB('plugin_formcreator_issue_counters') === false) { + if (!$dashboard->getFromDB('plugin_formcreator_issue_counters')) { // The dashboard does not exists, nothing to delete return true; } @@ -502,12 +502,8 @@ protected function deleteMiniDashboard(): bool { $dashboard->delete([ 'key' => 'plugin_formcreator_issue_counters' ]); - if ($dashboard->getFromDB('plugin_formcreator_issue_counters') !== false) { - // Failed to delete the dashboard - return false; - } - return true; + return !$dashboard->getFromDB('plugin_formcreator_issue_counters'); } /** From 4465f41a566e4f65b26bcfccf5683fe06182c10c Mon Sep 17 00:00:00 2001 From: RomainLvr Date: Wed, 5 Nov 2025 17:06:27 +0100 Subject: [PATCH 3/5] Fix phpstan --- src/Install.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Install.php b/src/Install.php index 640de46a2..8c79aa215 100644 --- a/src/Install.php +++ b/src/Install.php @@ -494,16 +494,22 @@ protected function deleteTables() { protected function deleteMiniDashboard(): bool { $dashboard = new Dashboard(); + $res = true; + if (!$dashboard->getFromDB('plugin_formcreator_issue_counters')) { // The dashboard does not exists, nothing to delete - return true; + $res = true; } $dashboard->delete([ 'key' => 'plugin_formcreator_issue_counters' ]); + if ($dashboard->getFromDB('plugin_formcreator_issue_counters')) { + // Failed to delete the dashboard + $res = false; + } - return !$dashboard->getFromDB('plugin_formcreator_issue_counters'); + return $res; } /** From 48c418ad9b45fb5d1748baa60e4d97f3d45e8392 Mon Sep 17 00:00:00 2001 From: Romain Lecouvreur <102067890+RomainLvr@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:23:34 +0100 Subject: [PATCH 4/5] Update src/Install.php Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com> --- src/Install.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/Install.php b/src/Install.php index 8c79aa215..58f918829 100644 --- a/src/Install.php +++ b/src/Install.php @@ -494,22 +494,9 @@ protected function deleteTables() { protected function deleteMiniDashboard(): bool { $dashboard = new Dashboard(); - $res = true; - - if (!$dashboard->getFromDB('plugin_formcreator_issue_counters')) { - // The dashboard does not exists, nothing to delete - $res = true; - } - - $dashboard->delete([ + return $dashboard->deleteByCriteria([ 'key' => 'plugin_formcreator_issue_counters' ]); - if ($dashboard->getFromDB('plugin_formcreator_issue_counters')) { - // Failed to delete the dashboard - $res = false; - } - - return $res; } /** From 88616155d6250158e47ef5e90ab453c7d9f3aa82 Mon Sep 17 00:00:00 2001 From: RomainLvr Date: Thu, 6 Nov 2025 10:14:48 +0100 Subject: [PATCH 5/5] Delete phpunit.xml to avoid CI errors --- phpunit.xml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 phpunit.xml diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 44332c9cf..000000000 --- a/phpunit.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - tests/units - - - \ No newline at end of file