XF 2.0 Setup.php - uninstall another plugin


Active member
Tell me if I can remove another add-on using Setup.php?
Or how to implement it?
When you install one of the add-on you want to remove the other, to resolve possible conflicts.

Chris D

XenForo developer
Staff member
The easiest way to do this is just to block install of the new add-on if the old one is still installed. That puts the onus on the end user to remove the add-on via the UI.

To do this you can add a special method to your Setup class:
class Setup extends XF\AddOn\AbstractSetup
    public function checkRequirements(&$errors = [], &$warnings = [])
        $addOn = $this->app->em()->find('XF:AddOn', 'OldAddOnId');
        if ($addOn)
            $errors[] = 'Please uninstall "Old Add-on" before continuing with the installation.';
    // other setup methods
If you absolutely must remove it problematically then you'd likely have to roll your own solution. A good example of how to approach uninstalling an add-on properly would be in XF\Cli\Command\AddOnActionTrait (the method name, in this case, would be uninstall.