From b3e314d361d11adfec72198f40181b7cd7275dbc Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Wed, 19 Sep 2007 02:31:28 +0000 Subject: [PATCH] Set search_path on Postgres if wgDBmwschema != 'mediawiki' to support multiple wikis for a single user, per discussion on bug 11136 --- RELEASE-NOTES | 3 ++- includes/DatabasePostgres.php | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index addd0d4825..ed9360d31c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -24,7 +24,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Add a warning for non-descriptive filenames at Special:Upload * Add {{filepath:}} parser function to get full path to an uploaded file, complementing {{fullurl:}} for pages. - +* (bug 11136) If using Postgres, search path is explicitly set if wgDBmwschema is + not set to 'mediawiki', allowing multiple mediawiki instances per user. === Bug fixes in 1.12 === diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index 32c061a00d..7e550c891a 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -486,6 +486,15 @@ class DatabasePostgres extends Database { $this->doQuery("SET client_min_messages = 'ERROR'"); } + global $wgDBmwschema, $wgDBts2schema; + if (isset( $wgDBmwschema ) && isset( $wgDBts2schema ) + && $wgDBmwschema !== 'mediawiki' + && preg_match( '/^\w+$/', $wgDBmwschema ) + && preg_match( '/^\w+$/', $wgDBts2schema ) + ) { + $this->doQuery("SET search_path = $wgDBmwschema, $wgDBts2schema, public"); + } + return $this->mConn; } -- 2.20.1