r53365 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53364‎ | r53365 | r53366 >
Date:16:49, 16 July 2009
Author:mrzman
Status:reverted (Comments)
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseIbm_db2.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMssql.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMysql.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseSqlite.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseMysql.php
@@ -290,9 +290,9 @@
291291 }
292292
293293 /**
294 - * @return String: Database name for messages
 294+ * @return String: Database type for use in messages
295295 */
296 - function getDBtype() {
 296+ function getDBtypeForMsg() {
297297 return 'MySQL';
298298 }
299299
Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -736,6 +736,13 @@
737737 }
738738
739739 /**
 740+ * @return String: Database type for use in messages
 741+ */
 742+ function getDBtypeForMsg() {
 743+ return 'Oracle';
 744+ }
 745+
 746+ /**
740747 * @return string Version information from the database
741748 */
742749 function getServerVersion() {
@@ -743,13 +750,6 @@
744751 }
745752
746753 /**
747 - * @return String: Database name for messages
748 - */
749 - function getDBtype() {
750 - return 'Oracle';
751 - }
752 -
753 - /**
754754 * Query whether a given table exists (in the given schema, or the default mw one if not given)
755755 */
756756 function tableExists($table) {
Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -1048,9 +1048,9 @@
10491049 }
10501050
10511051 /**
1052 - * @return String: Database name for messages
 1052+ * @return String: Database type for use in messages
10531053 */
1054 - function getDBtype() {
 1054+ function getDBtypeForMsg() {
10551055 return 'PostgreSQL';
10561056 }
10571057
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php
@@ -1454,9 +1454,9 @@
14551455 }
14561456
14571457 /**
1458 - * @return String: Database name for messages
 1458+ * @return String: Database type for use in messages
14591459 */
1460 - function getDBtype() {
 1460+ function getDBtypeForMsg() {
14611461 return 'IBM DB2';
14621462 }
14631463
Index: trunk/phase3/includes/db/Database.php
@@ -1943,25 +1943,21 @@
19441944 /**
19451945 * Returns a wikitext link to the DB's website, e.g.,
19461946 * return "[http://www.mysql.com/ MySQL]";
1947 - * Should probably be overridden to at least contain plain text, if for
1948 - * some reason your database has no website.
 1947+ * Should at least contain plain text, if for some reason
 1948+ * your database has no website.
19491949 *
19501950 * @return String: wikitext of a link to the server software's web site
19511951 */
1952 - function getSoftwareLink() {
1953 - return '(no software link given)';
1954 - }
 1952+ abstract function getSoftwareLink();
19551953
19561954 /**
19571955 * Returns the database type for user-visible purposes
19581956 * e.g. DB error messages
19591957 * Other uses should just use $wgDBtype
19601958 *
1961 - * @return String: Database name for messages
 1959+ * @return String: Database type for use in messages
19621960 */
1963 - function getDBtype() {
1964 - return 'Database';
1965 - }
 1961+ abstract function getDBtypeForMsg();
19661962
19671963 /**
19681964 * A string describing the current software version, like from
@@ -2560,7 +2556,7 @@
25612557 if ( $this->useMessageCache() ) {
25622558 return wfMsg( 'dberrortextcl', htmlspecialchars( $this->getSQL() ),
25632559 htmlspecialchars( $this->fname ), $this->errno, htmlspecialchars( $this->error ),
2564 - htmlspecialchars( $this->db->getDBtype() ) ) . "\n";
 2560+ htmlspecialchars( $this->db->getDBtypeForMsg() ) ) . "\n";
25652561 } else {
25662562 return $this->getMessage();
25672563 }
@@ -2588,7 +2584,7 @@
25892585 if ( $this->useMessageCache() ) {
25902586 return wfMsgNoDB( 'dberrortext', htmlspecialchars( $this->getSQL() ),
25912587 htmlspecialchars( $this->fname ), $this->errno, htmlspecialchars( $this->error ),
2592 - htmlspecialchars( $this->db->getDBtype() ) );
 2588+ htmlspecialchars( $this->db->getDBtypeForMsg() ) );
25932589 } else {
25942590 return nl2br( htmlspecialchars( $this->getMessage() ) );
25952591 }
Index: trunk/phase3/includes/db/DatabaseMssql.php
@@ -900,9 +900,9 @@
901901 }
902902
903903 /**
904 - * @return String: Database name for messages
 904+ * @return String: Database type for use in messages
905905 */
906 - function getDBtype() {
 906+ function getDBtypeForMsg() {
907907 return 'Microsoft SQL Server';
908908 }
909909
Index: trunk/phase3/includes/db/DatabaseSqlite.php
@@ -288,9 +288,9 @@
289289 }
290290
291291 /**
292 - * @return String: Database name for messages
 292+ * @return String: Database type for use in messages
293293 */
294 - function getDBtype() {
 294+ function getDBtypeForMsg() {
295295 return 'SQLite';
296296 }
297297

Follow-up revisions

RevisionCommit summaryAuthorDate
r55501Mostly revert r53358 and r53365 per comments on code review. Change message t...mrzman20:17, 22 August 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r53358(bug 19590) Database error messages are no longer hardcoded to use "MySQL"....mrzman15:18, 16 July 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   00:46, 22 August 2009

See my notes on r53358

Status & tagging log