Showing posts with label drupal. Show all posts
Showing posts with label drupal. Show all posts

Saturday, 1 November 2008

Bye bye Drupal. Hello Wordpress!

As you can probably see, I have moved this site from Drupal to Wordpress.


Why? 


The themes are nicer, the modules are better and it seems to be a much more professional project overall.


I've run a basic conversion script over the database for now and, as a consequence, there will be a whole lot of clean-up required. 


Being new to Wordpress means that this might take a little time.


I'm going to use Flickr for photo management and have the Flickr module installed, but I will obviously need to get all my photos online before they'll be available.


I also hope to blog more from the iPhone - and Wordpress should make that easier.


Oh, and here's that script:



# Taken from, http://mcdevzone.com/files/drupal_to_wordpress.sql

# this assumes that both wordpress and drupal are in separate databases.
# The wordpress database is called "wordpress" and the Drupal database
# is called "drupalmigration"

# based on scripts from:
# http://www.darcynorman.net/2007/05/15/how-to-migrate-from-drupal-5-to-wordpress-2
# http://spindrop.us/2006/05/19/migrating-from-drupal-47-to-wordpress
# http://www.brendanloy.com/2007/02/wordpress-21-upgrade-problems.html

# first, nuke previous content in wordpress database
use wordpress;
delete from wp_terms;
delete from wp_term_taxonomy;
delete from wp_term_relationships;
delete from wp_posts;
delete from wp_postmeta;
delete from wp_comments;

# categories
INSERT INTO wp_terms (term_id, name, slug) SELECT term_data.tid, name, name FROM drupalmigration.term_data where term_data.vid = 2;

INSERT INTO wp_term_taxonomy (term_taxonomy_id, term_id, parent) select term_data.tid, term_data.tid, parent from drupalmigration.term_data, drupalmigration.term_hierarchy where (term_data.tid = term_hierarchy.tid) AND (term_data.vid=2);

# posts
INSERT INTO wp_posts (id, post_date, post_content, post_title, post_excerpt, post_name, post_modified, post_author) SELECT DISTINCT n.nid, FROM_UNIXTIME(created), body, n.title, teaser, REPLACE(REPLACE(REPLACE(REPLACE(LOWER(n.title),' ', '_'),'.', '_'),',', '_'),'+', '_'), FROM_UNIXTIME(changed),n.uid FROM drupalmigration.node n, drupalmigration.node_revisions r WHERE n.vid = r.vid;

# category --> post relationships
INSERT INTO wp_term_relationships (object_id,term_taxonomy_id) SELECT nid,tid FROM drupalmigration.term_node ;
UPDATE wp_term_taxonomy SET taxonomy='category';

# category count updating
UPDATE wp_term_taxonomy SET count = (SELECT COUNT(object_id) FROM wp_term_relationships WHERE wp_term_taxonomy.term_id = wp_term_relationships.term_taxonomy_id);

# comments
INSERT INTO wp_comments (comment_post_ID, comment_date, comment_content, comment_parent, comment_author, comment_author_email, comment_author_url) SELECT nid FROM_UNIXTIME(timestamp), comment, thread, name, mail, homepage FROM drupalmigration.comments;

# users
INSERT INTO wp_users (ID, user_login, user_pass, user_nicename, user_email, user_registered, display_name) SELECT uid, name, pass, name, mail, FROM_UNIXTIME(created), name FROM drupalmigration.users WHERE uid>1;

# update comments count on wp_posts table
UPDATE wp_posts SET comment_count = (SELECT COUNT(comment_post_id) FROM wp_comments WHERE wp_posts.id = wp_comments.comment_post_id);

# fix post slugs. first we have to remove the duplicate _____ chars, then replace that with a single - char
UPDATE wp_posts set post_name = REPLACE(post_name, '__', '_');
UPDATE wp_posts set post_name = REPLACE(post_name, '__', '_');
UPDATE wp_posts set post_name = REPLACE(post_name, '__', '_');
UPDATE wp_posts set post_name = REPLACE(post_name, '__', '_');
UPDATE wp_posts set post_name = REPLACE(post_name, '_', '-');

Monday, 11 June 2007

Tagadelic patch

We've noticed that there's a small bug in the Tagadelic module for Drupal.

It doesn't pay attention to the status of nodes. ie: it uses unpublished content for its calculations.

Here's a patch to remedy that:
--- tagadelic.module.old        2007-06-10 17:55:54.980771815 +0100 
+++ tagadelic.module    2007-06-10 18:03:32.950326194 +0100 
@@ -211,7 +211,7 @@
    if (!is_array($vids) || count($vids) == 0) {
      return array();
    }
-  $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', $vids, 0, $size); 
+  $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid INNER JOIN {node} nod ON n.nid = nod.nid WHERE d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') AND nod.status = 1 GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', $vids, 0, $size);
     return tagadelic_build_weighted_tags($result, $steps);  
}

Friday, 13 October 2006

New look

I had received some complaints about the previous theme.


I agree it wasn't exactly easy on the eye but it was the best I could do at short notice.


Since I had to stay back at work late to baby-sit a site launch, I had some time to kill. So I went for a surf and found a fairly pleasent Drupal theme which I decided wasn't quite up to scratch.


What you currently see is a widened version of the Andreas03 theme.


There is also some other CSS hacks to personalise it.


The awful "Matrix" Gallery theme has been replaced with a heavily modified version of Carbon. Nice and clean.


There was some work to get rid of all the extra garbage but I think you'll agree it looks nice enough.

Monday, 7 August 2006

F-Spot + Gallery2 = Photos!

I've installed f-spot on FC5 and installed Gallery2 on the site.


G2 integrates nicely with Drupal and f-spot has a plugin which allows seamless uploads and album management. Good combo.


Previously, I tried Digikam with the Kipi plugin pack which worked but wasn't nice as f-spot.

Tuesday, 1 August 2006

Drupal

So I've decided to try and get Drupal up and running and into live.


Just read the Drupal basics to familiarise myself with it all and, well, here it is.


I'll add some more modules and things to try and re-create what I already have in the existing site.


Once done, I'll be making it fully live.