29 Mar 2009 - Warsaw
The Setting
I’ve been looking for some decent forum package for Border Princes, the largest Warhammer Fantasy Battle online forum in Poland. It’s been running on a fork of PhpBB2 called Categories Hierarchy for some time now (over two years). For these two, almost three years, it’s been pretty stable and well-performing. So why bother and not just leave it?
The Dilemma
In today’s times of Web2.0, webservices and APIs, “the cloud” and other buzzwords, a stand-alone internet forum that cannot communicate with other webapplications is simply not enough and so 2001. I want to build some site(s) that could use PhpBB’s registration, authorization (the forum has grown a pretty large community) and — most importantly — dead-simple information exchange capabilities. While the first two would be pretty easy, the third one bites without any decent webservice.
Generally speaking, phpBB2 — even with Ptirhiik’s decent on work with Categories Hierarchy that have structurized and objectified lots of its spaghetti-code — sucks balls from a technical standpoint. I’m not even talking about language (phpbb4, yuck!), it started to embrace such modern and extravagant programming techniques like OOP only recently. I mean, what the fuck? My own code has seen OOP since I was 17 (and whenever the language supported it) and that was back in 2001. Authors of phpBB have created the largest and most successful piece of forum software, used by millions of people on a daily basis, and the best they could achieve was structural programming.
The Search
So I started to look for a successor to PhpBB2+CH, to migrate Border Princes onto a decent and modern forum engine.
Generally speaking, I was disappointed.
PunBB — too small and simple, I need subforums and pretty big authorization capabilities (at least ACL+groups). Invision PB — paid, not an option (besides being pretty bloated from what I remember from Reaper forums). SMF — just not enough (and its usability made a few people actually leave the board what was on phpBB previously). And don’t even get me started on migration scripts from PhpBB2, let aside PhpBB2+CH (which introduced a lot of changes to database schema).
It ended up on PhpBB3. Feature-rich, modern (or that’s what I thought when making the decision), fast and well-performing. Having a great migration script from not only PhpBB2, but also from PhpBB2+CH, which made the whole migration process a breeze. Running on my small VPS (512 Slice) on SliceHost (I still haven’t fully switched yet), it manages to serve 3000+ unique visitors daily (Google Analytics data) without even breaking a sweat (this VPS runs also 3 Rails-powered sites, so it’s pretty short on RAM) and visibly snappier than PhpBB2+CH, although it took some MySQL optimization and options tweaking beforehand.
The Horror
And then, after the forum got up and working, I decided to look at PhpBB3 engine codebase to check it out and maybe do a few modifications and… yeah, the title pretty much says it all. To put it lightly, the phpbb team managed to reach pretty high in standards of structural programming. Too bad that ~10MB codebase written in structural php with global variables (yeah — not even a Configuration nor Singleton object) means a crapload of interconnected code. On the good side, the code is pretty readable (as far as structural php code can be), well commented and pretty easy to hack. View part is separared into Smarty-like template files. Still, there are a few things that made me realize I’ve been living in a beautiful world for the last two years, filled with Ruby, RESTful design, design patterns (not even mentioning OOP), well-thought APIs, easy-to-add plugins etc. Meanwhile, in the world of forumboards, the best one out there is still PhpBB with lots of flaws:
- (still) no pretty URLs
- no plugin API or hooks, still MODs that are all about hacking
- MODs aren’t even in .diff (nor any similar) format, just a pack of instructions for human
- no gravatar support, not even through mod
- no OpenID support
- no webservice or any other means of accessing forum data for external apps
The Excuse
I know it’s easy to bash without doing own. I’m not going to bash PhpBB3 team, not much than what I wrote above. Writing a forum engine is a pretty big task — and if it was easy to do such a feature-rich engine with keeping up to the current programming standards, it’d probably be done already. I know that PhpBB3 team are aware of their code flaws and roadmap for 3.2 includes things like proper MVC separation (in place of current MC+V), fully OO-code, plugin API/hooks, dropping support for php4 and other hope-giving points. So I’m waiting eagerly. It’s 2009 already, goddamit! But until you do I have to do something…
The Hacking
I need a proper webservice-based access to my forum data, period. I don’t have time to wait for 3.2, so I did what I was afraid of for the last two years: went back to not only coding php, but actually coding based on someone else’s php code. I guess getting dirty from time to time won’t hurt, so what the hell. Here it is: PhpBB3 Webservices, my attempt to give some modern touch to PhpBB3. It’s on github. It doesn’t require hacking existing PhpBB3 codebase (drop-down in a subdir, has own modified copy of needed phpbb3 files), uses it’s whole authentication and authorization stack and is generally based on the dead-simple idea of XML-producing templates.