From 9ca8ea616b72ee09c8617fd589a9646937d47271 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 3 Jul 2026 20:11:45 -0300 Subject: [PATCH] =?UTF-8?q?v2.2.0:=20=C3=ADcone=20na=20aba=20de=20config?= =?UTF-8?q?=20e=20kill=20switch=20de=20licen=C3=A7a=20Mindplace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Aba em Configuração > Geral agora usa createTabEntry com ícone ti ti-butterfly (Tabler v3.34 do core). - Kill switch de licença nas duas camadas do padrão KB-PLUGIN-013: check_config impede ativação sem licença Mindtek válida e plugin_init aborta silenciosamente (mesmo padrão do plugin redmine). - Gotcha operacional: mudar PLUGIN_BUTTERFLY_VERSION desativa o plugin até rodar glpi:plugin:install de novo (checkPluginState). Co-Authored-By: Claude Fable 5 --- setup.php | 41 +++++++++++++++++++++++++++++++++++++++-- src/Config.php | 2 +- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/setup.php b/setup.php index f1b614b..e27ec01 100644 --- a/setup.php +++ b/setup.php @@ -1,6 +1,6 @@ isInstalled('butterfly') && $plugin->isActivated('butterfly')) { @@ -102,8 +131,16 @@ function plugin_butterfly_check_prerequisites() } } -function plugin_butterfly_check_config() +function plugin_butterfly_check_config($verbose = false) { + plugin_butterfly_load_license(); + + if (!class_exists('\GlpiPlugin\Mindplace\License') || !\GlpiPlugin\Mindplace\License::isValid()) { + if ($verbose && !isCommandLine()) { + echo "
Licença Mindtek inativa ou Mind Place ausente. O plugin foi desativado por segurança.
"; + } + return false; + } return true; } diff --git a/src/Config.php b/src/Config.php index e213032..ad68821 100644 --- a/src/Config.php +++ b/src/Config.php @@ -25,7 +25,7 @@ class Config extends \CommonDBTM { function getTabNameForItem(\CommonGLPI $item, $withtemplate = 0) { switch (get_class($item)) { case 'Config': - return [1 => t_butterfly('Butterfly')]; + return [1 => self::createTabEntry(t_butterfly('Butterfly'), 0, null, 'ti ti-butterfly')]; default: return ''; }