Sadik B
Well-known member
In XF 1.0, in my Addon's setup.php I checked for the Installed Version as follows,
After this it was a simple task of running code through a less than version check.
This worked because irrespective of whichever version the user was on, the less than comparison operator made sure, incremental setup code ran.
Now in XenForo version 2, unless I am mistaken, Setup.php is divided into installStepX and UpgradeVersionYStepX.
AM I right in thinking that installStepX ONLY runs on new installs when the addon isn't already installed on a site and UpgradeVersionYStepX, runs by checking user's installed version Y and only running larger version Y numbers?
OR is installStepX also run on upgrades when the addon exists?
Does UpgradeVersionYStepX not run if installed version number is less than Y?
Are there any recommended standards to follow for install versus upgrade?
Thanks
PHP:
$installedVersion = is_array($installedAddon) ? $installedAddon['version_id'] : 0;
After this it was a simple task of running code through a less than version check.
PHP:
if ($installedVersion < [ADDON_VERSION])
{
// RUN STEPS
}
This worked because irrespective of whichever version the user was on, the less than comparison operator made sure, incremental setup code ran.
Now in XenForo version 2, unless I am mistaken, Setup.php is divided into installStepX and UpgradeVersionYStepX.
AM I right in thinking that installStepX ONLY runs on new installs when the addon isn't already installed on a site and UpgradeVersionYStepX, runs by checking user's installed version Y and only running larger version Y numbers?
OR is installStepX also run on upgrades when the addon exists?
Does UpgradeVersionYStepX not run if installed version number is less than Y?
Are there any recommended standards to follow for install versus upgrade?
Thanks