From 118b79abf9a6d6251c308230912a032d5a2d7eea Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Thu, 29 Jun 2006 01:55:52 +0000 Subject: [PATCH] Make sure search_path mojo only performed once. Add temporary commit() method. Add limitResultForUpdate method (does nothing). Add update_interwiki method to parse interwiki.sql file. --- includes/DatabasePostgres.php | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index 7b9e87d1e3..3dcfa50833 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -85,7 +85,7 @@ class DatabasePostgres extends Database { $this->mOpened = true; ## If this is the initial connection, setup the schema stuff - if (defined('MEDIAWIKI_INSTALL')) { + if (defined('MEDIAWIKI_INSTALL') and !defined('POSTGRES_SEARCHPATH')) { ## Does the schema already exist? Who owns it? $result = $this->schemaExists($schema); if (!$result) { @@ -120,6 +120,7 @@ class DatabasePostgres extends Database { print "
  • Failed to set search_path
  • \n"; return false; } + define( "POSTGRES_SEARCHPATH", true ); } return $this->mConn; @@ -514,6 +515,37 @@ class DatabasePostgres extends Database { return $type; } + function commit( $fname = 'Database::commit' ) { + ## XXX + return; + $this->query( 'COMMIT', $fname ); + $this->mTrxLevel = 0; + } + + function limitResultForUpdate($sql, $num) { + return $sql; + } + + function update_interwiki() { + ## Avoid the non-standard "REPLACE INTO" syntax + ## Called by config/index.php + $f = fopen( "../maintenance/interwiki.sql", 'r' ); + if ($f == false ) { + dieout( "
  • Could not find the interwiki.sql file"); + } + ## We simply assume it is already empty as we have just created it + $SQL = "INSERT INTO interwiki(iw_prefix,iw_url,iw_local) VALUES "; + while ( ! feof( $f ) ) { + $line = fgets($f,1024); + if (!preg_match("/^\s*(\(.+?),(\d)\)/", $line, $matches)) { + continue; + } + $yesno = $matches[2]; ## ? "'true'" : "'false'"; + $this->query("$SQL $matches[1],$matches[2])"); + } + print " (table interwiki successfully populated)...\n"; + } + } ?> -- 2.20.1