5067 comments
1897 subscribers
4798 on Twitter
Subscribe! Feed reader E-mail

Notes on backporting modules from Drupal 6 to Drupal 5

I needed a web statistics module for a Drupal-based project at work, and integrating an external web statistics module seemed to be the way to go in terms of performance and features. BAWstats integrates the popular AWstats web statistics analyzer into Drupal. The module was developed for Drupal 6, so I spent a few hours backporting it to Drupal 5. I don’t know if I can send a patch back (might have to do some paperwork), but anyway, here are some notes so that (a) I can remember how to do this in the future, and (b) it might save you some time.

Backporting from Drupal 6 to Drupal 5: Change the menu items

  • Move the menu path from the array key to the path attribute.
  • Rename

    page callback to callback and page arguments to callback arguments.

  • Remove the file and file path attributes. Move the included files to include_once lines for now, and look for instances of include that need to be changed to include_once. Read the included files to check for unintended execution.
  • Change tokenized menu items (%/%/%) to ones that dynamically build the menu path (arg(1) . ‘/’ . arg(2) . ‘/’ . arg(3)). Don’t forget – this shouldn’t be cached.
  • Change 'access arguments' => array( to 'access' => user_access( or something similar.

Those were most of the changes I needed to make in order to backport bawstats to Drupal 5. Seems to work so far… =) More notes when I run into other things!

Short URL: http://sachachua.com/blog/p/4919

Comment, share a thought, ask a question...

Please comment as you, not your organization.





 

On This Day...

  • 2011: Managing configuration changes in Drupal — One of our clients asked if we had any tips for documenting and managing Drupal configuration, modules, versions, settings, and [...]
  • 2010: LotusScript: Checking another database for categories that do not contain a document of a particular type — We want to scale up Innovation Discovery and share the insights/workshop methods with more people, so one of my tasks [...]
  • 2009: Thoughts on Toodledo versus Emacs Org — It’s been a couple of months since I switched to using the Toodledo instead of Emacs Org to manage my [...]
  • 2009: Weekly review: Week ending June 7, 2009 — From last week’s plans: Relationships: Play with photography Posted new phonos. Wealth/career: Revise guide, prepare Transition2 build, give Early Career Conference presentation, [...]
  • 2009: Stage fright, visualization and improvization — “Maybe I should take a break from presenting,” I said, “and focus instead on writing blog posts and articles so [...]
  • 2008: Drupal meetup in Toronto later – 7:00 at the Drake — Instead of self-defense and yoga classes today, I’m going to the Lullabot meetup for Drupal developers over at the Drake [...]
  • 2008: IBM Pass It Along – social learning! — I’m happy to share that one of my favorite Enterprise 2.0 tools within IBM is now available on the Internet. [...]
  • 2007: Week in review — Back in Canada to work on my thesis. Outlined my thesis and started panicking about timing of work. Have decided to adjust [...]
  • 2006: The Alchemist — Coelho, Paul. 1988. _The Alchemist._ p149. “From where I am,” the sun said, “I can see the Soul of the World. [...]
  • 2006: One-thought — One of my greatest joys is one-thought: immersing myself so completely in the moment, focusing my entire self on a single [...]
  • 2006: More conversations — Last night was also a spectacular evening. Kat, Mike, Shane, Simon, and I chatted over coffee for a while, then had [...]
  • 2006: Centre Island — Today I finally made it out to Centre Island, thanks to Joe Whitney. It was a wonderfully sunny day. The ferry [...]
  • 2004: “Cognitive Personal Assistant” — A computerized assistant that can schedule meetings, filter and prioritize email, and carry out other mundane administrative chores using artificial intelligence is [...]
  • 2004: Yesterday — Talked about CS21A syllabus changes with Dr. Sarmenta, who is a lot more agreeable now than before. Also, had Paolo Venegas and [...]
  • 2003: Presentation packages — - http://www.miwie.org/presentations/presentations.html
  • 2003: Cat stories — Awwww, my cat has a little bump on top of her head. Must be from all those times she hit the [...]
  • 2003: Tips — Richard A. Detweiler, Information Week, June 6, 1994 1. Think both short-term and long-term at the same time, like a CEO [...]
  • 2003: Open source course ware — - http://www.k12os.org/ - http://www.claroline.net/ - http://seul.org/edu/ - http://moodle.org