How to check that a module is installed?

How to check that a module is installed?

deur Nate Baxley -
Getal antwoorde: 6
Is there a programmatic way to check if a particular module is installed? I am creating an admin report to pull out some summary data and I need to check to see if the Questionnaire module is installed before I try to report on it. Ideally I could just check to see if the tables are installed, but I'm not sure how to do that in a DB agnostic way (I at least need to be able to support PostGRE and MySQL). Any ideas?

Thanks,
Nate Baxley
Gemiddeld van beoordelings: -
In antwoord op Nate Baxley

Re: How to check that a module is installed?

deur Mary Cooch -
Prentjie van Documentation writers Prentjie van Moodle HQ Prentjie van Particularly helpful Moodlers Prentjie van Testers Prentjie van Translators
Isn't it quickest just to go to the moodle and see if it is is one of the options?
Gemiddeld van beoordelings: -
In antwoord op Mary Cooch

Re: How to check that a module is installed?

deur Nate Baxley -
I should have mentioned that I want to do this programmatically. The report will gather stats for all of the modules on our list that are installed. I updated my original post. Thanks!
Gemiddeld van beoordelings: -
In antwoord op Nate Baxley

Re: How to check that a module is installed?

deur Robert Brenstein -
I would look at the code which displays the table of modules in the admin panel for activities. The code there knows how to find which modules are installed and which are active. Why reinvent the wheel?
Gemiddeld van beoordelings: -
In antwoord op Nate Baxley

Re: How to check that a module is installed?

deur Nate Baxley -
I just realized that I posted this to the wrong forum. I've reposted it here in the developer's general forum. Sorry for the confusion.
Gemiddeld van beoordelings: -
In antwoord op Nate Baxley

Re: How to check that a module is installed?

deur Jessica Gramp -
Prentjie van Moodle HQ Prentjie van Plugin developers

Hi Nate,

I'm trying to do this as well, but I can't find your post within the developers general forum. 

Could you post a link to it please?

Thank you.

Gemiddeld van beoordelings: -
In antwoord op Jessica Gramp

Re: How to check that a module is installed?

deur Jessica Gramp -
Prentjie van Moodle HQ Prentjie van Plugin developers
Nevermind, I realised your 'here' was a link - there was nothing to suggest this before I put my mouse over it so it wasn't initially clear.


BTW. In case anyone else is looking for this in Moodle 2.6.6 the code is now as follows:

core_plugin_manager::instance()->get_plugins_of_type('mod')
Gemiddeld van beoordelings:Useful (4)