We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Is there some kind of function for checking installed modules?

Development and Programming

notacouch's avatar
notacouch
92 posts
13 years ago
notacouch's avatar notacouch

or is it all kept in memory somewhere, or do we just check the DB on our own every time?

just wondering if there’s a convenience method for this already, e.g. if your add-on is dependent on another one not just being present but actually installed.

thanks.

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
13 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

You could use something like this:

if (array_key_exists('addon_package_name', $this->EE->addons->get_installed()))
{
     ...
}
else
{
     ...
}
       
notacouch's avatar
notacouch
92 posts
13 years ago
notacouch's avatar notacouch

Nice. Perfect. Thank you, Erik!

didn’t even know there was an addon class/library.

I looked up the source.

function get_installed($type = 'modules')

Uses a static array for modules (which is the default so I don’t need to send the first argument, which for record’s sake can also be either accessories, extensions, fieldtypes, or rte_tools). Do you know if EE already runs this? That way it’s not an additional call to the database even though I guess that’s negligible. Kinda looks like it does… somewhere. Just curious.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.