My blog has moved!

You will be automatically redirected to the new address. If that does not occur, visit
http://ashokbasnet.com.np
and update your bookmarks.

Friday, January 11, 2013

Virtual File Modification System (vQmod)

Have you ever thought of modifying the core of any framework? Then vQMod is the best way to do it.

transparent-400x113"vQmod™" (aka Virtual Quick Mod) is an override system designed to avoid having to change core files. The concept is quite simple... Instead of making changes to the core files directly, the changes are created as xml search/replace script files. These script files are parsed during page load as each "source" core file is loaded with the "include" or "require" php functions. The source is then patched with the script file changes, and saved to a temp file. That temp file is then substituted for the original during execution. The original source file is never altered. This results in a "virtual" change to the core during execution without any actual modification to the core files.

Features
  • No actual code changes are made. All changes are "virtual", hence the name.
  • Modifications are stored in their own files and applied "on-the-fly" at runtime
  • Instant Single file "plug-n-play". Add the file to apply the mod, remove the file to remove the mod.
  • No worries about losing custom core changes during upgrades
  • Multiple modifications can be made to the same file without conflict
  • Easily update or enhance customizations without having to edit any code
  • Full visual of the actual changes taking place in the generated temp files for debugging
  • Fails gracefully back to the original sourcefile if there is an error
  • Exceptional logging option to track every change made
  • Only need to modify the index.php file to add the vQmod code one time.
  • Simple structured xml format. (See readme for full breakdown of xml syntax)
  • Multiple options for find/replace, regex, positions, offsets, indexing, error handling, and more!

This system can be used for any php script, forum, shopping cart, cms, etc. Anywhere custom modifications are made for reuse. The logging option is invaluable for debugging understanding exactly what is happening.

For example,

'Replace' Example

  1. Create a new text file and call it "replace-demo.xml"
  2. Add the minimum required xml structure

Input

$var = 'ABC';
Script
<?xml version="1.0" encoding="UTF-8"?>
<modification>
        <id>Replace ABC with 123</id>
        <version>1.0</version>
        <vqmver>1.0.8</vqmver>
        <author>xxx</author>
        <file name="path/to/myfile.php">
                <operation>
                        <search position="replace"><![CDATA[
                        $var = 'ABC';
                        ]]></search>
                        <add><![CDATA[
                        $var = '123';
                        ]]></add>
                </operation>
        </file>
</modification>
 
Output
$var = '123';
 
For more details : http://code.google.com/p/vqmod/
Download the library : http://code.google.com/p/vqmod/downloads/list

1 comment :