v2.6.6 (Lyra): Essential plugins altijd laden (forceer in core)

Bug: beschermde/essentiële plugins (Dashboard, Navigation) konden niet
meer geactiveerd worden als ze uit enabled_plugins raakten. Core forceert
nu laden van essential plugins (plugin.json essential: true); admin-UI
toont ze altijd als Actief; toggle-handler staat aanzetten wél toe,
uitzetten blijft geblokkeerd; isProtectedPlugin() dekt nu ook essential.
This commit is contained in:
2026-08-27 19:43:42 +00:00
parent 0e345c96d7
commit f7e8837a1c
7 changed files with 166 additions and 22 deletions
+34 -5
View File
@@ -122,11 +122,34 @@ class PluginManager
}
}
/**
* Controleer of een plugin als 'essential' is gemarkeerd in zijn plugin.json.
*
* Essential plugins worden altijd geladen, ongeacht de enabled_plugins-lijst,
* en kunnen niet worden uitgeschakeld, bewerkt of verwijderd via de admin.
*
* @since 2.6.6
*
* @param string $pluginName Plugin-naam (directorynaam).
* @return bool True indien de plugin in plugin.json essential: true heeft.
*/
public function isEssentialPlugin(string $pluginName): bool
{
$pluginJsonFile = $this->pluginsPath . '/' . $pluginName . '/plugin.json';
if (!file_exists($pluginJsonFile)) {
return false;
}
$pluginJson = json_decode(file_get_contents($pluginJsonFile), true);
return is_array($pluginJson) && ($pluginJson['essential'] ?? false) === true;
}
/**
* Laad alle ingeschakelde plugins uit de pluginsdirectory.
*
* Per plugin wordt het hoofdbestand (<naam>.php) geïncludeerd, de plugin-class
* geïnstantieerd, en action- en filter-hooks automatisch geregistreerd.
* Essential plugins (plugin.json `essential: true`) worden altijd geladen,
* ook als ze niet in enabled_plugins staan. Per plugin wordt het hoofdbestand
* (<naam>.php) geïncludeerd, de plugin-class geïnstantieerd, en action- en
* filter-hooks automatisch geregistreerd.
*
* @since 2.6.5
*
@@ -139,13 +162,19 @@ class PluginManager
}
$pluginDirs = glob($this->pluginsPath . '/*', GLOB_ONLYDIR);
foreach ($pluginDirs as $pluginDir) {
$pluginName = basename($pluginDir);
if (!in_array($pluginName, $this->enabledPlugins, true)) {
// Essential plugins are always loaded, regardless of enabled_plugins.
$isEnabled = in_array($pluginName, $this->enabledPlugins, true);
if (!$isEnabled && !$this->isEssentialPlugin($pluginName)) {
continue;
}
// Keep the effective enabled list consistent for getEnabledPlugins()/isEnabled().
if (!$isEnabled) {
$this->enabledPlugins[] = $pluginName;
}
$pluginFile = $pluginDir . '/' . $pluginName . '.php';