From 73df0d7879be7ef7fbfab4291ec7b97f9512da67 Mon Sep 17 00:00:00 2001 From: Platonides Date: Fri, 28 Jan 2011 17:25:00 +0000 Subject: [PATCH] Follow-up r81132 removal of pre-8.3 support. Still needs removal of $wgDBts2schema inside initial_setup() --- includes/db/DatabasePostgres.php | 101 +------------------------------ 1 file changed, 1 insertion(+), 100 deletions(-) diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index 6b453cd0aa..327679f783 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -192,7 +192,7 @@ class DatabasePostgres extends DatabaseBase { $this->doQuery( "SET client_encoding='UTF8'" ); - global $wgDBmwschema, $wgDBts2schema; + global $wgDBmwschema; if ( isset( $wgDBmwschema ) && $wgDBmwschema !== 'mediawiki' && preg_match( '/^\w+$/', $wgDBmwschema ) @@ -293,27 +293,6 @@ class DatabasePostgres extends DatabaseBase { print "OK\n"; } - if ( $this->numeric_version < 8.3 ) { - // Tsearch2 checks - print '
  • Checking that tsearch2 is installed in the database "' . - htmlspecialchars( $wgDBname ) . '"...'; - if ( !$this->tableExists( 'pg_ts_cfg', $wgDBts2schema ) ) { - print 'FAILED. tsearch2 must be installed in the database "' . - htmlspecialchars( $wgDBname ) . '".'; - print 'Please see this article'; - print " for instructions or ask on #postgresql on irc.freenode.net
  • \n"; - dieout( ); - } - print "OK\n"; - print '
  • Ensuring that user "' . htmlspecialchars( $wgDBuser ) . - '" has select rights on the tsearch2 tables...'; - foreach ( array( 'cfg', 'cfgmap', 'dict', 'parser' ) as $table ) { - $SQL = "GRANT SELECT ON pg_ts_$table TO $safeuser"; - $this->doQuery( $SQL ); - } - print "OK
  • \n"; - } - // Setup the schema for this user if needed $result = $this->schemaExists( $wgDBmwschema ); $safeschema = $this->addIdentifierQuotes( $wgDBmwschema ); @@ -359,84 +338,6 @@ class DatabasePostgres extends DatabaseBase { } // end superuser if ( !defined( 'POSTGRES_SEARCHPATH' ) ) { - - if ( $this->numeric_version < 8.3 ) { - // Do we have the basic tsearch2 table? - print '
  • Checking for tsearch2 in the schema "' . htmlspecialchars( $wgDBts2schema ) . '"...'; - if ( !$this->tableExists( 'pg_ts_dict', $wgDBts2schema ) ) { - print 'FAILED. Make sure tsearch2 is installed. See this article'; - print " for instructions.
  • \n"; - dieout( ); - } - print "OK\n"; - - // Does this user have the rights to the tsearch2 tables? - $ctype = pg_fetch_result( $this->doQuery( 'SHOW lc_ctype' ), 0, 0 ); - print '
  • Checking tsearch2 permissions...'; - // Let's check all four, just to be safe - error_reporting( 0 ); - $ts2tables = array( 'cfg', 'cfgmap', 'dict', 'parser' ); - $safetsschema = $this->addIdentifierQuotes( $wgDBts2schema ); - foreach ( $ts2tables as $tname ) { - $SQL = "SELECT count(*) FROM $safetsschema.pg_ts_$tname"; - $res = $this->doQuery( $SQL ); - if ( !$res ) { - print "FAILED to access " . htmlspecialchars( "pg_ts_$tname" ) . - ". Make sure that the user \"". htmlspecialchars( $wgDBuser ) . - "\" has SELECT access to all four tsearch2 tables
  • \n"; - dieout( ); - } - } - $SQL = "SELECT ts_name FROM $safetsschema.pg_ts_cfg WHERE locale = " . $this->addQuotes( $ctype ) ; - $SQL .= " ORDER BY CASE WHEN ts_name <> 'default' THEN 1 ELSE 0 END"; - $res = $this->doQuery( $SQL ); - error_reporting( E_ALL ); - if ( !$res ) { - print "FAILED. Could not determine the tsearch2 locale information\n"; - dieout(""); - } - print 'OK'; - - // Will the current locale work? Can we force it to? - print '
  • Verifying tsearch2 locale with ' . htmlspecialchars( $ctype ) . '...'; - $rows = $this->numRows( $res ); - $resetlocale = 0; - if ( !$rows ) { - print "not found
  • \n"; - print '
  • Attempting to set default tsearch2 locale to "' . htmlspecialchars( $ctype ) . '"...'; - $resetlocale = 1; - } else { - $tsname = pg_fetch_result( $res, 0, 0 ); - if ( $tsname != 'default' ) { - print "not set to default (" . htmlspecialchars( $tsname ) . ")"; - print "
  • Attempting to change tsearch2 default locale to \"" . - htmlspecialchars( $ctype ) . "\"..."; - $resetlocale = 1; - } - } - if ( $resetlocale ) { - $SQL = "UPDATE $safetsschema.pg_ts_cfg SET locale = " . $this->addQuotes( $ctype ) . " WHERE ts_name = 'default'"; - $res = $this->doQuery( $SQL ); - if ( !$res ) { - print 'FAILED. '; - print 'Please make sure that the locale in pg_ts_cfg for "default" is set to "' . - htmlspecialchars( $ctype ) . "\"
  • \n"; - dieout( ); - } - print 'OK'; - } - - // Final test: try out a simple tsearch2 query - $SQL = "SELECT $safetsschema.to_tsvector('default','MediaWiki tsearch2 testing')"; - $res = $this->doQuery( $SQL ); - if ( !$res ) { - print 'FAILED. Specifically, "' . htmlspecialchars( $SQL ) . '" did not work.'; - dieout( ); - } - print 'OK'; - } - // Install plpgsql if needed $this->setup_plpgsql(); -- 2.20.1