Followup to r53358 - Tweak the function name to be a little clearer as to what it...
authorAlex Z <mrzman@users.mediawiki.org>
Thu, 16 Jul 2009 16:49:09 +0000 (16:49 +0000)
committerAlex Z <mrzman@users.mediawiki.org>
Thu, 16 Jul 2009 16:49:09 +0000 (16:49 +0000)
Also make it abstract in DatabaseBase so all subclasses have to implement some human readable name
(also make getSoftwareLink abstract for the same reason) Every current Database class already implements both.

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

index ac4fd69..b05a6a9 100644 (file)
@@ -1943,25 +1943,21 @@ abstract class DatabaseBase {
        /**
         * Returns a wikitext link to the DB's website, e.g.,
         *     return "[http://www.mysql.com/ MySQL]";
-        * Should probably be overridden to at least contain plain text, if for
-        * some reason your database has no website.
+        * Should at least contain plain text, if for some reason
+        * your database has no website.
         *
         * @return String: wikitext of a link to the server software's web site
         */
-       function getSoftwareLink() {
-               return '(no software link given)';
-       }
+       abstract function getSoftwareLink();
 
        /**
         * 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
+        * @return String: Database type for use in messages
        */
-       function getDBtype() {
-               return 'Database';
-       }
+       abstract function getDBtypeForMsg();
 
        /**
         * A string describing the current software version, like from
@@ -2560,7 +2556,7 @@ class DBQueryError extends DBError {
                if ( $this->useMessageCache() ) {
                        return wfMsg( 'dberrortextcl', htmlspecialchars( $this->getSQL() ),
                          htmlspecialchars( $this->fname ), $this->errno, htmlspecialchars( $this->error ),
-                         htmlspecialchars( $this->db->getDBtype() ) ) . "\n";
+                         htmlspecialchars( $this->db->getDBtypeForMsg() ) ) . "\n";
                } else {
                        return $this->getMessage();
                }
@@ -2588,7 +2584,7 @@ class DBQueryError extends DBError {
                if ( $this->useMessageCache() ) {
                        return wfMsgNoDB( 'dberrortext', htmlspecialchars( $this->getSQL() ),
                          htmlspecialchars( $this->fname ), $this->errno, htmlspecialchars( $this->error ),
-                         htmlspecialchars( $this->db->getDBtype() ) );
+                         htmlspecialchars( $this->db->getDBtypeForMsg() ) );
                } else {
                        return nl2br( htmlspecialchars( $this->getMessage() ) );
                }
index c750b28..aa0e7a5 100644 (file)
@@ -1454,9 +1454,9 @@ EOF;
        }
        
        /**
-        * @return String: Database name for messages
+        * @return String: Database type for use in messages
        */
-       function getDBtype() {
+       function getDBtypeForMsg() {
                return 'IBM DB2';
        }
 
index 0953088..acd1188 100644 (file)
@@ -900,9 +900,9 @@ class DatabaseMssql extends DatabaseBase {
        }
 
        /**
-        * @return String: Database name for messages
+        * @return String: Database type for use in messages
        */
-       function getDBtype() {
+       function getDBtypeForMsg() {
                return 'Microsoft SQL Server';
        }
 
index 28ca5a3..31de630 100644 (file)
@@ -290,9 +290,9 @@ class DatabaseMysql extends DatabaseBase {
        }
 
        /**
-        * @return String: Database name for messages
+        * @return String: Database type for use in messages
        */
-       function getDBtype() {
+       function getDBtypeForMsg() {
                return 'MySQL';
        }
 
index 69d406c..351c591 100644 (file)
@@ -735,6 +735,13 @@ class DatabaseOracle extends DatabaseBase {
                return "[http://www.oracle.com/ Oracle]";
        }
 
+       /**
+        * @return String: Database type for use in messages
+       */
+       function getDBtypeForMsg() {
+               return 'Oracle';
+       }
+
        /**
         * @return string Version information from the database
         */
@@ -742,13 +749,6 @@ 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 09c7bd3..a485a66 100644 (file)
@@ -1048,9 +1048,9 @@ class DatabasePostgres extends DatabaseBase {
        }
 
        /**
-        * @return String: Database name for messages
+        * @return String: Database type for use in messages
        */
-       function getDBtype() {
+       function getDBtypeForMsg() {
                return 'PostgreSQL';
        }
 
index 014bef2..85f0b08 100644 (file)
@@ -288,9 +288,9 @@ class DatabaseSqlite extends DatabaseBase {
        }
 
        /**
-        * @return String: Database name for messages
+        * @return String: Database type for use in messages
        */
-       function getDBtype() {
+       function getDBtypeForMsg() {
                return 'SQLite';
        }