[wp-testers] Upgrade your WP sites in 5 Seconds

Brian Layman Brian at TheCodeCave.com
Fri Jan 5 23:21:23 GMT 2007


>Took life in hands[1] and gave it a try.
I love a story with a happy ending!  I've had 32 downloads of the scripts
and no one has cried foul yet. Not a single site gone up in smoke, so far.
There hasn't even been an infinite loop of backups being made!  It seems I
can breath a bit easier.  I do appreciate you all taking a look at this.
This REALLY helps my peace of mind...  Especially since you have the sense
to do stuff like "[1] OK, I backed up manually and downloaded the backup
first :)"

Throughout the script I tried to make logical choices of when to do stuff
and when to roll back.  For instance, I download the files first, and only
start the backups when the download is successful.  If I can't back up
EVERYTHING I stop and remove the downloaded and uncompressed files, and then
I remove the partial backups.  Only when those steps are completed
successfully (I do need to do some further checking on the cp commands.
That comes next.), do I start the updates.  So, I think it all flows...

I've never done any bash before; so it takes a bit of time to figure out the
syntax.  I keep on doing stuff like $var1."-".$var2 instead of just writing
$var1-$var2, then spending 10 minutes figuring out why it doesn't work
right.  Echoing that is no help!  

I am working on the SQL backup right now.  The process I want to do is this
(in a loop of the blog dirs):
1. Parse the wp-config for the database name line with grep
2. Use SED to parse that output and return ONLY the password (AWK won't work
because what if there are spaces in the pwd...)
3. Repeat that process for the other db connection variables and the prefix
4. Run a query like "show tables like '$pfx%'" and toss that info out to a
file
5. Process each line of that file (SED again?) and use SQLDump to send all
of tables related to your specific blog out to one gziped file.  That way if
you run a bunch of programs out of the one database you get only the
appropriate tables AND you don't get the whole DB copied over and over again
for each wp-config file that points to that DB.

Anyone who knows SED and RegEx better than I do is more than welcome to make
suggestions :)  I'll post on this on my blog so we don't distract from WP
specific testing.  But I needed to say thanks to everyone.  I think this
will be an important tool to have.  The idea is that the average Joe with 1
or 2 blogs can download this script once, edit it once (which as Les pointed
out does take more than 5 seconds), and from then on, for every point
release, spend seconds for them to update their site.  Updating a point
release safely should not be a painful process.  We have loads of people out
there running 2.0 because they didn't take the time to figure out how to
safely do the upgrade!  With the improvements of the 2.0 platform, there's
no reason to be in that world any more.  I want to give people a way that
they can safely take 5 minutes of "update day" to login via telnet, run the
script and then be on the latest version with good backups.  

My wife is fairly technically literate, but making proper a SQL backup,
making the file backups, doing the download, sending it from the windows
machine to the server, and then following the update steps, is just beyond
her and so many others.  I think this is a process she could follow.  It
would take here a bit to do this the first time, but from then on she
wouldn't have to touch the script ever again.

Anyway, that's the idea....  Thanks for the help.

_______________________________________________
Brian Layman
www.TheCodeCave.com
 




More information about the wp-testers mailing list