* 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
# 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}" );