Drupal

Unspoken Rules of Drupal

Many of you know some of the unspoken rules of Drupal. But, I have a feeling that I have to reiterate them once more for everyone:

1. Do not hack core
No matter how easy it seems to change one little file in Drupal's core file system to make it do what you want it to do, do not change it. Drupal is made so that the upgrade path is easy. It has been well thought out and designed so that there really isn't any reason to change or modify core in any way, shape, or form. Changing the file system means that you make upgrading to future versions of Drupal very difficult, meaning that you'll miss out on many security updates, bug fixes and will run into a maintenance nightmare later on. If what you're trying to do cannot be accomplished by what's there already, create an issue about your problem in the Drupal issue queue and maybe write a patch for it. Your feature will then become a part of Drupal core and you'll once again have that clean upgrade path. Do yourself and your fellow developers a favour and don't hack core.
2. Do not hack core!
This cannot be said enough.
3. Update to the latest Drupal
New versions of Drupal come with vital security fixes and bug fixes and will help protect your site from attacks. This doesn't necessarily mean update to Drupal 7 if you're on Drupal 6, just to update to the latest point fix of Drupal 6.  Also remember that older versions of Drupal will eventually stop being maintained as less people use and contribute back to it, so keep your upgrade path on the radar. Developers also love the updated APIs that come with newer versions of Drupal as they are much nicer to work with and allow much more flexibility.
4. Use contributed modules
Whatever you're trying to do with Drupal has probably already been attempted. Search around for a module that already exists that implements what you're looking for and use it. If it doesn't work how you'd like to it, stick a not in the project issue queue and fix what's wrong with it. The less custom code you produce means the less maintenance you'll have to do later on.
5. Uninstall before deleting modules
If you want to remove a module from your website, be sure to uninstall it from the modules page before deleting the module's folder. Wim Mostry brought this up after realizing that a client's site had a bunch of obsolete data and settings left over from older modules.
6. One module to ruin them all
If you're developing a custom module for a website, often times it seems like the best solution to stick all of your custom hooks and custom functions in one giant module. In reality, however, this custom module full of custom functions will eventually turn into one tangled mess of unmaintainable code. Do yourself a favour and group different sections of functionality if different modules. Creating distinctions in module functionality will allow you to easily turn off and on functionality instead of having to route through a horrible mess of code later on.
7. Develop with error reporting on
When developing a module, open up your php.ini, and set "error_reporting" to E_ALL. This will let you know about any small PHP warnings and notices you run into during development. The outcome will be nice, strict, clean code. On production sites, however, make sure to return it back to what it was so that users don't get confused if any big ugly red warnings/errors appear.
8. Contribute
If you make a changes to a contributed module for use on your own site, create an issue about it in the module's project queue outlining what you changed. Giving the module maintainer the chance to see how people are using their module will allow the module to adapt, evolve and grow.  Next time you use that module, you won't have to worry about making that change again because it will become part of the module's core functionality, as well as keeping the clean upgrade path.
9. Have Fun!
You're part of an amazing community of people with a large amount of awesome talent. Get involved with your local Drupal group, and get to know the people who are doing the same things as you and have fun!

If you know any other unspoken rules of Drupal, please let them be known!

Drupal 7.0 Unstable Releases Begin!

In listening to the pleading voices of many developers, the infamous Drupal 7 maintainer, webchick, just created the first unstable release of Drupal 7: Drupal 7 Unstable 1. Thank you, Angie!

These unstable release tags will probably never have actual release nodes, and they are before the beta, or even alpha releases, so you generally shouldn't use them on your production site. But, if you're up for an experiment in the bleeding of bleeding edge, try it out. I'm not too sure if they upgrade path will be supported, so we'll have to wait and see. I think I'll wait for the Alpha releases to update my site to Drupal 7 to be on the safe side.

Drupal 7 Code Freeze = Two Months?

There was some talk recently about releasing pre-alpha versions of Drupal 7 for development and testing purposes and this got me thinking about the actual Drupal 7 code freeze. For those of you who are "in the cold" and don't know what a code freeze is (horrible pun, sorry), it's a given amount of time where features are denied from going into Drupal. Although it's sad to see additional features not be able to go into Drupal, it gives the developers a bit of time to fix bugs and optimize performance before the official releases go out.

If you have a look at Dries' Drupal 7 Timeline, you see that he predicts a November 15th code freeze if we have full test coverage. Now, if you have a look at the Drupal 7 test coverage report, you can see that we're pretty close! So, assuming that we get the three month code freeze, that means we only have about two months left to get all the features and awesomeness that we so ever want in Drupal 7. What awesomeness is missing from Drupal 7, you ask?

Here are the items remaining on my wish list:

Although Drupal 7 has already achieved its awesomeness status, having these items added to its mastery would absolutely blow my mind.

Drupal's Next Generation Database Layer

Everyone rejoice, as Dries has just committed the long standing Drupal Database Layer: The Next Generation patch. This was one of the items on my original Drupal 7 wishlist, and is one of the major steps that will make Drupal 7 a killer release. This patch does a number of awesome things, as outlined by Crell:

  • Allows fancy PDO database queries (foreach through a result-set, select columns of result-sets, etc)
  • Connect to multiple databases simultaneously
  • Database replication
  • Type-agnostic prepared statements, so we don't need to bother with %s or %d
  • Proper support for NULL values
  • Adds support for transactions, while allowing them to not die on non-transactional databases
  • Support for "INSERT ... ON DUPLICATE KEY UPDATE ..." on MySQL or whatever the database-specific equivalent on other databases
  • Support for multi-insert statements, on all databases, using the appropriate database-specific mechanism
  • "INSERT DELAYED" support on databases that support it or some equivalent, which should help performance on logging and similar "don't need it back immediately" queries
  • Fully-structured INSERT, UPDATE, and DELETE queries with a simple fluent API (chainable, like jQuery) syntax
  • A Fluent API query builder for SELECT statements that weighs in at only a few hundred lines (not counting comments)
  • .... And that's just naming a few of the benefits

Congratulations everyone! Crell, chx, bjaspan, catch, swentel, recidive, you guys rock!

Turning Drupal into a Distributed Twitter/Micro-Blog

One thing that has really blown up in the past two years is micro-blogging and the idea of sending little updates to a mass majority of people at once. These updates are public, and users can "subscribe" to another's updates, therefore encouraging conversations to start, and "lifestreams" to spawn.

Some fairly large websites that provide this type of service are Twitter, Jaiku, Facebook, Spoink, LinkedIn, and Identi.ca/Laconica.

Robert Scoble has made some pretty interesting quotes about the phenomenon, my favourite being "Twitter is the public square. Lots of noise, little signal. Blogs are like a speech. Signal, but little noise". But that's up for debate, and out of context with what I want to talk about in this blog post. What I want to talk about here is integrating micro-blogging with the content management system, Drupal.

Recently, Identi.ca has become quite popular. What makes it different then other services like Twitter is that it is open source, under software named Laconica. Since Laconica is open source, it means that there could be any number of servers running the software at any given time. I could be posting on Identi.ca, while my friend is posting on SportsTwit. So how do I subscribe to my friend's posts when we're on different networks? The answer is provided through the OpenMicroBlogging specification, which describes how two different systems could manage subscriptions across networks. When I log into Identi.ca, I see updates from people across a number of different Laconica installations and networks.

So why would we want to bring this to Drupal to make a distributed Twitter clone? This would allow you to use your own blog as your Twitter/micro-blogging profile. People could still subscribe to your posts, and you could subscribe to theirs. Instead of just writing small 140 character text updates, you could incorporate anything you wanted (video, pictures, audio, etc). Drupal is all about distributed open source awesomeness, and this would bring that awesomeness to the micro-blogging world.

How would we put this into action? The first thing to do is take a closer look at the OpenMicroBlogging specification, as well as the awesome OAuth Drupal module. Sumit Kataria wrote a brilliant post about OAuth and how it works. I posted a groups discussion on it a while ago to get discussion going, and Tim Millwood mentioned that he started FooCity. It doesn't allow subscribing to other networks through the OpenMicroBlogging specification though and that, my friends, is the next step to allowing the ultimate distributed micro-blogging platform come to life: Implement the OpenMicroBlogging specification using Drupal and OAuth.

Syndicate content