[IPB 2.1] Template Set Differences

by Matt Mecham on July 22, 2005

It’s still early days, but here’s something I’ve thrown together this afternoon.

Originally, I was going to write a quick and dirty script to compare two ipb_template.xml files together and show a list of differences. I would re-format those differences and post them with a release announcement showing exactly which template bits had changed and which HTML bits had changed.

I then considered how useful this would be in a general sense. Wouldn’t it be nice if you could upload any ipb_template.xml file and have it compared to the current master HTML templates? Not only is this useful for just comparing changes between version releases, it’s also handy to generate a list of the actual HTML edits to your own custom skins for safe keeping.

This is the result. It’s fairly scrappy at the moment and the interface will be cleaned up as well as previous comparison results saved to the DB for hard reference.

This feature didn’t take too long to put together as I had already written a difference engine for IP.Dynamic – although the current difference engine won’t work for safe_mode enabled folks; something that will be working on as our adventure continues.

ACP Diff Overview (JPG)
ACP Diff View Bit (JPG)

{ 14 comments… read them below or add one }

1 Michael P July 22, 2005 at 5:00 pm

Nice idea Matt!
:)

2 Ikagatsu July 22, 2005 at 5:07 pm

Yes, nice idea.
But when can we have the final release!
We can’t wait!

3 Timothy Dorr July 22, 2005 at 5:22 pm

What sort of functionality are you using that isn’t allowed by safe_mode to diff two strings? I would think you would just need some basic logic to do so, not to hit the filesystem or anything crazy like that.

4 Matt July 22, 2005 at 5:28 pm

I’m using the difference engine from IP.D which runs via the UNIX “diff” command. I also have a CGI file to run the “diff” command for safe_mode folks, I will either enable that or write a PHP diff engine.

5 Timothy Dorr July 23, 2005 at 12:22 am

Oh, that’s no fun :P

What about Windows users, then? I think you’ll have to write the diff engine in PHP, to be honest. Of course, it doesn’t look that hard if you do it on a line-by-line basis: http://www.holomind.de/phpnet/diff.src.php

6 Cybertimber2005 July 23, 2005 at 7:25 pm

Ok… so basically it can tell you the diffrences between a custom edited 2.0.x skin and a 2.1.0?

7 Wolfie July 24, 2005 at 12:10 am

Could it also be made to create a “recommended changes/updates” XML file? That would make updating/upgrading skins from v2.0.x to v2.1.x a snap. :)

And it is an excellant idea Matt. You would think of it.

8 Kennedy July 24, 2005 at 10:32 am

Wicked!

9 Tim July 24, 2005 at 4:03 pm

Nice. Looking good, Matt. ;)

10 Darken July 25, 2005 at 3:24 am

Oh! Good idea!!

11 Matt July 25, 2005 at 12:47 pm

Tim Dorr,

That diff class looks too simplistic and has hard limitations (will only look 10 lines for a match), etc.

I’ve just included the LGPL Pear:Text-Diff class in the ips_kernel folder and we’ll just use that. The LGPL differs as it allows dynamic or static linking of libraries without the need for the entire software to be GPL.

In the fullness of time, I’ll write my own DIFF engine.

12 Timothy Dorr July 25, 2005 at 10:27 pm

Oh, of course. I wasn’t suggesting something *that* simple, but just pointing out it shouldn’t be that hard to do.

Of course, Text_Diff’s done all the work, so why bother! Just make sure you follow that LGPL to a T. We don’t want to get into another phpMyAdmin fiasco again :S

13 Matt July 26, 2005 at 9:27 am

LGPL is much less restrictive and as long as the whole of the work is just linked to and not incorporated into the core program then the core program does not have to be released as GPL.

“. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a “work that uses the Library”. Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.”

14 Don Wilson July 26, 2005 at 6:10 pm

This is probably the best example of a difference example that I’ve seen. There has always been a two-pane view of both documents with empty lines with red/green font. Thanks for the information on where you found a script to do this, I’ve been trying to root around google results and nothing was ever good enough.

Leave a Comment

Previous post: [IPB 2.1] API

Next post: Dan Brown’s Deception Point