I've recently been asked numerous times how I managed to get the revisions for p3net working in the manner for which I did. That manner is pretty simple -- the diffs are stored in the database after being generated Text_Diff-0.2.1, a package in the PEAR library that ships with phpBB by default for use with the auto updater.
Using Text_Diff to get a diff is pretty easy. You simple include the class and do a simple
- Code: Select all
$diff = new diff($old_content, $new_content);
That will return an array of the changes per line. I then serialize and gzdeflate the array to save space, and then store it in the database.
The magic happens when...
[ Continued ]