I've found that making a copy of the the original query, and commenting it out first, and then adding the new hacked lines to another copy of the query ... to be a good way to revert back to the original from all of your hacked php files.
This might make the fils much bigger but at least you know that you can revert your board back to it's original state. Make sure that you add a comment line that describes that this is the original "un-hacked" block of code.
I do this with any hack that I apply ...