• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 Possible to block legacy addon upgrades unless legacy version ID is >= X?

DragonByte Tech

Well-known member
#1
If possible, I would like to avoid having to replicate the entire upgrade process since the initial XF1 version when creating the installers for the XF2 version. Is there a way I can block upgrades if the installed XF1 version is too old?

Example: The latest XF1 version ID is 20170916. Someone has version 20170216 installed and has upgraded to XF2. Can I block the upgrade to the XF2 version with a message saying something like "Sorry, the legacy addon version is too old. Please uninstall and re-install this addon."

Thanks!


Fillip
 

Chris D

XenForo developer
Staff member
#2
You could add a checkRequirements(&$errors = [], &$warnings = []) method to your Setup class and do the checking in there.

However, the problem with your approach is, how exactly do you expect a user to recover from that if they've already upgraded to XF 2.0? You'd basically be expecting them to revert everything back to a pre 2.0 upgrade backup, then upgrade the add-on, then re-do the upgrade etc.

It's not really a good approach. You had might as well just replicate the upgrade steps (just like we've had to with XF, XF(ES|MG|RM)).
 

Kirby

Well-known member
#3
Furthermore uninstalling would mean loosing the data of your Add-on.

IMHO the correct way is to add all the necessary code to upgrade any existing version and if you continue to maintain a 1.5-branch this needs to be kept in sync.
 

DragonByte Tech

Well-known member
#4
You could add a checkRequirements(&$errors = [], &$warnings = []) method to your Setup class and do the checking in there.

However, the problem with your approach is, how exactly do you expect a user to recover from that if they've already upgraded to XF 2.0? You'd basically be expecting them to revert everything back to a pre 2.0 upgrade backup, then upgrade the add-on, then re-do the upgrade etc.

It's not really a good approach. You had might as well just replicate the upgrade steps (just like we've had to with XF, XF(ES|MG|RM)).
Fairy nuff, gonna be quite the amount of work but I'll get it done :)

Gives me an excuse to back-port the recommended version number change (recommended format with the "90" prefix you and Mike taught me) to XF 1.5 as well.


Fillip