Farewell Blogger.. Hello WordPress

My blog (and website) is now running on self-hosted WordPress installation. Yeah, it’s a PHP-thing, but I couldn’t bother making my own with Django or similar using Python. No time for that and I’m not a programming-language-radical-idiot.

RSS feeds have changed: you’ll find the link on my new website.

Why I moved away from Blogger? It just plain sucked, and I have had my fill of it..

I needed to create some plugin for WordPress. Existing plugins redirecting old Blogger URLs were not good enough. The code you’ll find below will redirect links from Blogger to the new links in WordPress. Hopefully it helps somebody!

<?php
/*
Plugin Name: Redirect Blogger links
Version: 1.0
Plugin URI: http://geert.vanderkelen.org/post/301/
Description: Redirect requests using Blogger links to WordPress link.
Author: Geert Vanderkelen
Author URI: http://geert.vanderkelen.org/

*/

add_action('init', 'redirect_blogger_links');

function redirect_blogger_links()
{
  global $wpdb;
  $uri = $_SERVER['REQUEST_URI'];

  $matches = array();
  if( preg_match('#(/[0-9]{4}/[0-9]{2}/.*\.html)$#', $uri, $m) ) {
    $query = "SELECT post_id FROM $wpdb->postmeta ".
      "WHERE meta_key='blogger_permalink' AND meta_value='".$m[1]."'";
    $post = $wpdb->get_var($query);
    if( $post ) {
      $wp->query_vars = array('p'=>$post);
      $url = get_permalink($post);
    }
    if( isset($url) ) {
      header("Location: $url", true, 301);
      header("Connection: close");
      exit();
    }
  }
}

?>

Note: if somebody can optimize it so the plugin only kicks in on links from Blogger, that would be great. It’s now executed on each request, which is a bit overkill.

By |September 24th, 2010|Personal|0 Comments|

MySQL 5.5.6-rc: InnoDB is default storage engine!

A few SQL queries are worth a thousands words:

mysql> SELECT VERSION();
+----------------+
| VERSION()      |
+----------------+
| 5.5.6-rc-debug |
+----------------+

mysql> SELECT @@global.storage_engine;
+-------------------------+
| @@global.storage_engine |
+-------------------------+
| InnoDB                  |
+-------------------------+

(Note: the above is without using the default storage engine option)

Scary! Excitement! MySQL!

On Mother’s Shoulder

Our new born son Tomas on his mother’s shoulder.

On Mother's Shoulder

If you want to see Tomas, or watch more pictures: come visit us!