Reputation: 16793
I have written a module that uses vqmod for opencart. How can I check if vqmod is installed from within the admin module?
I would like to display a warning inside of the module that checks if vqmod is installed? Even better would be to check if it also has correct write permission to generate cached files and write to the vamod.log
What is the best way of doing this?
PS: it would be cool if you could tag questions with vqmod. I dont have enough reputation to create a new tag.
Upvotes: 7
Views: 10542
Reputation: 15151
To check via code, you would need to do
global $vqmod;
if(!empty($vqmod) && is_a($vqmod, 'VQMod')) {
// INSTALLED
} else {
//
}
While @NADH's is along the right lines, it only checks that vqmod's class has been included, not that it's been set to the $vqmod
variable
As of 2.4.0, this will no longer work, and it's recommended to use NADH's method
Upvotes: 2
Reputation: 61
/vqmod/install
if it is installed it will tell you "vqmod is already installed"
Upvotes: 6
Reputation: 15879
Based on your comments @John, since you're looking for confirmation that VQmod is installed and also executing correctly, the safest thing to do to is check for the filename you are expecting to appear in the vqmod/cache directory. You'll know the filename if you have created the vqmod/xml definition file yourself.
You could also check for the VQMod class existing like @NADH suggested, but it doesn't mean that its working correctly. A bit like writing unit tests, always assert on the desired output. In this case its' the cache file you are creating.
Upvotes: 1