(bug 19590) Database error messages are no longer hardcoded to use "MySQL".
authorAlex Z <mrzman@users.mediawiki.org>
Thu, 16 Jul 2009 15:18:57 +0000 (15:18 +0000)
committerAlex Z <mrzman@users.mediawiki.org>
Thu, 16 Jul 2009 15:18:57 +0000 (15:18 +0000)
Added a new function DatabaseBase::getDBtype() to get the DB type for messages, updated all subclasses.
Message change needs propagating.

RELEASE-NOTES
includes/db/Database.php
includes/db/DatabaseIbm_db2.php
includes/db/DatabaseMssql.php
includes/db/DatabaseMysql.php
includes/db/DatabaseOracle.php
includes/db/DatabasePostgres.php
includes/db/DatabaseSqlite.php
languages/messages/MessagesEn.php

index 1b65c01..703de6d 100644 (file)
@@ -276,6 +276,8 @@ this. Was used when mwEmbed was going to be an extension.
 * (bug 19513) RTL fixes for new Search UI
 * (bug 16497) Special:Allmessages is paginated
 * (bug 18708) CSS plainlinks class now available to all skins
+* (bug 19590) Database error messages no longer have "MySQL" hardcoded as the 
+  database type
 
 == API changes in 1.16 ==
 
index 25a340c..ac4fd69 100644 (file)
@@ -1952,6 +1952,17 @@ abstract class DatabaseBase {
                return '(no software link given)';
        }
 
+       /**
+        * Returns the database type for user-visible purposes
+        * e.g. DB error messages
+        * Other uses should just use $wgDBtype
+        *
+        * @return String: Database name for messages
+       */
+       function getDBtype() {
+               return 'Database';
+       }
+
        /**
         * A string describing the current software version, like from
         * mysql_get_server_info().  Will be listed on Special:Version, etc.
@@ -2548,7 +2559,8 @@ class DBQueryError extends DBError {
        function getText() {
                if ( $this->useMessageCache() ) {
                        return wfMsg( 'dberrortextcl', htmlspecialchars( $this->getSQL() ),
-                         htmlspecialchars( $this->fname ), $this->errno, htmlspecialchars( $this->error ) ) . "\n";
+                         htmlspecialchars( $this->fname ), $this->errno, htmlspecialchars( $this->error ),
+                         htmlspecialchars( $this->db->getDBtype() ) ) . "\n";
                } else {
                        return $this->getMessage();
                }
@@ -2575,7 +2587,8 @@ class DBQueryError extends DBError {
        function getHTML() {
                if ( $this->useMessageCache() ) {
                        return wfMsgNoDB( 'dberrortext', htmlspecialchars( $this->getSQL() ),
-                         htmlspecialchars( $this->fname ), $this->errno, htmlspecialchars( $this->error ) );
+                         htmlspecialchars( $this->fname ), $this->errno, htmlspecialchars( $this->error ),
+                         htmlspecialchars( $this->db->getDBtype() ) );
                } else {
                        return nl2br( htmlspecialchars( $this->getMessage() ) );
                }
index f561860..c750b28 100644 (file)
@@ -1453,6 +1453,13 @@ EOF;
                return "[http://www.ibm.com/software/data/db2/express/?s_cmp=ECDDWW01&s_tact=MediaWiki IBM DB2]";
        }
        
+       /**
+        * @return String: Database name for messages
+       */
+       function getDBtype() {
+               return 'IBM DB2';
+       }
+
        ###
        # Fix search crash
        ###
index eef2033..0953088 100644 (file)
@@ -899,6 +899,13 @@ class DatabaseMssql extends DatabaseBase {
                return "[http://www.microsoft.com/sql/default.mspx Microsoft SQL Server 2005 Home]";
        }
 
+       /**
+        * @return String: Database name for messages
+       */
+       function getDBtype() {
+               return 'Microsoft SQL Server';
+       }
+
        /**
         * @return string Version information from the database
         */
index 83a7bc5..28ca5a3 100644 (file)
@@ -289,6 +289,13 @@ class DatabaseMysql extends DatabaseBase {
                return '[http://www.mysql.com/ MySQL]';
        }
 
+       /**
+        * @return String: Database name for messages
+       */
+       function getDBtype() {
+               return 'MySQL';
+       }
+
        public function setTimeout( $timeout ) {
                $this->query( "SET net_read_timeout=$timeout" );
                $this->query( "SET net_write_timeout=$timeout" );
index 634a68a..69d406c 100644 (file)
@@ -742,6 +742,13 @@ class DatabaseOracle extends DatabaseBase {
                return oci_server_version($this->mConn);
        }
 
+       /**
+        * @return String: Database name for messages
+       */
+       function getDBtype() {
+               return 'Oracle';
+       }
+
        /**
         * Query whether a given table exists (in the given schema, or the default mw one if not given)
         */
index 25649e4..09c7bd3 100644 (file)
@@ -1047,6 +1047,13 @@ class DatabasePostgres extends DatabaseBase {
                return "[http://www.postgresql.org/ PostgreSQL]";
        }
 
+       /**
+        * @return String: Database name for messages
+       */
+       function getDBtype() {
+               return 'PostgreSQL';
+       }
+
        /**
         * @return string Version information from the database
         */
index 93b0b44..014bef2 100644 (file)
@@ -287,6 +287,13 @@ class DatabaseSqlite extends DatabaseBase {
                return "[http://sqlite.org/ SQLite]";
        }
 
+       /**
+        * @return String: Database name for messages
+       */
+       function getDBtype() {
+               return 'SQLite';
+       }
+
        /**
         * @return string Version information from the database
         */
index 984fb79..0920576 100644 (file)
@@ -947,12 +947,12 @@ This may indicate a bug in the software.
 The last attempted database query was:
 <blockquote><tt>$1</tt></blockquote>
 from within function "<tt>$2</tt>".
-MySQL returned error "<tt>$3: $4</tt>".',
+$5 returned error "<tt>$3: $4</tt>".',
 'dberrortextcl'        => 'A database query syntax error has occurred.
 The last attempted database query was:
 "$1"
 from within function "$2".
-MySQL returned error "$3: $4"',
+$5 returned error "$3: $4"',
 'laggedslavemode'      => "'''Warning:''' Page may not contain recent updates.",
 'readonly'             => 'Database locked',
 'enterlockreason'      => 'Enter a reason for the lock, including an estimate of when the lock will be released',