XF 2.0 Cascading Setup Class?

Jaxel

Well-known member
So the dev docs have a tutorial on how to create the setup class:
https://xenforo.com/xf2-docs/dev/lets-build-an-add-on/#creating-the-setup-class

However, this setup class is not cascading (every time you update the addon, it will run through the entire install process again). I use cascading setup classes in my XF1 addons... though this has led to the occasional problems, where some people would randomly not run all the steps (server timeouts?).

Is there a preferred method for creating a cascading setup class with XF2?
 
Not sure I totally follow.

The installer is now split into three distinct steps, install, upgrade and uninstall.

You can further split those steps into smaller steps, e.g. as in that example you can implement an installStep1 method, then installStep2 etc. Similar for the uninstall steps.

Upgrade steps can be defined like this upgrade<target_version_id>Step<step> e.g. your 2.0.0 Alpha update might be upgrade2000010Step1 then your 2.0.0 Beta 1 might be upgrade2000031Step1 etc.
 
Ah! Cool. So it does have cascading built in... I just need to put a target_version_id in the function name. Thanks!

Thats not explained in the dev docs.
 
Is there a reason to use installStep1 installStep2 installStep3 etc? Why not just put everything in one step?
 
It's entirely optional. If you're doing particularly large operations, then splitting it into separate steps could be useful. I tend to just find it more organised.
 
Back
Top Bottom