Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -1513,9 +1513,11 @@ |
1514 | 1514 | * when calling query() directly. |
1515 | 1515 | * |
1516 | 1516 | * @param $name String: database table name |
| 1517 | + * @param $quoted Boolean: Automatically pass the table name through |
| 1518 | + * addIdentifierQuotes() so that it can be used in a query. |
1517 | 1519 | * @return String: full database name |
1518 | 1520 | */ |
1519 | | - function tableName( $name ) { |
| 1521 | + function tableName( $name, $quoted = true ) { |
1520 | 1522 | global $wgSharedDB, $wgSharedPrefix, $wgSharedTables; |
1521 | 1523 | # Skip the entire process when we have a string quoted on both ends. |
1522 | 1524 | # Note that we check the end so that we will still quote any use of |
— | — | @@ -1561,10 +1563,10 @@ |
1562 | 1564 | |
1563 | 1565 | # Quote the $database and $table and apply the prefix if not quoted. |
1564 | 1566 | if ( isset( $database ) ) { |
1565 | | - $database = ( $this->isQuotedIdentifier( $database ) ? $database : $this->addIdentifierQuotes( $database ) ); |
| 1567 | + $database = ( !$quoted || $this->isQuotedIdentifier( $database ) ? $database : $this->addIdentifierQuotes( $database ) ); |
1566 | 1568 | $prefix = ''; |
1567 | 1569 | } |
1568 | | - $table = ( $this->isQuotedIdentifier( $table ) ? $table : $this->addIdentifierQuotes( "{$prefix}{$table}" ) ); |
| 1570 | + $table = ( !$quoted || $this->isQuotedIdentifier( $table ) ? $table : $this->addIdentifierQuotes( "{$prefix}{$table}" ) ); |
1569 | 1571 | |
1570 | 1572 | # Merge our database and table into our final table name. |
1571 | 1573 | $tableName = ( isset( $database ) ? "{$database}.{$table}" : "{$table}" ); |