}
}
- function setup_plpgsql() {
- print '<li>Checking for PL/pgSQL ...';
- $SQL = "SELECT 1 FROM pg_catalog.pg_language WHERE lanname = 'plpgsql'";
- $rows = $this->numRows( $this->doQuery( $SQL ) );
- if ( $rows < 1 ) {
- // plpgsql is not installed, but if we have a pg_pltemplate table, we should be able to create it
- print 'not installed. Attempting to install PL/pgSQL ...';
- $SQL = "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON (n.oid = c.relnamespace) ".
- "WHERE relname = 'pg_pltemplate' AND nspname='pg_catalog'";
- $rows = $this->numRows( $this->doQuery( $SQL ) );
- global $wgDBname;
- if ( $rows >= 1 ) {
- $olde = error_reporting( 0 );
- error_reporting( $olde - E_WARNING );
- $result = $this->doQuery( 'CREATE LANGUAGE plpgsql' );
- error_reporting( $olde );
- if ( !$result ) {
- print '<b>FAILED</b>. You need to install the language PL/pgSQL in the database <tt>' .
- htmlspecialchars( $wgDBname ) . '</tt></li>';
- dieout( );
- }
- } else {
- print '<b>FAILED</b>. You need to install the language PL/pgSQL in the database <tt>' .
- htmlspecialchars( $wgDBname ) . '</tt></li>';
- dieout( );
- }
- }
- print "OK</li>\n";
- }
-
/**
* Closes a database connection, if it is open
* Returns success, true if already closed
'config-install-pg-schema-failed' => 'Tables creation failed.
Make sure that the user "$1" can write to the schema "$2".',
'config-install-pg-commit' => 'Committing changes',
+ 'config-pg-no-plpgsql' => 'You need to install the language PL/pgSQL in the database $1',
'config-install-user' => 'Creating database user',
'config-install-user-failed' => 'Granting permission to user "$1" failed: $2',
'config-install-tables' => 'Creating tables',
$wgDBuser = $this->getVar( '_InstallUser' );
$wgDBpassword = $this->getVar( '_InstallPassword' );
}
+
+ private function setupPLpgSQL() {
+ $rows = $this->numRows(
+ $this->db->query( "SELECT 1 FROM pg_catalog.pg_language WHERE lanname = 'plpgsql'" )
+ );
+ if ( $rows < 1 ) {
+ // plpgsql is not installed, but if we have a pg_pltemplate table, we should be able to create it
+ $SQL = "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON (n.oid = c.relnamespace) ".
+ "WHERE relname = 'pg_pltemplate' AND nspname='pg_catalog'";
+ $rows = $this->numRows( $this->db->query( $SQL ) );
+ global $wgDBname;
+ if ( $rows >= 1 ) {
+ $result = $this->db->query( 'CREATE LANGUAGE plpgsql' );
+ if ( !$result ) {
+ return Status::newFatal( 'pg-no-plpgsql', $wgDBname );
+ }
+ } else {
+ return Status::newFatal( 'pg-no-plpgsql', $wgDBname );
+ }
+ }
+ return Status::newGood();
+ }
}