6

I have a package (Joomla! 3x) that contains 2 plugins and it install/update and uninstall correctly. But now, I need to refine the installation/update process.

Scenario on fresh installation:

If Joomla version = X install plugin A and Plugin B

If Joomla version = Y install plugin A only

Scenario on update:

If Joomla version = X update plugin A and Plugin B

If Joomla version = Y update plugin A and UNINSTALL Plugin B, if installed

Probably need a script file, but I don't know how to force the install/uninstall of a specific plugin inside the script file. Appreciate some guidance.

2
  • Personally, I'd simply create 2 separate packages, one with the 2 plugins, and one without.
    – Lodder
    Mar 23, 2017 at 8:38
  • @Lodder Thank you. Indeed already thought about it, but, as they are for the same major version, I really need them bundled together (install 1 or 2 plugins according to minor version). I cannot have 2 separate packages :(
    – n.h.
    Mar 23, 2017 at 10:22

1 Answer 1

2

I'm not sure what the plugins for for exactly, and seeing as you can't have 2 separate packages, I'd suggest still using 1 package, install both plugins, but add a conditional statement in your plugins files, like so:

public function onYourEvent()
{
    // If Joomla version is greater than 3.5
    if (version_compare(JVERSION, '3.5', '>'))
    {
        // run your plugin code
    }
    else
    {
        // else do nothing and just return
        return;
    }
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.