[wp-testers] Suggestion for a future release, maybe?
Arlen Beiler
arlenbee at gmail.com
Wed Jun 23 14:22:26 UTC 2010
You could do that, or you could stick the code right under the database
settings in wp-config.php. I think it would take less cpu if you would do it
like this, I don't know.
This code works for me, notice the break.
// 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://example.com/');
}
mysql_close($link);
*break; *//this is essential
On Wed, Jun 23, 2010 at 10:15 AM, Philip M. Hofer (Frumph) <
philip at frumph.net> wrote:
>
> http://www.google.com/#hl=en&source=hp&q=wordpress+db-error.php&aq=f&aqi=g1&aql=&oq=&gs_rfai=&fp=45835207582d5ee7
>
> wordpress already has a db-error.php file you can add to wordpress as a
> customizable splash page.
>
>
> ----- Original Message ----- From: "Foolish Visions" <
> shelly at foolishvisions.com>
> To: <wp-testers at lists.automattic.com>
> Sent: Wednesday, June 23, 2010 7:06 AM
> Subject: [wp-testers] Suggestion for a future release, maybe?
>
>
>
> 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
>> wp-testers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-testers
>>
>>
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>
More information about the wp-testers
mailing list