Go to content Go to navigation Go to about page Go to archive
Previous: DCC 3.0 release | Next: Elphel: Crazy

Repearing Drupal

This may be a useless post for others, but it is (and will be next time doing the same) useful for me.

When I was partially new to drupal, while starting this site, I decided to leave page, blog, story and urlpool node types in the game. Static pages were written in the page type, while "blogging" in the blog type. Soon I discovered that the blog type is utterly useless, as I am the only one writing onto my site, so just removed it. Everything went fine, the entries were still displayed.

Some days ago I fired up the pathauto module for implementing automatical fancy Wordpress like url aliases: year/month/title.

Again everything went fine, there's a radio button for mass-creating aliases for older entries. Now I had fancy aliases on all my content here on the site, except with a small bug: the nodes with the blog type had only title as alias without the year stuff.

After all I already planned fixing up my database with changing blog types to page.

First I had to search for the entries:
SELECT nid, title FROM node WHERE type = "blog";


Than I tried combining with the entries in the url alises table:
SELECT u.dst FROM url_alias u INNER JOIN node n ON u.src = CONCAT("node/", n.nid) WHERE n.type = "blog";


And finally I had the pleasure:
DELETE FROM url_alias u INNER JOIN node n ON u.src = CONCAT("node/", n.nid) WHERE n.type = "blog";
UPDATE node SET type = "page" WHERE type = "blog";


Just rerun the pathauto bulk alias creation and everything is done. This was easy, I can't think about how hard it will be when I switch from the wiki markup to textile, converting every old article...

FYI: I have looked at the path.module about the method of deletion, and it just deletes the entry in the url_aliases table. So this should be safe.
Appeared on 9 December 2005, 18:32 | Add to del.icio.us, ma.gnolia, newsvine | View blog reactions

Commenting is closed for this article.