juhis Posted May 22, 2014 Share Posted May 22, 2014 Hi, I like to install my module like this $modules->get("MyModule"); This seems to work fine if I have clicked "check for new modules" link and the module is visible in modules admin tab. If the module is not already visible there, module does not get installed. Is there a way around this? Link to comment Share on other sites More sharing options...
juhis Posted May 22, 2014 Author Share Posted May 22, 2014 Ok, this seems to work: $modules->resetCache(); $modules->get("MyModule"); Link to comment Share on other sites More sharing options...
netcarver Posted May 22, 2014 Share Posted May 22, 2014 @J1312 Try doing this... $modules->resetCache(); $modules->get("MyModule"); ...and let me know if that fixes the issue for you. 1 Link to comment Share on other sites More sharing options...
juhis Posted May 22, 2014 Author Share Posted May 22, 2014 Yeah, this works great, thanks:) Link to comment Share on other sites More sharing options...
netcarver Posted May 22, 2014 Share Posted May 22, 2014 Slightly simpler... $modules->getInstall("Your Module"); Here's what the code comments have to say about this function... /* * Get the requested module and reset cache + install it if necessary. * ... */ 3 Link to comment Share on other sites More sharing options...
adrian Posted May 22, 2014 Share Posted May 22, 2014 I have actually always just used what Soma suggested here: https://processwire.com/talk/topic/3992-how-to-check-if-a-module-is-installed/?p=39141 $modules->get("Your Module"); and it always seems to work, but then I don't really understand the need for the getInstall() method. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now