2
votes

I am writing VQMod XML to edit config.php in opencart, i wrote below XML and saved it inside XML folder.

<modification>
<id>VQMOD CORE FOR OPENCART - DO NOT REMOVE</id>
<version>1.4.x and 1.5.x</version>
<vqmver>2.2.1</vqmver>
<author>Senthil</author>
<file name="./config.php">
    <operation>
         <search position="after"><![CDATA[
                    define('DB_PREFIX', 'op');
                    ]]></search>
         <add><![CDATA[
                    define('HTTP_IMAGE_2', 'http://localhost/opcart/image/');
                    define('HTTPS_IMAGE_2', 'http://localhost/opcart/image/');
                    define('DIR_IMAGE_2', '/Users/[username]/Sites/opcart/image/');
                    ]]></add>
    </operation>
</file>

But its not creating new cache file in vqcache folder as its doing for other files. No errors in log file. I have write permission to the vqcache folder and config file. Any help will be useful.

2

2 Answers

3
votes

vQmod's do not work on those files. It works basically on all php/tpl files above the index.php folder (ie 1 or more files deeper)

0
votes

Yes this is possible. You can use VQMod everywhere that a file is accessed, as long as there is a logical chain of "touch" to that file and no rogue requires. In this case, this is semi-untested beyond a dev instance, and there are "security" risks involved with making configs moddable.

To do it, you just need to edit index.php (and admin/index.php). Move the following to the top of of the index.php's (under define VERSION) so that it comes before the check for config.php's:

// VirtualQMOD
require_once('./vqmod/vqmod.php');
VQMod::bootup();

Then change the way OC is pulling config.php:

require_once('config.php');

By adding in the check for mods:

require_once(VQMod::modCheck('config.php'));

Access your catalog/admin so VQ can build, then check /vqmod/vqcache for file:

vq2-config.php

If it's there, and your changes are in, success.

PS: You can just use <file name="config.php"> in your XML file, no need for the relative ./.