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.

  • Personally, I'd simply create 2 separate packages, one with the 2 plugins, and one without. – Lodder Mar 23 '17 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 '17 at 10:22
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;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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