r96369 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96368‎ | r96369 | r96370 >
Date:20:44, 6 September 2011
Author:demon
Status:resolved
Tags:
Comment:
Fixme on r85888: boolean params are evil, use a nice simple string instead :)
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/Database.php
@@ -1925,11 +1925,13 @@
19261926 * when calling query() directly.
19271927 *
19281928 * @param $name String: database table name
1929 - * @param $quoted Boolean: Automatically pass the table name through
1930 - * addIdentifierQuotes() so that it can be used in a query.
 1929+ * @param $format String One of:
 1930+ * quoted - Automatically pass the table name through addIdentifierQuotes()
 1931+ * so that it can be used in a query.
 1932+ * raw - Do not add identifier quotes to the table name
19311933 * @return String: full database name
19321934 */
1933 - function tableName( $name, $quoted = true ) {
 1935+ function tableName( $name, $format = 'quoted' ) {
19341936 global $wgSharedDB, $wgSharedPrefix, $wgSharedTables;
19351937 # Skip the entire process when we have a string quoted on both ends.
19361938 # Note that we check the end so that we will still quote any use of
@@ -1981,11 +1983,11 @@
19821984
19831985 # Quote the $database and $table and apply the prefix if not quoted.
19841986 if ( isset( $database ) ) {
1985 - $database = ( !$quoted || $this->isQuotedIdentifier( $database ) ? $database : $this->addIdentifierQuotes( $database ) );
 1987+ $database = ( $format == 'quoted' || $this->isQuotedIdentifier( $database ) ? $database : $this->addIdentifierQuotes( $database ) );
19861988 }
19871989
19881990 $table = "{$prefix}{$table}";
1989 - if ( $quoted && !$this->isQuotedIdentifier( $table ) ) {
 1991+ if ( $format == 'quoted' && !$this->isQuotedIdentifier( $table ) ) {
19901992 $table = $this->addIdentifierQuotes( "{$table}" );
19911993 }
19921994

Follow-up revisions

RevisionCommit summaryAuthorDate
r96370Followup r96369: update child classes and a few callersdemon20:51, 6 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85888Add parameter to tableName() to get the bare table name.platonides17:00, 12 April 2011

Status & tagging log