Addon Prerequisites?

Jaxel

Well-known member
I am making a "Base Framework" addon for all my mods. If you want to install any of my mods, you will be required to have this addon installed.

How would I set up an addon so that it checks to see if addon_id "EWRbase", version_id "1" is installed?
 
I am making a "Base Framework" addon for all my mods. If you want to install any of my mods, you will be required to have this addon installed.

How would I set up an addon so that it checks to see if addon_id "EWRbase", version_id "1" is installed?
It's not from the core of Zend/XF but couldn't you check to see if the class exists that is from your addon? before it tries to execute anything.
 
1. way => check in the installer, if a class of your framework exists & is loadable
2. way (cleaner)
PHP:
$addOnModel = XenForo_Model::create('XenForo_Model_AddOn');
 
$fwVersion = $addOnModel->getAddOnVersion('yourframework');

        if (!$fwVersion) {
            self::printFwRequired();
        }
        else {
            if ($fwVersion['version_id'] < self::FW_REQUIRED_VERSION) {
                throw new XenForo_Exception('new framework version > ' . self::FW_REQUIRED_VERSION . ' required', true);
            }
        }
 
Top Bottom