API / Minn\Runtime / PluginRemoval

PluginRemoval final class

Minn\Runtime\PluginRemoval · public/minn/src/Minn/Runtime/PluginRemoval.php · 124 lines

Deleting plugins as the reference's delete_plugins does it: each in turn is uninstalled first when it can be (its uninstall.php, or the callback it registered), then delete_plugin, its folder (or file) removed, deleted_plugin, and its installed translations removed with it; the updates offered for the deleted ones are forgotten. A plugin already gone counts as deleted. Only what lies inside the plugins folder is ever removed, and a symlinked folder is unlinked, never followed.

Public

staticdelete(array $plugins): WP_Error|bool#

delete_plugins: true, false for none asked, or the error naming those left behind.

$pluginsarray<int, string>plugin files, relative to the plugins folder
staticuninstall(string $plugin): ?bool#

uninstall_plugin: pre_uninstall_plugin, then the plugin's uninstall.php (WP_UNINSTALL_PLUGIN naming it) or the callback it registered (heard on uninstall_<file>, with the plugin loaded); either is forgotten once run.

Internals 5

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

privatedeleteOne(string $plugin, array $translations): bool#

One plugin, uninstalled, removed and announced; whether it is gone. @param array<string, mixed> $translations

$translationsarray<string, mixed>
privateremoveFiles(string $plugin): bool#

The plugin's folder, or its file when it has none; false for anything outside the plugins folder.

privateremoveTranslations(string $slug, array $translations): void#

A folder plugin's installed translations (.po, .mo, .l10n.php, script .json), by locale. @param array<string, mixed> $translations

$translationsarray<string, mixed>
privateforget(string $file, array $registered): void#

The registered uninstall callback, dropped from the option. @param array<string, mixed> $registered

$registeredarray<string, mixed>
privateforgetUpdates(array $deleted): void#

The updates offered for plugins that are gone. @param array<int, string> $deleted

$deletedarray<int, string>