r100639 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100638‎ | r100639 | r100640 >
Date:19:28, 24 October 2011
Author:overlordq
Status:ok
Tags:
Comment:
Basic support for Postgres phpunit testing, currently throws 5 errors, 1 inc, 5 skipped
Modified paths:
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)
  • /trunk/phase3/tests/phpunit/MediaWikiTestCase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/MediaWikiTestCase.php
@@ -22,6 +22,7 @@
2323 protected $supportedDBs = array(
2424 'mysql',
2525 'sqlite',
 26+ 'postgres',
2627 'oracle'
2728 );
2829
Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -688,6 +688,24 @@
689689 return $this->query( 'CREATE ' . ( $temporary ? 'TEMPORARY ' : '' ) . " TABLE $newName (LIKE $oldName INCLUDING DEFAULTS)", $fname );
690690 }
691691
 692+ function listTables( $prefix = null, $fname = 'DatabasePostgres::listTables' ) {
 693+ global $wgDBmwschema;
 694+ $eschema = $this->addQuotes( $wgDBmwschema );
 695+ $result = $this->query( "SELECT tablename FROM pg_tables WHERE schemaname = $eschema", $fname );
 696+
 697+ $endArray = array();
 698+
 699+ foreach( $result as $table ) {
 700+ $vars = get_object_vars($table);
 701+ $table = array_pop( $vars );
 702+ if( !$prefix || strpos( $table, $prefix ) === 0 ) {
 703+ $endArray[] = $table;
 704+ }
 705+ }
 706+
 707+ return $endArray;
 708+ }
 709+
692710 function timestamp( $ts = 0 ) {
693711 return wfTimestamp( TS_POSTGRES, $ts );
694712 }

Status & tagging log