A Script For Quickly Upgrading to the Latest Version of Wordpress
By Daniel Miessler on July 19th, 2008: Tagged as Blogging | System Administration | Wordpress
After this last Wordpress upgrade (2.6) I decided to clean up the script I use and post it here. It’s not as fast as using svn itself to upgrade, but I prefer to pull the latest version via svn, but drop it in manually — at least for now.
Anyway, I’d be cautious about running this until you’re very comfortable with the commands being executed. Until then, just use it as a list of instructions; even that will save tons of time vs. remembering the commands each time you want to upgrade.
Here’s basically what’s happening:
- Pull down the latest, cutting-edge copy of Wordpress
- Back up your existing webroot
- Delete your Wordpress related content from your webroot
- Copy the new Wordpress content to your webroot
- Replace your backed up content into the new install
- Re-apply the permissions on your webroot
- Test
And here’s the script:
#!/bin/bash # Daniel Miessler's script for updating Wordpress using SVN # Set variables WEBROOT=/path/to/your/webroot # Change directories to your updated wordpress folder (create if necessary) cd $WEBROOT/wordpress_svn/ # Delete any old stuff in there rm -rf $WEBROOT/wordpress_svn/* # Download the latest version of Wordpress via SVN svn co http://svn.automattic.com/wordpress/trunk/ . # Change back into your webroot cd $WEBROOT # Backup your webroot (Really, really make sure this works before continuing!) cp -a $WEBROOT ../htdocs_backup # Kill off all your Wordspress files in your webroot rm -rf $WEBROOT/wp* # Copy in your updated Wordpress files from the SVN folder cp -a $WEBROOT/wordpress/* . # Replace your backed up/customized content from your backup cp -a ../htdocs_backup/wp-content/plugins/ ./wp-content/ cp -a ../htdocs_backup/wp-content/themes ./wp-content/ cp -a ../htdocs_backup/wp-content/uploaded_content ./wp-content/ cp -a ../htdocs_backup/wp-config.php . # Re-apply proper permissions to your webroot find . -type d -print0 | xargs -0 chmod 755 find . -type f -print0 | xargs -0 chmod 644 find . -print0 | xargs -0 chown apache # Finally, clear your cache and navigate to your site's admin page # update the database and make sure your plugins are working # http://$yoursite/wp-admin/ # For any questions, email me at daniel@dmiessler.com
And let me know if you have any questions.
--

[...] A Script For Quickly Upgrading to the Latest Version of Wordpress (tags: wordpress script Upgrade Blog) [...]
Pingback by links for 2008-07-21 at DeStructUred Blog — 7/21/2008 @ 2:30 am