r14630 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14629‎ | r14630 | r14631 >
Date:04:17, 7 June 2006
Author:tstarling
Status:old
Tags:
Comment:
removed obsolete function
Modified paths:
  • /trunk/phase3/includes/Database.php (modified) (history)
  • /trunk/phase3/includes/LoadBalancer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LoadBalancer.php
@@ -469,7 +469,7 @@
470470 $conn->reportConnectionError( $this->mLastError );
471471 } else {
472472 // If all servers were busy, mLastError will contain something sensible
473 - wfEmergencyAbort( $conn, $this->mLastError );
 473+ throw new DBConnectionError( $conn, $this->mLastError );
474474 }
475475 } else {
476476 if ( $this->mFailFunction ) {
Index: trunk/phase3/includes/Database.php
@@ -2013,106 +2013,4 @@
20142014
20152015 }
20162016
2017 -
2018 -#------------------------------------------------------------------------------
2019 -# Global functions
2020 -#------------------------------------------------------------------------------
2021 -
2022 -/**
2023 - * Standard fail function, called by default when a connection cannot be
2024 - * established.
2025 - * Displays the file cache if possible
2026 - */
2027 -function wfEmergencyAbort( &$conn, $error ) {
2028 - global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding, $wgOutputEncoding;
2029 - global $wgSitename, $wgServer, $wgMessageCache, $wgLogo;
2030 -
2031 - # I give up, Brion is right. Getting the message cache to work when there is no DB is tricky.
2032 - # Hard coding strings instead.
2033 -
2034 - $noconnect = "<h1><img src='$wgLogo' style='float:left;margin-right:1em' alt=''>$wgSitename has a problem</h1><p><strong>Sorry! This site is experiencing technical difficulties.</strong></p><p>Try waiting a few minutes and reloading.</p><p><small>(Can't contact the database server: $1)</small></p>";
2035 - $mainpage = 'Main Page';
2036 - $searchdisabled = <<<EOT
2037 -<p style="margin: 1.5em 2em 1em">$wgSitename search is disabled for performance reasons. You can search via Google in the meantime.
2038 -<span style="font-size: 89%; display: block; margin-left: .2em">Note that their indexes of $wgSitename content may be out of date.</span></p>',
2039 -EOT;
2040 -
2041 - $googlesearch = "
2042 -<!-- SiteSearch Google -->
2043 -<FORM method=GET action=\"http://www.google.com/search\">
2044 -<TABLE bgcolor=\"#FFFFFF\"><tr><td>
2045 -<A HREF=\"http://www.google.com/\">
2046 -<IMG SRC=\"http://www.google.com/logos/Logo_40wht.gif\"
2047 -border=\"0\" ALT=\"Google\"></A>
2048 -</td>
2049 -<td>
2050 -<INPUT TYPE=text name=q size=31 maxlength=255 value=\"$1\">
2051 -<INPUT type=submit name=btnG VALUE=\"Google Search\">
2052 -<font size=-1>
2053 -<input type=hidden name=domains value=\"$wgServer\"><br /><input type=radio name=sitesearch value=\"\"> WWW <input type=radio name=sitesearch value=\"$wgServer\" checked> $wgServer <br />
2054 -<input type='hidden' name='ie' value='$2'>
2055 -<input type='hidden' name='oe' value='$2'>
2056 -</font>
2057 -</td></tr></TABLE>
2058 -</FORM>
2059 -<!-- SiteSearch Google -->";
2060 - $cachederror = "The following is a cached copy of the requested page, and may not be up to date. ";
2061 -
2062 -
2063 - if( !headers_sent() ) {
2064 - header( 'HTTP/1.0 500 Internal Server Error' );
2065 - header( 'Content-type: text/html; charset='.$wgOutputEncoding );
2066 - /* Don't cache error pages! They cause no end of trouble... */
2067 - header( 'Cache-control: none' );
2068 - header( 'Pragma: nocache' );
2069 - }
2070 -
2071 - # No database access
2072 - if ( is_object( $wgMessageCache ) ) {
2073 - $wgMessageCache->disable();
2074 - }
2075 -
2076 - if ( trim( $error ) == '' ) {
2077 - $error = $this->mServer;
2078 - }
2079 -
2080 - wfLogDBError( "Connection error: $error\n" );
2081 -
2082 - $text = str_replace( '$1', $error, $noconnect );
2083 - $text .= wfGetSiteNotice();
2084 -
2085 - if($wgUseFileCache) {
2086 - if($wgTitle) {
2087 - $t =& $wgTitle;
2088 - } else {
2089 - if($title) {
2090 - $t = Title::newFromURL( $title );
2091 - } elseif (@/**/$_REQUEST['search']) {
2092 - $search = $_REQUEST['search'];
2093 - echo $searchdisabled;
2094 - echo str_replace( array( '$1', '$2' ), array( htmlspecialchars( $search ),
2095 - $wgInputEncoding ), $googlesearch );
2096 - wfErrorExit();
2097 - } else {
2098 - $t = Title::newFromText( $mainpage );
2099 - }
2100 - }
2101 -
2102 - $cache = new CacheManager( $t );
2103 - if( $cache->isFileCached() ) {
2104 - $msg = '<p style="color: red"><b>'.$msg."<br />\n" .
2105 - $cachederror . "</b></p>\n";
2106 -
2107 - $tag = '<div id="article">';
2108 - $text = str_replace(
2109 - $tag,
2110 - $tag . $msg,
2111 - $cache->fetchPageText() );
2112 - }
2113 - }
2114 -
2115 - echo $text;
2116 - wfErrorExit();
2117 -}
2118 -
21192017 ?>

Status & tagging log