From: Platonides Date: Tue, 12 Apr 2011 17:00:08 +0000 (+0000) Subject: Add parameter to tableName() to get the bare table name. X-Git-Tag: 1.31.0-rc.0~30906 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=a659728096e1d963b0672d7ab53a622388f58978;p=lhc%2Fweb%2Fwiklou.git Add parameter to tableName() to get the bare table name. --- diff --git a/includes/db/Database.php b/includes/db/Database.php index 19a125c8ad..7bb13dfba7 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1513,9 +1513,11 @@ abstract class DatabaseBase implements DatabaseType { * when calling query() directly. * * @param $name String: database table name + * @param $quoted Boolean: Automatically pass the table name through + * addIdentifierQuotes() so that it can be used in a query. * @return String: full database name */ - function tableName( $name ) { + function tableName( $name, $quoted = true ) { global $wgSharedDB, $wgSharedPrefix, $wgSharedTables; # Skip the entire process when we have a string quoted on both ends. # Note that we check the end so that we will still quote any use of @@ -1561,10 +1563,10 @@ abstract class DatabaseBase implements DatabaseType { # Quote the $database and $table and apply the prefix if not quoted. if ( isset( $database ) ) { - $database = ( $this->isQuotedIdentifier( $database ) ? $database : $this->addIdentifierQuotes( $database ) ); + $database = ( !$quoted || $this->isQuotedIdentifier( $database ) ? $database : $this->addIdentifierQuotes( $database ) ); $prefix = ''; } - $table = ( $this->isQuotedIdentifier( $table ) ? $table : $this->addIdentifierQuotes( "{$prefix}{$table}" ) ); + $table = ( !$quoted || $this->isQuotedIdentifier( $table ) ? $table : $this->addIdentifierQuotes( "{$prefix}{$table}" ) ); # Merge our database and table into our final table name. $tableName = ( isset( $database ) ? "{$database}.{$table}" : "{$table}" );