Archive for April, 2008

Roll your own migrator plugins

The migrator component makes moving data from your old Joomla! 1.0 site to a shiny new 1.5 site very easy. You can even make it migrate data from third party components, using the so called ETL plugins (for Extract, Transform, Load). But what if the components you’re using don’t supply ETL plugins? Roll your own! You don’t have to be an expert developer — just follow these easy steps.

  1. Find out which database tables the component uses. You can usually find these by looking at phpMyAdmin, or by looking for files in the component’s /table folder.
  2. For each of these table, make a new file and give it the name of the table. Eg. if the table is called #__guestbook, make a file called guestbook.php. Keep in mind that come components might depend on tables from other components or the core, such as the user table. You’ll need to make sure you migrate those tables as well.
  3. Inside the file make a class with the name of the table, like this:
    class Guestbook_ETL extends ETLPlugin
  4. First we tell the migrator what our plugin is called:
    public function getName() {
      return 'My Guestbook Migrator Plugin';
    }
  5. Next, we need to tell the migrator what table we migrate from:
    public function getAssociatedTable() {
      return 'guestbook'; // no prefix needed
    } 
  6. Finally, we need the CREATE statement. You can get that by using SHOW CREATE TABLE jos_guestbook in your MySQL client, or by looking at the component’s XML file.
    public function getSQLPrologue(){
      return 'CREATE TABLE #__guestbook (`id` int(11) NOT NULL auto_increment, .....';
    }
  7. Install the migrator component on your old site, and use it’s upload feature to add the plugins. Activate the migration and continue as usual.
  8. Enable Legacy mode and install the component. Make sure to check the XML file, some components have a DROP TABLE statement in there. It’s also good practice to use CREATE TABLE IF NOT EXISTS statements.

This approach should work for most of the components out there. Still, this is only the tip of the iceberg. Migrator plugins are a lot more powerful than that. They allow you to rewrite the tables and the data in them, eg. for when the 1.0 and the 1.5 version of the component have a different database schema. If you want to learn more about that, you should take a look at the actual ETLPlugin class, as well as the core plugins that come with the com_migrator package.

Resources

Dutch Joomladays Impressions

We really did intend to do some live blogging from the event, but honestly we were just too busy! Two days with 250 attendees each, that’s a lot of interesting people to meet. Everybody was asking us about SITEman and Nooku, and I don’t think I ever talked that much in 48 hours in my entire life. Luckily I brought my laptop so I could demo Nooku (as they say, a picture says more than a thousand words). Some people had already discovered nooku.org, which only has a small splash page at the moment, so naturally they wanted to know what it is we’re so excited about.

There were too many interesting presentations, so picking the ones to attend was very hard. I particularly liked James Vasile‘s talk about the GPL, how it is becoming a business necessity to embrace open source, if you want to be able to compete. It sounded maybe a tad too optimistic to my ears, but then again he’s much better situated to know about the future of open source, than us mere mortals.

TYPO3

I also attended a session on TYPO3. I was hoping to learn some more about the new framework they’re developing, called FLOW3, but the talk was more a sort of basic introduction. The back-end looked pretty crowded, complex and unfriendly to me, but it has some impressive features: you can remove each single element from the back-end, to create a very focused UI for each user group. Eg authors would only see features relevant to writing articles, etc. The built-in multi-site feature is also very powerful: you can share parts of the contents of one site with other sites. Definitely worth looking into for a future Joomla! version.

More

I could spend all evening blogging about the event… well, you just had to be there. If you did attend and like me, you felt that some of the sessions were too short to cover everything (like Johan’s talk about the application layer in J!1.5), meet us at one of the upcoming BootCamps. While chatting with some of our fellow Belgians at the event, there was also some mention of organizing our own Joomla! event in Belgium. Any thoughts on that?

Building bridges using the Joomla! application layer

I had a really great time on the Joomladays past two days. I had only expected to hear a bit more from the other projects on the topic of ‘building bridges’. All of the presentations we attended about other projects where mere introductions and feature overviews of their technology. A missed chance if you ask me.

On the business day , I gave a presentation about the Joomla! Application Layer, titled : Quickguide to Joomla! Application Stardom.

In the first part of my talk I discussed how the web is evolving from web 1.0 to 2.0 and 3.0. I concluded that Joomla! 1.5 would be what I would call web 1.5.

In the second part I gave a quick intro in the Joomla! 1.5 Application layer and demonstrated how we used it to create RokBridge, a bridge between phpBB3 and Joomla! 1.5.

In my previous blog post I also hinted about a little surprise. Well, the good news for RokBridge users is that we (thanks Anthony) have found a way to visually integrate the bridge into Joomla! 1.5 without using a component. This means full performance, user bridging and visual integration. Neat isn’t !

Debugging Joomla! applications in Eclipse

Past weekend, we went to Utrecht to attend Joomladay NL 2008. On the community day, I gave a presentation about the Eclipse project. The presentation included a short introduction to the project, an overview of the different ways of developing PHP applications in Eclipse. At the end I explained how PHP developers could debug their PHP applications using Xdebug.