From bc1b8182e99af0745d5d3aba1827161fda6396a7 Mon Sep 17 00:00:00 2001 From: Alex Z Date: Thu, 16 Jul 2009 16:49:09 +0000 Subject: [PATCH] Followup to r53358 - Tweak the function name to be a little clearer as to what it does 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 | 18 +++++++----------- includes/db/DatabaseIbm_db2.php | 4 ++-- includes/db/DatabaseMssql.php | 4 ++-- includes/db/DatabaseMysql.php | 4 ++-- includes/db/DatabaseOracle.php | 14 +++++++------- includes/db/DatabasePostgres.php | 4 ++-- includes/db/DatabaseSqlite.php | 4 ++-- 7 files changed, 24 insertions(+), 28 deletions(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index ac4fd696e0..b05a6a99bf 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -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() ) ); } diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index c750b28c17..aa0e7a5dc2 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -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'; } diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index 0953088ae7..acd1188bdb 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -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'; } diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index 28ca5a3e79..31de6309c7 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -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'; } diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 69d406c2fa..351c591d8d 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -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) */ diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index 09c7bd3b29..a485a66c38 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -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'; } diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 014bef21e7..85f0b08d82 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -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'; } -- 2.20.1