Allow plugin autoloaders to load on restricted pages and actions (#5120)

Allow plugin autoloaders to load, even on restricted pages. This allows (enabled) plugins to load their autoloaders on any pages, allowing includes in migration files to run.

Fixes #5110.
This commit is contained in:
Ben Thomson 2020-06-10 11:46:17 +08:00 committed by GitHub
parent 48a7cc2a89
commit 8dba43ba0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -224,9 +224,9 @@ class PluginManager
}
/**
* Verify that the provided plugin should be registered
* Prevent autoloaders from loading if plugin is disabled
*/
if (!$plugin || $plugin->disabled || (self::$noInit && !$plugin->elevated)) {
if ($plugin->disabled) {
return;
}
@ -238,6 +238,13 @@ class PluginManager
ComposerManager::instance()->autoload($pluginPath . '/vendor');
}
/**
* Disable plugin registration for restricted pages, unless elevated
*/
if (self::$noInit && !$plugin->elevated) {
return;
}
/**
* Run the plugin's register() method
*/