ArticlevQmod (OCMod)

Sorry for my English! English is not my native language. One of the reasons to create this blog is to improve my English writing. So I will be highly obliged if you will help me with this. If you find a grammar error on this page, please select it with your mouse and press Ctrl+Enter.

"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.
After the initial class load, the mod can actually use a script to mod itself into other core files that do the actual includes for other mods. This is the first and only known method to allow the ability to test multiple mods without actually changing files.

 

That is what official vQmod page says on Githab. But there is a bad thing about vQmod. To my mind vQmod is the biggest evil for OpenCart. I can say it after more than 2 years of working with OpenCart and vQmod. I've  created several dozen modules for OpenCart and I've fixed, maybe more than hundred conflicts and more than half of these conflicts were vQmod conflicts! If you have 2 vQmod files that change the same OpenCart file in the same place.. You probably will get conflict with high probability. Because vQmod uses bad way to modify core file. Right way to do this uses for example Drupal - it has hooks system or Symfony - it has an Event system. And when 50 Drupal modules use 1 hook probability of conflict is less than 1%.  Basically because of vQmod OpenCart is very hard to use in big projects with many code modifications. 
 
The good thing is that OpenCart creators know this. That is why in the OpenCart 2.0.0.0 we can see Events as a better modification system. And I hope that once OpenCart will refuse of vQmod at all and will become a really good CMS Shop.
 

Add new comment

CAPTCHA
Spam protection
Image CAPTCHA
Enter the characters shown in the image.
You are reporting a typo in the following text:
Simply click the "Send typo report" button to complete the report. You can also include a comment.