EasyWPUpdate for WordPress 2.2 (and earlier)

May 15, 2007

TESTED THROUGH WORDPRESS 2.5

The release of WordPress 2.2 is finaly at our doorstep.  You can find the download on the on the main download page here: http://wordpress.org/download/ or from the announcement here: http://wordpress.org/development/2007/05/wordpress-22/.  This has been an interesting release.  For the last month I’ve been concentrating on the new job, but in the middle of all that I did participate in the debate that ended with the original tag implementation being pulled from this release.  Matt M. showed some real maturity by being willing to step back from his implementation upon the recomendation of others.  Oh! and for info about the name of this release “Getz”  head on over to Matt’s site for some sweet tones to put you into the mood to upgrade…

Aaron Brazell, aka Mr. Boss Sir, has come through and delivered another one of his 10 Things You Should Know About WordPress 2.2 articles and does a pretty good job of describing the heart and soul of this release.

I’ve released an updated version of my EasyWPUpdate script which includes some of the suggestions I’ve had from my readers.  Now, I must admit that Aaron’s similar script is downright awesome and the absolute best script in the world (yes I must admit that because it was a condition of my employment with b5media (REALLY!)), but if you don’t have automated server backups and you don’t regularly backup your SQL files, you might want to try my lowly little script.

Its features include:

  • Many blogs in one shot
  • Any version of WP
  • Automaticly runs upgrade script
  • Cleans up all files
  • Can use hosted or local files as source
  • Can be croned to ensure backups and/or refresh of dirtied files
  • Backup of files to new directory
  • Backup of files tarball/li>
  • Backup of database to SQL text file
  • Backup of database to tar ball
  • Optional inclusion/exclusions of directories.
  • Error detection and safe aborts

You can peruse the text version, EasyWPUpdate.txt, here:
Here are the basic steps to install this script:
1. Use Telnet or Putty to connect to your website and log into the shell
2. Type the following line:
wget http://www.thecodecave.com/downloads/EasyWPUpdate
3. Type the following line:
chmod +x EasyWPUpdate
4. Use an editor to change the values in Step 1 and save it again.
5. Run the script by typing:
EasyWPUpdate

That’s it. You will have just made backups of the files and database and updated all of your blogs. When 2.2.1 or even 2.3 comes out, the process will be:
1. Log in
2. Type
EasyWPUpdate

And you are done.

Now, step 1 looks like this:

# ##################################################################
# Step 1. Tell the script where to find the blogs
# ##################################################################
# List all of your WordPress directories and urls here.
#
# Each Blog should have a BlogDir and a BlugURL.
# Each Blog should have its own number [1],[2],[3] etc
# Delete the ones you don’t need.
#
BlogDir[1]=’site1dir’
BlogURL[1]=’www.example.com’

BlogDir[2]=’site2/news’
BlogURL[2]=’www.site2.com/news’

BlogDir[3]=’wordpress’
BlogURL[3]=’blog.site3.com’

That isn’t that hard to change is it? Even in VI.

Some quick tips on editing the script
1. type
vi EasyWPUpdate
2. Hit i
3. Make your changes
4. Hit ESCAPE COLON W to save your changes (or skip this step to lose changes)
5. Hit ESCAPE COLON !Q to immediately quit

Also, if your root directory is accessible from the web, you might want to change the name of the script:
mv EasyWPUpdate SomeSneakyName

to prevent unauthorized access.

(If you are a guru, please read through all 6 setup steps (and the rest too) there may be things you want to change.)

Enjoy 2.2!

Share and Enjoy:
  • del.icio.us
  • Fark
  • Reddit
  • Digg
  • DZone
  • email
  • Facebook
  • FriendFeed
  • Google Bookmarks
  • Netvibes
  • Ping.fm
  • Posterous
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Yahoo! Bookmarks
  • Add to favorites
  • Blogosphere News
  • HackerNews
  • Identi.ca
  • LinkedIn
  • MySpace
  • Print
  • Yahoo! Buzz

Comments

47 Responses to “EasyWPUpdate for WordPress 2.2 (and earlier)”

  1. Will on May 16th, 2007 2:24 pm

    Hi there. A *terrific* script, and it’s got me all very excited about the ease with which I can upgrade. But I have a problem :(

    Making Targeted Database Backups...
    Processing SQL Backup for: webs/the/path/tomysite
    mysql: unknown variable 'protocol=TCP'
    Could not retrieve table names. SQLBackup failed.

    MySQL’s on a different machine…but it should know this, right, by finding the server name from WP’s config file? Incidentally I’m running the script by doing “perl EasyWPUpdate” if that makes any difference

    Any clues?

    Thanks Brian!

    Will

  2. Aaron Brazell on May 16th, 2007 4:01 pm

    Aaron’s similar script is downright awesome and the absolute best script in the world (yes I must admit that because it was a condition of my employment with b5media (REALLY!))

    Damn straight! ;)

  3. Will on May 16th, 2007 5:57 pm

    Removing the protocol=tcp parameter has done the job! What a brilliant script. Two blogs upgraded, one 50mb database and a whole load of files backed up in about 15 seconds. Seriously impressed and very grateful!

  4. Brian on May 16th, 2007 6:07 pm

    HUH! Do you know what version of MySQL you use? If you only removed that, I don’t think you are communicating via named pipes or sockets. So maybe it is an older/custom version that communicates ONLY through TCPIP

    Anyway, Glad you got it to work!

  5. Will on May 16th, 2007 6:17 pm

    I’m on 4.1.22-log

    Whatever. It works!

  6. Joe on May 16th, 2007 6:50 pm

    This is the best scipt I’ve seen so far. :) But what about my WebRunner? You said you’d be including a link. Anyway I’m updating right now.

  7. Brian on May 16th, 2007 9:17 pm

    Actually I was wondering the same thing, I thought we’d left it so that you were going to post it and I would link to it, If you want to do it the other way around, just send me the latest.

  8. Eric on May 20th, 2007 12:50 pm

    Sorry if these are stupid questions — I haven’t used Putty and the shell for much…

    I’ve followed your steps above, using PuTTY, but when is comes time to run the script, I get the following:

    -bash: EasyWPUpdate: command not found

    Also, if the WP blog is in the root/main folder of the site (i.e., http://www.somesite.com), what value do you set for the BlogDir?

  9. Eric on May 20th, 2007 2:25 pm

    I found the answer to my first question, by using:

    ./EasyWPUpdate

    Still not sure what to put for BlogDir, though. Is it the file path? e.g., /home/some/dir/public_html/

  10. Brian on May 20th, 2007 4:56 pm

    If you only have one blog, you should just put the value as
    BlogDir[1]=.

    and that should do it for you!

    That’ll just tell the script to run out of the current directory.

  11. Eric on May 20th, 2007 5:53 pm

    Brilliant, thanks! I hate updating WP, but was able to update 7 blogs today using the script. Seems to have worked like a charm.

  12. Joe on May 20th, 2007 9:15 pm

    What? I thought I sent you the email. Well. That would explain a few things. Let me find where I put it. :D

  13. Joe on May 20th, 2007 10:10 pm
  14. James Joyner on May 23rd, 2007 12:19 pm

    This looks really cool but I don’t really understand step 4.

    I’m supposed to enter a me-relevant version of

    BlogDir[1]=’site1dir’
    BlogURL[1]=’www.example.com’

    BlogDir[2]=’site2/news’
    BlogURL[2]=’www.site2.com/news’

    BlogDir[3]=’wordpress’
    BlogURL[3]=’blog.site3.com’

    ?

  15. Aaron Brazell on May 23rd, 2007 12:30 pm

    James,

    If you have 2 blogs to upgrade, one in your website root and the second in a folder under your website root called sports, for instance, you’d run the script from your website root and do:


    BlogDir[1]='.'
    BlogURL[1]='www.outsidethebeltway.com'

    BlogDir[2]='sports'
    BlogURL[2]='www.outsidethebetlway.com/sports'

    Similar to that anyway. I’m assuming some information on what you’re hoping to upgrade, but that’s what I’d venture.

  16. Rod on May 23rd, 2007 6:01 pm

    Brian – thanks very much for this script. I’ve got two separate blogs on my server, and while the main one was current (2.2), the other was on 2.1.3. Until I tried the script, and after a little tweaking, it upgraded perfectly. Now I’ve got both configured for the next upgrade. Very much appreciated.

  17. Rod on May 25th, 2007 12:14 pm

    I was wondering if it’s necessary to disable all of the installed plugins before running the script? I did on the first upgrade I ran with the script, but if it’s not necessary, I’ll skip it the next time I run it.

  18. Brian on May 25th, 2007 1:07 pm

    No, it is not. That is something that 2.0 gave us. The plugin API eliminates most of the need. There is a SMALL chance that a plugin would be completely inoperable and stop an upgraded site, but on the very rare event that happens, you can go into PHP my admin to the options table, sort by option name and delete the the option value for “ActivePlugins” which should be at the top of the list. I asked the members of WP-Hackers and WP-Testers if they deactivated plugins before upgrading and every one that replied said they never did. Not one person spoke up for de-activating the plugins.

  19. Rod on May 25th, 2007 4:00 pm

    Cool. Definitely a good thing to keep in mind. Thanks again.

  20. Joe on May 25th, 2007 8:26 pm

    @Brian – Yeah, I agree.
    Also, did you get the link?

  21. Joe on July 7th, 2007 4:22 pm

    Bug…

  22. Rod Templeton on October 25th, 2007 9:43 pm

    Brian,

    Any chance that this script might be tweaked for the 2.3 version of WordPress?

  23. Les on October 27th, 2007 4:28 am

    Rod – the script works for 2.3.x.

    Well, it didn’t break anything for me, anyway.

  24. Brian on October 30th, 2007 1:16 am

    Yep, it is tested and working well.

    Now that I know a good bit more about scripting than I ever had before, I will be doing an update of this script.

    The WordPress installation process has come a ways, but because this script does the whole procedure of backing up both files AND database, it still has place.

    I get a lot of comfort out of knowing that all of my sites are backed up and cleaned on a regular basis.

  25. Kevin on October 30th, 2007 10:05 am

    Brian – keep up the good work with this script. At last count I’m using your script to keep 26 sites current. To say the least, I am deeply grateful for your script. Thank you.

  26. Rod on October 30th, 2007 12:27 pm

    Weird. I get the following error :

    cp: cannot open `/home/rod/public_html/wp-content/rtdn-backup/2007-09-25-08-20-34-full.tar.gz’ for reading: Permission denied

    This started with the upgrade to 2.3, and while that .gz file exists, I cannot change its mode (currently 600) or delete it. Permission denied to do either.

  27. Rod on October 30th, 2007 2:45 pm

    Actually it appears to have been a permission issue on my server. Not something I’d changed, but with the permissions set the correct way, the script runs fine again.

  28. steve on March 10th, 2008 1:34 pm

    Say, does 1and1 support fantastico and PHPmyadmin?

  29. Brian on March 13th, 2008 3:34 pm

    It supports phpmyadmin. It comes with it but I have my own preferred flavor installed.
    Fantastico I think requires cPanel which 1and1 doesn’t run. So I think the answer is no.

  30. steve on March 15th, 2008 9:22 pm

    Okay, phpmyadmin was my main worry anyway.
    Thanks!

  31. Chris Wadge on September 10th, 2008 2:29 am

    Hello again! Just a suggestion, but you might consider calling each CPU-intensive activity with nice, and giving the user the option to set the value. It’s not particularly useful on a single-site host, but on a shared box it would be quite appropriate I think. Something like this perhaps:

    NiceValue=”10″

    (nice -n $NiceValue tar –no-recursion -zcf “$BackupDir/$BackupTarballName” . –recursion $SubDirs)

Got something to say?





Who is Brian Layman

I am a WordPress expert living in North East Ohio. I am part of the ever expanding Open Source Internet workforce. I am able to stay at home, with my wife and four home schooled kids, while working as the Senior Developer for b5media - a blogging network that has hosted over 300+

I co-host the NEO WordPress Monthly meetup. I am the board chair of our local church. I host and have provided development services for clients such TV personalities Rhett and Link as well as corporations such as Borland International.

In my spare time I try to sneak out, canoe, mountain bike and camp as often as I can. Sometimes I also defend the earth against zombies and aliens, but usually not during the camping trips.

Services Provided

In providing hosting, email, theme and plugin development to my clients, I function as a single point of contact answering to the needs of their expanding sites.

My service portfolio includes but is not limited to WordPress hosting, optimization, theme development and custom plugin creation. Community creation via vBulletin, Ning and BuddyPress and bbpress

I also am well experienced in site conversion, transition and merges. To clarify this, website technologies change and giving up your data is not an option. I have transitioned literally hundreds of sites from one platform to another.

viagra 50 mg indian version of viagra cialis cheapest viagra india online viagra cost comparison viagra for sale without prescription generic tadalafil online buy viagra in korea indian levitra discount cialis online viagra prescription over the counter vardenafil cialis otc cialis no rx cialis 30 mg viagra ranbaxy buy levitra in uk cialis low price tadalafil tablets 10mg cheap viagra fast shipping cheap generic levitra cialis discount cialis 5mg viagra discount prices buy levitra without prescription vardenafil online generic levitra canada viagra professional price cheapest sildenafil citrate indian version of cialis viagra lowest price viagra online prescriptions tadalafil 10mg levitra over the counter levitra prescriptions online buy viagra without a prescription liquid tadalafil citrate buy viagra prescription online tadalafil 20mg india india viagra generic sildenafil citrate for sale vardenafil hcl 10mg cialis discount coupon buy levitra australia viagra over the counter in canada liquid sildenafil tadalafil price comparison viagra cost in india cialis mail order sildenafil sales buy vardenafil cialis offer cheap vardenafil generic cialis no prescription viagra tabs generic indian names viagra price canada vardenafil hcl 20 mg generic viagra without prescription viagra by scilla biotechnologies buy generic cialis free viagra viagra over the counter viagra pills kamagra 100 mg cialis from india tadalafil australia tadalafil 20mg tablets tadalafil soft tabs sildenafil pills viagra no prescription required generic viagra paypal tadalafil online indian viagra cost tadalafil online pharmacy generic soft viagra sildenafil soft tablets viagra generic names buy viagra in ireland levitra without prescription levitra online purchase cialis pill indian tadalafil levitra 5mg cialis cost per pill tadalafil oral jelly sildenafil no prescription vardenafil price generic cialis 10mg cheap cialis no prescription order sildenafil citrate indian generic viagra blue viagra buy cialis usa apcalis 20mg tablets viagra overnight delivery sildenafil india purchase viagra without a prescription viagra prescriptions order viagra without prescription viagra with no prescription levitra for sale purchase viagra canada discount levitra viagra 200mg cheap viagra 100mg cialis overnight delivery buy sildenafil online viagra made in india cialis tabs 10mg viagra indian pharmacy viagra for sale in ireland viagra uk prices buy viagra in europe generic cialis india levitra online viagra for sale india buy viagra in dublin generic cialis soft tabs viagra 50mg cost generic sildenafil 100mg tadalafil generic viagra super active 100 mg kamagra 100mg sildenafil 100 mg tablets cialis no prescription viagra low price online cialis suhagra tablets buy cialis daily use tadalafil sample cialis prices viagra prescription online buy cialis pill kamagra from india cialis online levitra mg vigora india vardenafil 10 mg sildenafil citrate 100mg buy viagra in india buy cialis professional viagra in india buy viagra in singapore generic revatio viagra substitutes sildenafil canada viagra no script cheap kamagra viagra retail price cheap lovegra order viagra uk buy cialis in mexico viagra prescription price purchase cialis online without prescription online cialis prescription ranbaxy caverta buy viagra in hong kong sildenafil price cialis mastercard buy viagra in england viagra mail order canada cialis tablets for sale order cialis cialis soft tabs generic levitra india tadalafil prices cheap sildenafil citrate tablets cialis online prescriptions cialis 5 mg daily levitra prices prescriptions viagra viagra over the counter alternative cialis 20 mg tablets cialis generic india cialis prescribing cialis 20mg daily sildenafil 50 mg viagra drug prices tadalafil generic india cialis sale viagra prices buy viagra 50 mg levitra pharmacy buy viagra generic viagra prescription drug cialis daily cost vardenafil uk viagra soft tabs online buy viagra super active cialis 10mg price 25mg viagra silagra 100mg online viagra prescriptions cialis prescription cheap cialis india revatio 20 mg indian equivalent of viagra tadalafil india viagra capsules cheapest viagra buy cialis without prescription tadalafil overnight cheap tadalafil online purchase viagra online no prescription