Habari Pingbacks and Undelete

published

After a bit of a summer lull, things are picking up again for Habari. One very important improvement is increased usage of our core API inside the install process. Previously, we had SQL INSERT statements inside our database schema files. These have almost all been removed, and replaced by Habari functions that perform the appropriate database interaction. This provides a consistent utilization of our core functionality, makes sure that the construction of the initial database is easy to understand by anyone reading the installhandler class, and helps simplify synchronicity between the schema definitions for all of our supported databases.

In the last couple of weeks, we’ve also finalized support for sending and receiving pingbacks, through the use of the new pingback plugin. This plugin uses our own XMLRPC library, which is made available under the Apache Software License. Our initial testing has worked well enough that we’re now ready to start testing the plugin on live sites (like this one!) in order to discover any unexpected problems.

Another major improvement in Habari is initial support for undeleting posts. This was originally built into the core of the Habari codebase, but after some discussion we decided to move it out into a plugin. First, not everyone will want undelete functionality. And second, this is an excellent opportunity to demonstrate how plugins are constructed for future plugin developers: the undelete plugin isn’t terribly complicated, and makes a good example of how to use our plugin API.

The undelete plugin leverages several important design decisions in Habari. From an early stage, we knew we wanted to be as flexible as possible when it comes to handling posts. One of the failings of other blogging solutions is that they know only about one or two kinds of content: posts and pages. Habari, on the other hand, has a flexible system for adding entirely new post content types, so that plugins can make and use content in ways we could never anticipate. In a similar vein, we wanted post statuses to be flexible, too. Instead of just a binary draft / published status, we’ve made the status system dynamic, so that plugins can register new post statuses. The undelete plugin registers a new post status of “deleted”, and through the plugin API it interrupts the normal post deletion process to set the post’s status to “deleted” rather than actually delete it from the database.

Currently, that’s all the plugin does – it does not yet provide an interface for restoring posts to their original status. That’s in the works, though! We plan to develop a complete admin interface for reviewing and manipulating deleted content. This interface will be tied closely to improvements in our ACL system, so that administrators can delegate who can and cannot undelete posts. We also plan to extend undelete functionality to comments; and there’s even been some discussion as to whether or not we can undelete user accounts.

Work on the undelete plugin and the pingback plugin has helped us refine our plugin API plans. We’ve adopted a very consistent naming convention for plugin hooks: class_method_extra. For example, the undelete plugin acts inside of the delete method of the post class, making sure that the post is not actually deleted, so it uses the post_delete_allow filter. This filter expects a boolean true or false value to determine whether to proceed with deleting the post. The undelete plugin returns a value of false, so the post is not actually deleted.

With the plugin API settling into a nice standard, I’m looking forward to working next on the ACL system, in order to support granular permissions on the things one can do inside of Habari.

Finally, we’ve added Andrew Da Silva to our project team! Andrew has been doing a bang-up job providing patches and monitoring the list of open issues. I’m extremely pleased to have someone with his enthusiasm on the team, and I’m really looking forward to working with him!


home / about / archive / RSS