Hey all,

I'm new to doing this, so please bear with me. :)

I'm one of those people who can mess with PHP enough to be scary.  I can make 
things work, but they probably don't work in the *best* manner possible.  
That's why I generally have a lot of ideas for WordPress, but am pretty 
terrified of contributing (except some advice on the forums, occasionally), 
because I'm afraid if I submit something, I'll bring the whole system crashing 
down.  It'll be the WordPress Apocalypse or something, and the survivors will 
come to eat my brain.

But this, I felt was worthy enough to at least run by you all.

So I belong to another list of web developers - not a lot of them really know 
WordPress, but they are finally getting into it.  One of them posed a question 
this morning, and it's actually a common problem I've seen.  It's not 
WordPress' *fault*, but what I suggested to her might allow WordPress to *help* 
- I think it's an idea for consideration, anyway.  

Her issue was that her host had some server fixin' going on, and broke the 
connection to the database.  It's intermittently connecting, so the site is 
doing this "Here's my pretty WP site!" to "OMG! I'm down in flames!" dance 
every few minutes.  So she was wondering if there was a way to simply check if 
the connection was fine - if so, move on to WordPress, and if not, redirect to 
a "safety" folder in the site that would display some HTML (so the site 
wouldn't suffer from all kinds of headache-inducing activity).

I suggested adding the following to her WordPress index.php file (the WP site 
is at the root), just after the call to require the wp-blog-header.php file:

// grab the login info from the wp-config.php file and check connection
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
          if (!$link) {
                // if no connection,  redirect to HTML backup folder
                header('Location: http://www.whateversite.com/backup/);
          } 
          mysql_close($link);

Anyway, a couple of people chimed up and said it might be worth letting *you* 
all know about this to see if it was worthy of making it part of core someday.  
Or some kind of optional thing if people want to have it.  I dunno.

Like I said, I'm not an expert on the core end of WordPress, and servers not 
connecting to the DB aren't really WordPress' fault, (and there's probably 
better ways of accomplishing this) but it seems like it would be a really 
useful thing to offer.  You all can take it or leave it.  (Just be gentle - 
it's my first time!) :)

~Shelly


_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers

Reply via email to