Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Redirect Incase of mySQL problem Details »»
Redirect Incase of mySQL problem
Version: 1.00, by Harley77 Harley77 is offline
Developer Last Online: Jan 2011 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 03-17-2005 Last Update: Never Installs: 16
 
No support by the author.

If someone has posted something like this before, I couldn't find it.

What this does:
It will redirect visitors to a static webpage of your choosing incase a connection to the mySQL server could not be established.

Every so often, The SQL server of our host becomes unresponsive, usually only for a few minutes, but, it's still annoying to try and load the site and have it take forver then be finally be greeted with a lovely SQL error. So, now people can get a nice friendly error page instead.

Feel free to modify and mess with it however you choose.


UPDATED


Trigunflame has provided a more elegant, sitewide solution that effectivly does the same exact thing.


Installation:

1. open includes/db_mysql.php
2. find the code below in the connect() function

Code:
if (!$this->link_id)
		{
			$this->halt('Link-ID == false, connect failed');
			return false;
		}
3. Replace that with

Code:
// Redirect For SQL Server Down
		if (!$this->link_id)
		{
			$url = 'http://narutotalk.org/';
			header ("Location: $url");
		}

Just replace the url with where ever you want it to goto.

I'm leaving the original file availible to download as it might be useful for other administrative purposes.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 03-19-2005, 01:16 AM
Polo's Avatar
Polo Polo is offline
 
Join Date: Jun 2004
Posts: 893
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was looking for something like this... thanks for sharing
Reply With Quote
  #3  
Old 03-19-2005, 05:06 AM
Deaths Deaths is offline
 
Join Date: Oct 2004
Location: Europe, Belgium
Posts: 679
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very nice, this is very usefull.
Reply With Quote
  #4  
Old 03-19-2005, 05:09 AM
Tekton Tekton is offline
 
Join Date: Jun 2004
Location: Wisconsin
Posts: 362
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It doesn't take a good coder to make a great mod
Reply With Quote
  #5  
Old 03-19-2005, 01:13 PM
Harley77 Harley77 is offline
 
Join Date: Jul 2002
Location: Minnesota
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you very much.

One other note, if someone want's it, its not hard to modify the testcon.php file to take the database login settings from your vb config file. I just did it this way for flexibility and make it easier to test without causing site wide dissruption.
Reply With Quote
  #6  
Old 03-19-2005, 02:16 PM
Deaths Deaths is offline
 
Join Date: Oct 2004
Location: Europe, Belgium
Posts: 679
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Harley77
Thank you very much.

One other note, if someone want's it, its not hard to modify the testcon.php file to take the database login settings from your vb config file. I just did it this way for flexibility and make it easier to test without causing site wide dissruption.
I'm 99% sure this should so it, haven't tested though.
Reply With Quote
  #7  
Old 03-20-2005, 02:54 AM
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Posts: 742
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A better solution that will work on any page.

1. open includes/db_mysql.php
2. find the code below in the connect() function
Code:
		if (!$this->link_id)
		{
			$this->halt('Link-ID == false, connect failed');
			return false;
		}
3. Replace that with
Code:
		// Redirect For SQL Server Down
		if (!$this->link_id)
		{
			$url = 'http://narutotalk.org/';
			header ("Location: $url");
		}
This will redirect users on any page, if the the DB connection could not be established.

All of the methods in the above posts's are redundant as they are trying to establish a "second" db connection. All that is going to do is slow down your pages on every load, and increase your mysql load by increasing its connections.
Reply With Quote
  #8  
Old 03-21-2005, 12:36 PM
Harley77 Harley77 is offline
 
Join Date: Jul 2002
Location: Minnesota
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah ha! new there was a better way. Curious though, would this method redirect on any kind of SQL issue such as conneciton limit reached (server side, not though VB), or any other failure to connect to the server and not just on an outright connection failure?
Reply With Quote
  #9  
Old 03-21-2005, 02:22 PM
Deaths Deaths is offline
 
Join Date: Oct 2004
Location: Europe, Belgium
Posts: 679
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My method, or his?
Reply With Quote
  #10  
Old 03-21-2005, 02:38 PM
Harley77 Harley77 is offline
 
Join Date: Jul 2002
Location: Minnesota
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

His, Just wasn't sure what all errors it covered. I know that the method I put up pretty much covered all the bases incase of any kind of issue, just wasn't sure if the same was true with Trigunflames.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:32 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04606 seconds
  • Memory Usage 2,290KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete