Dec 26

Is this thing on? protocol7 has been broken for a few days due to an upgrade at my hosting and me being lazy over the holidays and not reporting it. Now, the Joyent support has fixed it and we should be back online.

This event reminded me that I needed to revisit my site configuration. I keep the entire site (except for the stuff that MySQL stores for me) in Subversion. The live site is simply a checked out working copy. Whenever I need to make an update, I do that locally on my laptop and commit the change to SVN. Then run a simple svn up on my server and it’s all done. This setup gives me a lot of confidence in knowing that all changes are safely stored and I can easily retrieve old working versions to rollback any bad update. In this case, this helped me a lot since one of the problems was a file that was mysteriously missing on the live site. svn up fixed that immediately.

I’ve also used the SVN installation method for Wordpress. However, my customizations has been troublesome. Since SVN can not handle overlapping working copies, the files below the WP checkout could not be stored in my SVN. This included my themes and plugins, the files that I spend most time on customizing. No good.

Today I spent some time on fixing this. Please note that I know next to nothing about PHP.

WP installation

I now include WP automatically in my checkout using the svn:externals property. This means, that wherever I check out the site, SVN will pull down the version of WP I currently run.
svn propset svn:externals "wp http://svn.automattic.com/wordpress/tags/2.3.1"

Plugins

Plugins are normally kept in wp-content/plugins beneath the WP installation. Again, this means I can not store these in my SVN. However, the plugins directory can be customized by setting the PLUGINDIR variable. Create a directory in your site root wp-plugins and put this in your wp-config.php:
define('PLUGINDIR', '../wp-plugins'); // no leading slash, no trailing slash

Then, put all your plugins in wp-plugins and store them in SVN like normal. I pull down any plugin I can using svn:externals, currently Akismet and the OpenID plugin.

Themes

Themes are normally stored in wp-content/themes. To customize this path, you need to use a different method from plugins. The idea is to use add_filter to create a filter that changes the path. However, there are currently some issues with this approach (for example image paths in the WP admin GUI not using the filtered paths but instead handcrafting them) so I had to use a workaround. I’ve created a wp-themes directory in the site root, put my themes in it and stored it in SVN. Then, I create soft links using ln -s to link the themes into wp-content/themes. I’ll continue investigating this issue with the WP developers to see if a better solution is possible.

wp-config.php

wp-config.php must be kept under the WP installation directory. Again, I use soft links to keep my original copy in a custom directory and under SVN control. Note that as part of wp-config.php, WP detects its installation directory. When using a soft link, it will find the wrong root directory. Instead, I have changed wp-config.php to set the correct root directory explicitly:
define('ABSPATH', '/absolute/path/to/wp/');

Again, not exactly what you would like, but does the work.

Site installation

Installing or restoring the site can now be done using the following commands
svn checkout http://example.com/my/svn/repos .
ln -s wp-themes/mytheme wp/wp-content/themes/mytheme
ln -s wp-custom/wp-config.php wp/wp-config.php

Upgrading WP is done by changing the svn:externals property and then running svn up. Dead simple.

Technorati Tags: , ,

Oct 27

I just upgraded my Wordpress installation (the one used to publish this post) to the latest 2.3.1. Upgrading WP is easy, but boring so this time I decided on putting some additional work into the upgrade by switching to the SVN based install described here. Worked like a charm and future updates should now be as easy as running svn switch. I keep the rest of my site in my private SVN since a few years back. That means I would like to keep my WP customizations (like wp-config.php, plugins and themes) in my own SVN and then interleave their working copies to make up the final site. Haven’t yet figured out how to best do this. Tried soft linking my custom files into the WP checkout, but that blew up WP.

Oct 13
XML geekdom
icon1 Niklas | icon2 Tags: , . | icon4 10 13th, 2007| icon3No Comments »

One of my favorite blogs has to be Michel Kay’s Saxon diaries. If you’re not already familiar with Michael Kay, he’s one of the, if not the, foremost expert of XSL-T and related technologies. And he’s the sole creator behind Saxon, the best XSL-T engine around.

His posts usually deals with various improvements, mostly performance related, to Saxon. And they deal in very great detail. More than you will ever need, but still it tells you a lot about how to improve on a stable code base. The two most recent posts are excellent examples.

May 16
Lill-Niklas online
icon1 Niklas | icon2 Tags: , . | icon4 05 16th, 2007| icon3No Comments »

One of my very smartest colleagues has just started his own blog over at this slightly odd address http://de9644.wordpress.com/. If you care about experiences concerning integration in general and WebSphere in particular, you should probably keep track.

Also added to my linkroll.

May 9
Twittering
icon1 Niklas | icon2 Tags: , . | icon4 05 9th, 2007| icon3No Comments »

Against my own better judgement I’m trying out Twitter. After a day, I’m far from convinced that it’s of any use. If you know me and are using Twitter, feel free to add me as a friend, maybe that will make it more interesting.

Well, at least they gave me a cute looking error screen.

Tags: ,

May 9
Disabled del.icio.us
icon1 Niklas | icon2 Tags: , . | icon4 05 9th, 2007| icon31 Comment »

Inspired by Mårten and Mark Baker I’ve just disabled my del.icio.us posts here at protocol7. Like Mark, they mostly served as an excuse for me not to write real posts. If you still want them, they are over here.

Tags: ,

Jan 30

Just had to try out the new blog feature in Word 2007. So far it looks good, although I’m still really confused about the new menu interface. Couldn’t even find the Open menu option until after clicking on all menu options at least twice I realized that the little circle in the upper left was slowly blinking.

Now for some HTML
torture
.

Update: the simple HTML test above didn’t turn as perfect as one could wish for. A <br /> tag was inserted before “torture”, but that seems to be a bug in Wordpress rather than Word. Besides that, Word seems to create the “correct” tags, such as <strong> rather than <b>.

Oct 27
Hemingway
icon1 Niklas | icon2 Tags: , . | icon4 10 27th, 2006| icon3No Comments »

Say hello to Hemingway, my new blog theme. Pretty happy with the vanilla theme and with an hour or so of hackery it’s getting really close to what I want. Some smallish things left (like to many quicklinks in the menu pane) to fix but that’s for another day.

Aug 21
OpenID on protocol7
icon1 Niklas | icon2 Tags: , . | icon4 08 21st, 2006| icon31 Comment »

I spent last night working on OpenID support for comments on this blog. If you haven’t taken a look at OpenID yet, you probably should. OpenID is a truly distributed identification system. By providing a URL, an OpenID consumer can then verify with an OpenID server that you really ”are” that URL, the server will also provide you with the possibility of deciding which consumers you want to share your identity with. And, with the addition of the Simple Registration extension, you can also provide personal details (such as your nickname and email) if you so like.

Since I’m running Wordpress, I started googling for for plugins, finding quite a few different versions. After some messing around, I finally chose the version provided by Stephan Paul Weber, which in turn is based on the work of Alexander Nikulin. The changes I’ve done are miniscular in comparison with the work done by Alexander and Stephan, please give credit where credit is due.

The plugin provides both a consumer for use with post comments and an OpenID server. However, for the server there are multiple free options around the web which are more fully featured so I choose not to use that part of the plugin. Instead, I’m using the excellent service over at myopenid.com. Since the server is hardcoded into the plugin, this meant that I had to start hacking away at the source. And while I was at it I also fixed two other issues I had with it: didn’t work with my anti-spam plugin and most of all, didn’t support Simple Registration. The latter meant that any comment someone would add would use the OpenID URL for the name, instead of, well, the persons name. Also, it didn’t support getting the persons email either. No good. It also had some minor bugs that I really needed to fix.

Two hours later, the plugin now support Simple Registration, so adding a comment will now (granted that your OpenID server support Simple Registration and that you approve of providing this information) automatically retrieve your nickname and email and use those in the comment (of course, email is not actually published on the site). Very simple, very slick. Please try it out and give me feedback on how I can improve it! If your OpenID server does not support Simple Registration, the comment consumer should fall back to your URL. Or, you can still comment by only providing your name, email and site, just like before.

I won’t package up and release my version of the plugin just yet since I’m not that confident in that I’ve made all the necessary changes. Still, if you would like to play around with it, feel free to email me or leave a comment on this post and I’ll be happy to send it to you.

Next up, see if it’s possible to convince the K2 developers to include support for the OpenID plugin into the theme like they do for many other plugins. That would be outstanding as it would remove the need for hacking the theme as you have to do today.

Feb 24
Moved to WordPress
icon1 Niklas | icon2 Tags: , . | icon4 02 24th, 2005| icon3No Comments »

With the release of WordPress 1.5 I couldn’t resist any longer. I made the switch from Movable Type a few days ago. Installation was very simple (<5 minutes), import of all my MT entries was trivial using the import-mt.php script (<5 minutes), setting up the permalinks (1 hours) and redesign of my Kubrick based MT templates was simple since the default theme in WP is also Kubrick (30 minutes). All in all the switch took about two hours and all has been working very good since.

I can strongly recommend doing this switch, if nothing for nothing else to enjoy the powerful but simple admin GUI.

« Previous Entries