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

How would you check if an add-on is installed?

Jaxel

Well-known member
#1
Is there a preferred way to check to see if a forum has an add-on installed inside of a model?

Right now I am doing the following:
Code:
if (!XenForo_Application::autoload('EWRcarta_Model_Lists')) { return "kill"; }

The problem however is that the class "EWRcarta_Model_Lists" can exist, and yet at the same time the forum could not have EWRcarta installed; but simply have the files uploaded to the server. So there has to be a better way...
 

Jaxel

Well-known member
#2
this worked: but it adds a query
Code:
if (!$addon = $this->getModelFromCache('XenForo_Model_AddOn')->getAddOnById('EWRporta')	|| !$addon['active'])
{
	return "kill";
}