From e0859dfc21956d4aa36c954158e40c1c751badf2 Mon Sep 17 00:00:00 2001 From: Beu Date: Mon, 14 Aug 2023 22:32:48 +0200 Subject: [PATCH] add a setting to disable update check when opening plugin menu --- core/Plugins/PluginMenu.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/Plugins/PluginMenu.php b/core/Plugins/PluginMenu.php index b9bc270c..81358f30 100644 --- a/core/Plugins/PluginMenu.php +++ b/core/Plugins/PluginMenu.php @@ -48,6 +48,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns const ACTION_PREFIX_UPDATEPLUGIN = 'PluginMenu.Update.'; const ACTION_UPDATEPLUGINS = 'PluginMenu.Update.All'; const SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS = 'Change Plugin Settings'; + const SETTING_CHECK_UPDATE_WHEN_OPENING = 'Check update when opening the menu'; const CACHE_SETTING_CLASS = 'PluginMenuCache.SettingClass'; /* @@ -64,6 +65,9 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns public function __construct(ManiaControl $maniaControl) { $this->maniaControl = $maniaControl; + // Settings + $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_CHECK_UPDATE_WHEN_OPENING, true); + // Callbacks $this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); $this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_BACK_TO_PLUGINS, $this, 'backToPlugins'); @@ -145,7 +149,10 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns // Display normal Plugin List // Plugin pages $posY = 0.; - $pluginUpdates = $this->maniaControl->getUpdateManager()->getPluginUpdateManager()->getPluginsUpdates(); + + if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CHECK_UPDATE_WHEN_OPENING)) { + $pluginUpdates = $this->maniaControl->getUpdateManager()->getPluginUpdateManager()->getPluginsUpdates(); + } usort($pluginClasses, function ($pluginClassA, $pluginClassB) { /** @var Plugin $pluginClassA */