How to check if vqmod is installed?

I wrote a module that uses vqmod for opencart. How to check if vqmod is installed from the admin module?

I would like to display a warning inside a module that checks if vqmod is installed? Even better would be to check if it also has the correct write permission to create cached files and write to vamod.log

What is the best way to do this?

PS: it would be great if you could tag questions with vqmod. I do not have enough reputation to create a new tag.

+6
source share
4 answers
<?php if(class_exists('VQMod')) { // vqmod exists } ?> 
+2
source
 /vqmod/install 

if it is installed, it will tell you that "vqmod is already installed"

+6
source

To check the code you will need to do

 global $vqmod; if(!empty($vqmod) && is_a($vqmod, 'VQMod')) { // INSTALLED } else { // } 

While @NADH is along the correct lines, it only checks the vqmod class, not that it was set to the $vqmod variable

Edit

Starting with version 2.4.0, this will no longer work, and it is recommended to use the NADH method

+2
source

Based on your @John comments, since you are looking for confirmation that VQmod is installed and also running correctly, the safest way to do this is to check the name of the file that you expect to see in the vqmod / cache directory. You will recognize the file name if you yourself created the vqmod / xml definition file.

You can also check if a VQMod class like @NADH exists, but that doesn’t mean that it works correctly. A bit like unit device tests, always asserting on the desired output. In this case, it is the "cache file you are creating.

+1
source

Source: https://habr.com/ru/post/914727/


All Articles