Merge "(bug 38406) Properly quote table names in DatabaseBase::tableName()"
[lhc/web/wiklou.git] / includes / db / Database.php
index 4771659..3bf0588 100644 (file)
@@ -1951,7 +1951,9 @@ abstract class DatabaseBase implements DatabaseType {
 
                # Quote the $database and $table and apply the prefix if not quoted.
                if ( isset( $database ) ) {
-                       $database = ( $format == 'quoted' || $this->isQuotedIdentifier( $database ) ? $database : $this->addIdentifierQuotes( $database ) );
+                       if ( $format == 'quoted' && !$this->isQuotedIdentifier( $database ) ) {
+                               $database = $this->addIdentifierQuotes( $database );
+                       }
                }
 
                $table = "{$prefix}{$table}";