API / Minn\Runtime / PluginActivation

PluginActivation final class

Minn\Runtime\PluginActivation · public/minn/src/Minn/Runtime/PluginActivation.php · 70 lines

Switching a plugin on and off the way the reference's activate_plugin and deactivate_plugins do (probe plugin-activation), for the facade and for the engine's own REST routes and WP-CLI verbs alike. Activating checks the plugin's requirements, then loads its main file through the runtime's gate (so its activation hook is registered, silent or not), fires activate_plugin and activate_<file> (which runs that hook), writes active_plugins sorted through update_option, and fires activated_plugin; whatever the plugin printed meanwhile makes the answer unexpected_output, with the plugin left active, as the reference leaves it. Silent skips the actions, not the load. A plugin the gate will not load (it needs functions or classes the runtime lacks) is refused rather than recorded active with code that could never run its activation hook. Deactivating fires deactivate_plugin, deactivate_<file> and deactivated_plugin for each plugin, then writes the list once.

Public

staticactivate(string $plugin, ?Minn\Runtime\Hooks $announce, ?Closure $networkStore = NULL): ?Minn\Runtime\Refusal#

Activates one plugin ("dir/file.php"), announcing it to the hooks given, or to nobody (silent); null when it is active afterwards with nothing to report.

staticdeactivate(array $plugins, ?Minn\Runtime\Hooks $announce): void#

Deactivates plugins ("dir/file.php" each), announcing each to the hooks given, or to nobody (silent); those not active are passed over.

$pluginslist<string>

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateactive(): array#
@return list<string>