Virtuemart Upgrade: Keeping Your Modified Files!
Written by Alex (nedge2k)   
Wednesday, 18 February 2009 23:00

So, as any good "webmaster" of a site running Virtuemart should know, the powers that be have released an update. However, moving to 1.1.3 won't be anywhere near as easy as updating/upgrading your Joomla! 1.5.x install. No, if you're running Virtuemart, the chances are you've hacked the hell out of the core files to tailor it to your needs. Did you keep a proper record of your hacks though? In my case, the answer is no. I was under the impression that the next release would be Virtuemart v2.0 and that would be a total re-write so I'd cross that bridge when I came to it. However, 1.1.3 came out about a month ago and as there don't seem to be any security patches, I'd been putting off doing the upgrade.

Anyway, I sat down today and came up with a way that should make the upgrade a bit less painful. I downloaded to 1.1.2 to 1.1.3 patch and took a look at what was being updated. Out of the 120 updated files, there were a couple I was certain I had modified and others that I had no clue about. So, what to do? Go through each file manually? Fuck that! I wrote a PHP script that downloads the original full 1.1.2 install package (for Joomla! 1.5), extracts it to a temporay location, downloads the 1.1.2 to 1.1.3 update patch (for Joomla! 1.5), extracts that to another temporary location, compares the full release to your current install and then checks the updated files to see which of the files you've modified will be effected by the update. Phew!

Once it's done, it outputs the results into a table so you can print it off and refer to it later. In my install I had modified 20 of the core Virtuemart files but only 13 were due for update :)

Now, before I let this script loose on the world...

  1. Make a backup!!! - Use something like the excellent JoomlaPack.
  2. Try it in a test environment first!! - Setting up Ubuntu server in VMware isn't difficult and a good developer should NEVER run test scripts in a production environment unless they are 100% sure of the outcome!
  3. This has only been tested with the Virtuemart 1.1.2 FULL package (for Joomla! 1.5) and the Virtuemart 1.1.2 to 1.1.3 update patch (for Joomla! 1.5).
  4. The script uses fopen and system functions which may not be enabled on your webserver.
  5. Finally, I accept no responsibility whatsoever for any damage that may be caused by this script and I also offer no support for it, so don't come to me for help unless you're carrying some cash ;) I know it sounds harsh of me but a) I don't have the time b) I don't have to release it in the first place.

...right, now the boring stuff is over...

  • Stick the script in the administrator folder so it will be reachable at http://yourdomain.tld/administrator/vm_update_checker.php
  • Paste the link to the FULL Virtuemart installation currently running on your site (e.g. Virtuemart 1.1.2)
  • Paste the link to the UPDATE patch for the Virtuemart installation currently running on your site (e.g. Virtuemart 1.1.2 to 1.1.3)
  • Hit download!

...that's it. If all has gone well, you will shortly see a table telling you which core files have been modified from standard and which of those files are due for an update. Please note: this script ONLY looks at the Virtuemart component, not and plugins or modules as, well, if you've modified them, you should have copied them and then saved them as new plugins/modules to avoid problems ;)

Right, so, to re-cap, this script downloads and extracts stuff then looks at stuff that's already there and tells you what you've messed with. As with everything, things can happen and while there's no way it could mess up your site, just be careful and back it up first in case you screw up!

Finally, whilst you may use this for commercial use and modify it to your liking if required, you can't sell it on or profit from it. If I catch you doing so, I'll coat your balls in peanut butter and point a rabid dog in your direction :)

Here's the script ->>>>>

Virtuemart Modified Files Finder

Last Updated on Thursday, 19 February 2009 00:26