### Author Topic: Update for hacks by Deneb?  (Read 9758 times)

#### Bruce Morgan

• Full Member
• Posts: 672
##### Update for hacks by Deneb?
« on: March 15, 2006, 00:16:41 am »
I installed most of the greats hacks offered by Deneb over the past few months and found that most of them went away after the update from 1.0.2 to 1.0.3.   Some were no brainers to re-install but I was a little hesitant to do a lot of cut and paste on some of the php files.  Deneb, could you issue some updated hacks compatible with 1.0.3 for the following:

1.  Username and full name on order list?
2.  # of orders on user list?

Perhaps more importantly, I would like to see these excellent additions become part of the standard offering.  Anyone agree with me on this?

Bruce
www.pepper-passion.com

#### dman776

• Beginner
• Posts: 10
##### Re: Update for hacks by Deneb?
« Reply #1 on: March 17, 2006, 20:52:25 pm »
I'll second that motion!

#### deneb

• Full Member
• Posts: 654
##### Re: Update for hacks by Deneb?
« Reply #2 on: March 22, 2006, 17:35:31 pm »
PayPal donations accepted at: sales@denebsys.net

#### Bruce Morgan

• Full Member
• Posts: 672
##### Re: Update for hacks by Deneb?
« Reply #3 on: March 27, 2006, 00:09:34 am »
Deneb, I tried doing this myself using the cut and past method and managed to update the two hacks referenced above and they seem to work fine.  Would you mind if I uploaded the updated files and shared them with the group?

Bruce

#### simbo1905

• Guest
##### Re: Update for hacks by Deneb?
« Reply #4 on: March 27, 2006, 03:26:09 am »
diff and patch might help. if you dont want to loose patches during an update then you can have diff extract your patches and the reapply them after the upgrade. this post explains how to create a patch and how to apply it to source code:

http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=16717.msg36642#msg36642

you can get diff to extract a patch file for a whole folder or whole set of folders. lets say you are on version 1.0.3 with some custom hacks but you want to upgrade to version 1.0.4 and then automatically re-apply your custom hacks. unzip the 1.0.3 ecommerce edition into a temporary folder, rename the com_virtuemart folder from the zip to be com_virtuemart103 and put it next to your com_virtuemart folder on your site so that you have two folders in the same directly such as:

com_virtuemart
com_virtuemart103

then in the folder above them both run

diff -NaurbB com_virtuemart103 com_virtuemart > my.patches.diff

this will create a file my.patches.diff which has all the change to your folder went compared to the original folder.

then apply the upgrade to 104 which will overwrite your changes. to put your change back in the folder above com_virtuemart run:

patch < my.patches.diff

which will try to put back all your hacks. patch is smart and will search for the appropriate lines to change even if they have moved down or up in the newer file. if a hack of yours is on a line that has been changes between 103 and 104 patch will warn you and push out a rejected file saying where it had the problems. you can inspect this and work it out manually. even if you get lots of rejects at least it will jog your memory about what you had changed.

clearly there are two components and lots of modules and mambots in different folders that you may have hacked. if you had started with the 103 joomla ecommerce could try running diff at the top of the site against the whole of the joomla ecommerce edition folder to create a massive patch of every change if you are feeling gung-ho.

#### weatherangel

• Beginner
• Posts: 36
• Just another geek doing the greater good...
##### Re: Update for hacks by Deneb?
« Reply #5 on: April 05, 2006, 07:24:01 am »
which will try to put back all your hacks. patch is smart and will search for the appropriate lines to change even if they have moved down or up in the newer file. if a hack of yours is on a line that has been changes between 103 and 104 patch will warn you and push out a rejected file saying where it had the problems. you can inspect this and work it out manually. even if you get lots of rejects at least it will jog your memory about what you had changed.

Thank you for sharing that information!  I've seen them used by others, but didn't know how to go about creating a patch and never really took the time to look it up.  I'm glad you explained it... Should make my life LOTS easier next time around! -- last time I just hoped that most of the patches were fixed since they were bug fixes anyway...

#### simbo1905

• Guest
##### Re: Update for hacks by Deneb?
« Reply #6 on: April 06, 2006, 09:51:12 am »
it is a good idea to always create a backup any flies that you change e.g. if you are going to edit file x.php then create a copy x.php.original - this makes it easier to find what you have changed and to create a patch of it with
diff -NaurbB x.php.orignal x.php > x.patch
just before you upgrade so that you can
patch < x.patch

if you stick to this then to find all you changed files run (windows)
dir /b /s *.php.original
(unix)
find . -name \*.php.original

#### deneb

• Full Member
• Posts: 654
##### Re: Update for hacks by Deneb?
« Reply #7 on: April 06, 2006, 23:25:22 pm »
hey simbo,

how does one call DIFF and PATCH from a php script? Or for that matter any other unix command?

you know... for those lamos that do not have unix shell access?

how 'bout getting together to make a php diff/patch component for J! to log and manage all the hacks on a J! site? That way an admin can diff and patch from within Mambo/J!

#### simbo1905

• Guest
##### Re: Update for hacks by Deneb?
« Reply #8 on: April 07, 2006, 09:13:58 am »

are you on windows? you can get the tools windows at unxutils.sourceforge.net in their zip file so if you download your site to your workstation you can diff and patch your files locally. put them directly into your \windows\system32 without the folder structure in the zip (just the files) saying no to any overwrites. then open a command prompt with Start > Run... > cmd.exe and change director into a folder with your mambo files with

c:
cd \path\to\your\files

where c: is the drive where they are at (e.g. d:/e:/f:). then run the commands. there are loads of other tools in that zip. one of them sh.exe turns your cmd.exe into a unix shell to run proper shell scripts.

even without running sh.exe in cmd.exe windows actually has some sophisticated commands built into cmd.exe. search for 'command reference'.

#### deneb

• Full Member
• Posts: 654
##### Re: Update for hacks by Deneb?
« Reply #9 on: April 07, 2006, 20:26:08 pm »
Help Needed: Better Handling of Failed / Declined Authorize.net Transactions

Quote
diff and patch are standard on unix (linux, solaris, freebsd, et al)

i want to access these unix commands through PHP script on a unix server. Not ***dows.

Any tips?

#### simbo1905

• Guest
##### Re: Update for hacks by Deneb?
« Reply #10 on: April 08, 2006, 10:29:17 am »

http://uk2.php.net/manual/en/language.operators.execution.php

<?php
$output = diff -NaurbB test.html test2.html; echo "<pre>$output</pre>";
?>

i just tried it out on my server and it worked a treat.

there are also some others ways such as http://uk2.php.net/exec but "backtick quotes" (top left key on a uk/us keyboard) meaning "run some command and take the output and write it here" is common to both php and shell scripts such as borne and bash. so it looks natural if you bash

i think that some host providers might turn off this feature. certainly it would be very dangerous for them to let php scripts run commands that execute as root as that would be massive security risk.

#### macallf

• Full Member
• Posts: 2411
##### Re: Update for hacks by Deneb?
« Reply #11 on: April 08, 2006, 10:42:33 am »
Wouldn't it be better to rewrite patch as a php script, it's just file manipulation using text files. ( well a bit more complicated than that!) . This would also mean that it was platform independant, whether using UNIX, Windows or MAC!. Interesting concept though, a site that could patch itself if a patch file was present.

Quote
i want to access these unix commands through PHP script on a unix server. Not ***dows.

Sorry Deneb but, I'm not an OS phobe. That just limits the target audience!

Mark
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.

#### simbo1905

• Guest
##### Re: Update for hacks by Deneb?
« Reply #12 on: April 08, 2006, 13:56:38 pm »

fair point. i am just a bit hesitant to "re-invent the wheel". not that it is not that such a module is not a good idea - it is just that there a so many other things that could be developed. the top of my wish list at the moment is a "wish list" or "gift list" module. like the amazon wish list. that would be of great use to all uses.