Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force plugin uninstallation #7907

Merged
merged 3 commits into from May 10, 2021
Merged

Conversation

brandonkelly
Copy link
Member

@brandonkelly brandonkelly commented May 10, 2021

This PR adds a $force arg to craft\services\Plugins::uninstallPlugin(), which forces the plugin to be removed from the plugins table and project config, even if:

  • it’s disabled
  • it’s enabled but its uninstall() method returns false
  • its files aren’t present (Composer-uninstalled already)

The plugin/uninstall console command also now has a --force flag, which will pass true to $force.

> php craft plugin/uninstall smart-map
*** uninstalling smart-map
*** failed to uninstall smart-map: Uninstalling disabled plugins is not allowed.
Try again with --force.

> php craft plugin/uninstall smart-map --force
*** uninstalling smart-map
*** uninstalled smart-map successfully (time: 0.215s)

To avoid unexpected PHP errors, if plugin uninstallation is forced for a disabled plugin, its uninstall() method will not be called.

@brandonkelly brandonkelly merged commit d65c860 into 3.6.14 May 10, 2021
@brandonkelly brandonkelly deleted the feature/force-plugin-uninstallation branch May 10, 2021 17:48
@brandonkelly brandonkelly mentioned this pull request May 10, 2021
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant