Tag Archives: wordpress

WordPress Update Bash Script

I wrote this script some time ago. It's been working flawlessly for me, so I thought I'd share it here. It could use some progress messages, I suppose.


#!/bin/bash
DIR= # Put the file system path to your WordPress installation here. E.g., /var/www/html/blog
TMPDIR=$HOME/tmp
WPDIR=$TMPDIR/wordpress
cd $TMPDIR
rm -rf latest.zip ./wordpress # Clean up from the last run
wget -nd http://wordpress.org/latest.zip
unzip latest.zip
mv $DIR/wp-config.php $DIR/.config # Stash your configuration someplace safe
rm $DIR/*.{txt,html,php} # Delete the old install
rm -rf $DIR/{wp-admin,wp-includes} # Delete more. Don't delete plugins or themes.
cp -aR $WPDIR/* $DIR/
mv $DIR/.config $DIR/wp-config.php # Restore the configuration
# You may not need the last two lines. I like to give my web server the ability to write files.
chown -R .www-data $DIR/*.php $DIR/wp-admin $DIR/wp-includes
chmod -R g+w $DIR/*.php $DIR/wp-includes

Missing blog posts recovered

Part of the nightmare I went through while experimenting with WP-o-matic (no link) was that I accidentally deleted about 12 posts from my blog. Nothing earth-shattering, of course, but I just found an old database backup and recovered those posts. It was a real PITA, though, because the backup was from when I was running WordPress 2.2, and now under 2.3, the database has been changed. So, I had to actually install a dummy blog and "upgrade" it to 2.3. 🙄

Weird Traffic

I just saw some weird traffic on this blog. Last week, I was testing a plugin when it went a little haywire and automatically created a bunch of posts (based on my NewsGator clippings, including a lot of law related and gadget related topics -- things I read about but don't write about). And then because I have Alex King's twitter tools installed, each of those new posts was propagated to twitter, too.

Now, I thought that this little stunt probably would have pissed people off. Instead (maybe), I saw a huge spike in traffic to this blog -- more than three times the usual traffic.

I'm assuming that these "visitors" were just bots that were monitoring the twitter public timeline, but the referrer logs don't back that up (although that doesn't necessarily mean anything).

WordPress 2.3 Upgrade

Just finished upgrading to WordPress 2.3. Went off without a hitch -- even converted my categories to tags. I did have one issue with that, though. For some reason, certain posts were marked "Uncategorized" while other retained only my default "Miscellany" category. I couldn't detect the pattern. I had to "hand" edit the database to finish cleaning that up.

Other issues so far: I'm getting blank pages after form submissions in the admin interface (UPDATE: caused by having no categories 😕 ). Also, I notice that the Blogroll > Import Links panel uses the wrong taxonomy category to obtain the list of blogroll categories.

Quick WordPress Upgrading

Note to self:

Grab a unified diff of the new version versus the old version:
svn diff -r HEAD --old http://svn.automattic.com/wordpress/tags/<old_version> \
--new http://svn.automattic.com/wordpress/tags/<new_version>

Apply the changes to the current installation:
patch -d <path_to_wp_install> -u -i <patchfile>