WordPress Update Bash Script

12 December 2011

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

27 December 2007

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. :roll:

Weird Traffic

18 November 2007

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

1 October 2007

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

21 June 2007

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>

WordPress and JavaScript Hijacking

13 April 2007

I read this paper that Bruce Schneier linked to regarding JavaScript hijacking. Seems to me that WordPress plugin developers who piggyback on WordPress's builtin security features shouldn't have anything to worry about.

Judging from what little buzz there was, I think that's probably true, but I'm interested in others' thoughts.

Yikes! WordPress Hacked!

2 March 2007

The WordPress crew have announced that the WordPress 2.1.1 download got cracked by an unnamed attacker who injected some code that would allow remote code execution. I'm glad I haven't upgraded!

Alex King on WordPress Theme Development

25 January 2007

tecosystems Redesign | alexking.org: Another good post by Alex King, this one about developing a new theme (and also about mixing business and friendship).

Alex King WordPress Plugin Roundup

14 December 2006

Alex King, a WordPress über-hacker (and formerly a b2/b2evolution hacker), is writing a series of posts about his recent redesign of alexking.org. His latest post describes the numerous WordPress plugins he's using, many of which he wrote.

I'm not using any of these right now, but I steal Alex's ideas and code all the time for my own hacking. ;)

P.S. Oh yeah, I'm using WP Grins. Thanks, Jeff.

Yomoblog is the first killer web app for mobile devices

25 August 2006

I'm testing Dave Winer's new web application: Yomoblog. It is a dead simple tool for creating, editing and categorizing blog posts from your web-enabled PDA.