/** * Tries to uninstall a plugin. * * @param string $plugin_name Name of the plugin to uninstall. * @return boolean Indicates if the plugin has been uninstalled or not. */ public function uninstall($plugin_name) { $plugin = new PluginInfo($plugin_name); if (!$plugin->isInstalled()) { // The plugin was not installed return true; } if (!$plugin->canBeUninstalled()) { // The plugin cannot be uninstalled. return false; } // Try to uninstall the plugin. $plugin_class = $plugin->getClass(); if (!$plugin_class::uninstall()) { // Something went wrong. The plugin cannot be uninstalled. return false; } // The plugin state is not needed anymore. $plugin->clearState(); return true; }