r110690 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110689‎ | r110690 | r110691 >
Date:23:37, 3 February 2012
Author:aaron
Status:ok
Tags:
Comment:
Reverted r106025 and friends (r106370, r106373, r108060, r108337, r106419). This can go in 1.20 if a Postgres person has time to look at it.
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -624,59 +624,15 @@
625625 }
626626
627627 function tableName( $name, $format = 'quoted' ) {
628 - global $wgSharedDB, $wgSharedTables;
629 - # Skip quoted tablenames.
630 - if ( $this->isQuotedIdentifier( $name ) ) {
631 - return $name;
632 - }
633 - # Lets test for any bits of text that should never show up in a table
634 - # name. Basically anything like JOIN or ON which are actually part of
635 - # SQL queries, but may end up inside of the table value to combine
636 - # sql. Such as how the API is doing.
637 - # Note that we use a whitespace test rather than a \b test to avoid
638 - # any remote case where a word like on may be inside of a table name
639 - # surrounded by symbols which may be considered word breaks.
640 - if ( preg_match( '/(^|\s)(DISTINCT|JOIN|ON|AS)(\s|$)/i', $name ) !== 0 ) {
641 - return $name;
642 - }
643 - # Extract the database prefix, if any and quote it
644 - $dbDetails = explode( '.', $name, 2 );
645 - if ( isset( $dbDetails[1] ) ) {
646 - $schema = '"' . $dbDetails[0] . '".';
647 - $table = $dbDetails[1];
648 - } else {
649 - $schema = ""; # do NOT force the schema (due to temporary tables)
650 - $table = $dbDetails[0];
651 - }
652 - if ( $format != 'quoted' ) {
653 - switch( $name ) {
654 - case 'user':
655 - return 'mwuser';
656 - case 'text':
657 - return 'pagecontent';
658 - default:
659 - return $table;
660 - }
661 - }
662 -
663 - if ( isset( $wgSharedDB ) # We have a shared database (=> schema)
664 - && isset( $wgSharedTables )
665 - && is_array( $wgSharedTables )
666 - && in_array( $table, $wgSharedTables ) ) { # A shared table is selected
667 - $schema = "\"{$wgSharedDB}\".";
668 - }
669 - switch ( $table ) {
 628+ # Replace reserved words with better ones
 629+ switch( $name ) {
670630 case 'user':
671 - $table = "{$schema}\"mwuser\"";
672 - break;
 631+ return 'mwuser';
673632 case 'text':
674 - $table = "{$schema}\"pagecontent\"";
675 - break;
 633+ return 'pagecontent';
676634 default:
677 - $table = "{$schema}\"$table\"";
678 - break;
 635+ return parent::tableName( $name, $format );
679636 }
680 - return $table;
681637 }
682638
683639 /**
Index: trunk/phase3/CREDITS
@@ -123,7 +123,6 @@
124124 * Lejonel
125125 * liangent
126126 * Louperivois
127 -* Luca Fulchir
128127 * Lucas Garczewski
129128 * Luigi Corsaro
130129 * Lupo

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106025Bug 16794 - $wgSharedDB PostgreSQL support...mah15:06, 13 December 2011
r106370Use the canonical name of the settingplatonides21:12, 15 December 2011
r106373Simplify a bit the code of r106025platonides21:21, 15 December 2011
r106419Foooollowup r106373 - update commentnikerabbit08:56, 16 December 2011
r108060re r106025 — apply follow up from Luca Fulchirmah18:01, 4 January 2012
r108337No need of $wgDBmwschema after r108060platonides23:29, 7 January 2012

Status & tagging log