Overview
Comment: | Clear menu session cache when upgrading plugins |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA3-256: |
60462ae13c7267ce196fea77095c68e0 |
User & Date: | bohwaz on 2022-12-11 23:59:20 |
Other Links: | branch diff | manifest | tags |
Context
2022-12-12
| ||
01:55 | Add unregisterSignal and getPublicURL methods to Plugin check-in: bb9a60f0c5 user: bohwaz tags: dev | |
2022-12-11
| ||
23:59 | Clear menu session cache when upgrading plugins check-in: 60462ae13c user: bohwaz tags: dev | |
23:58 | Better styling for home buttons check-in: aadcb88f7b user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Plugin.php from [e16fae8154] to [d3a7926d48].
︙ | ︙ | |||
375 376 377 378 379 380 381 | { throw new \LogicException('Le callback donné n\'est pas valide.'); } // pour empêcher d'appeler des méthodes de Garradin après un import de base de données "hackée" if (strpos($callable_name, 'Garradin\\Plugin\\') !== 0) { | | | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | { throw new \LogicException('Le callback donné n\'est pas valide.'); } // pour empêcher d'appeler des méthodes de Garradin après un import de base de données "hackée" if (strpos($callable_name, 'Garradin\\Plugin\\') !== 0) { throw new \LogicException('Le callback donné n\'utilise pas le namespace Garradin\\Plugin : ' . $callable_name); } $db = DB::getInstance(); // Signaux exclusifs, qui ne peuvent être attribués qu'à un seul plugin if (strpos($signal, 'boucle.') === 0) { |
︙ | ︙ | |||
421 422 423 424 425 426 427 | return $plugins; } /** * Checks if a plugin requires an upgrade and upgrade it * This is run after an upgrade, a database restoration, or in the Plugins page */ | | > > > > > | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | return $plugins; } /** * Checks if a plugin requires an upgrade and upgrade it * This is run after an upgrade, a database restoration, or in the Plugins page */ static public function upgradeAllIfRequired(): bool { $i = 0; // Mettre à jour les plugins si nécessaire foreach (self::listInstalled() as $id => $infos) { // Ne pas tenir compte des plugins dont le code n'est pas dispo if ($infos->disabled) { continue; } $plugin = new Plugin($id); if ($plugin->needUpgrade()) { $plugin->upgrade(); $i++; } unset($plugin); } return $i > 0; } /** * Liste les plugins qui doivent être affichés dans le menu * @return array Tableau associatif id => nom (ou un tableau vide si aucun plugin ne doit être affiché) */ static public function listMenu(Session $session) |
︙ | ︙ |
Modified src/www/admin/config/plugins.php from [17a06e1803] to [30e38b80b8].
︙ | ︙ | |||
31 32 33 34 35 36 37 | } $tpl->assign('garradin_website', WEBSITE); $tpl->assign(compact('csrf_key')); $tpl->display('config/plugins.tpl'); | | > > | 31 32 33 34 35 36 37 38 39 40 | } $tpl->assign('garradin_website', WEBSITE); $tpl->assign(compact('csrf_key')); $tpl->display('config/plugins.tpl'); if (Plugin::upgradeAllIfRequired()) { $session->set('plugins_menu', null); } |