r48455 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48454‎ | r48455 | r48456 >
Date:20:21, 16 March 2009
Author:ialex
Status:ok
Tags:
Comment:
(bug 14990) Parser tests works again with PostgreSQL

Based on a patch by Brent G: http://bug-attachment.wikimedia.org/attachment.cgi?id=5933
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/maintenance/parserTests.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.inc
@@ -616,7 +616,7 @@
617617 * the db will be visible to later tests in the run.
618618 */
619619 private function setupDatabase() {
620 - global $wgDBprefix;
 620+ global $wgDBprefix, $wgDBtype;
621621 if ( $this->databaseSetupDone ) {
622622 return;
623623 }
@@ -638,15 +638,16 @@
639639 $db = wfGetDB( DB_MASTER );
640640 $tables = $this->listTables();
641641
642 - if (!(strcmp($db->getServerVersion(), '4.1') < 0 and stristr($db->getSoftwareLink(), 'MySQL'))) {
 642+ if ( !( $wgDBtype == 'mysql' && strcmp( $db->getServerVersion(), '4.1' ) < 0 ) ) {
643643 # Database that supports CREATE TABLE ... LIKE
644 - global $wgDBtype;
 644+
645645 if( $wgDBtype == 'postgres' ) {
646646 $def = 'INCLUDING DEFAULTS';
 647+ $temporary = 'TEMPORARY';
647648 } else {
648649 $def = '';
649650 }
650 - foreach ($tables as $tbl) {
 651+ foreach ( $tables as $tbl ) {
651652 # Clean up from previous aborted run. So that table escaping
652653 # works correctly across DB engines, we need to change the pre-
653654 # fix back and forth so tableName() works right.
@@ -655,11 +656,11 @@
656657 $this->changePrefix( 'parsertest_' );
657658 $newTableName = $db->tableName( $tbl );
658659
659 - if ( $db->tableExists( $tbl ) ) {
660 - $db->query("DROP TABLE $newTableName");
 660+ if ( $db->tableExists( $tbl ) && $wgDBtype != 'postgres' ) {
 661+ $db->query( "DROP TABLE $newTableName" );
661662 }
662663 # Create new table
663 - $db->query("CREATE $temporary TABLE $newTableName (LIKE $oldTableName $def)");
 664+ $db->query( "CREATE $temporary TABLE $newTableName (LIKE $oldTableName $def)" );
664665 }
665666 } else {
666667 # Hack for MySQL versions < 4.1, which don't support
Index: trunk/phase3/RELEASE-NOTES
@@ -269,6 +269,7 @@
270270 don't use PathInfo or short urls
271271 * (bug 17990) trackback.php now has a trackback.php5 alias and works with
272272 $wgScriptExtension
 273+* (bug 14990) Parser tests works again with PostgreSQL
273274
274275 == API changes in 1.15 ==
275276 * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r38310(bug 14990) Don't hardcode MySQL backticks in table names for parser tests. ...simetrical17:04, 31 July 2008

Status & tagging log