if( file_exists( "./LocalSettings.php" ) ) {
writeSuccessMessage();
- dieout( '' );
+ dieout( );
}
if( !is_writable( "." ) ) {
."or install the $comp.so module</li>\n";
}
echo '</ul>';
- dieout( '' );
+ dieout( );
}
print "<li>Found database drivers for:";
return str_replace( "\r\n", "\n", $localsettings );
}
-function dieout( $text ) {
+/**
+ * Wrapper around php die() but with HTML output.
+ * This function close remaining HTML tags.
+ * @param $text String: Text to output, can be pure HTML (Default: '')
+ */
+function dieout( $text = '' ) {
global $mainListOpened;
if( $mainListOpened ) echo( "</ul>" );
if( $text != '' && substr( $text, 0, 2 ) != '<p' && substr( $text, 0, 2 ) != '<h' ){
$PGMINVER = '8.1';
if ( $version < $PGMINVER ) {
print "<b>FAILED</b>. Required version is $PGMINVER. You have " . htmlspecialchars( $version ) . "</li>\n";
- dieout( '' );
+ dieout( );
}
print 'version ' . htmlspecialchars( $this->numeric_version ) . " is OK.</li>\n";
$rows = $this->numRows( $res = $this->doQuery( $SQL ) );
if ( !$rows ) {
print '<li>ERROR: Could not read permissions for user "' . htmlspecialchars( $superuser ) . "\"</li>\n";
- dieout( '' );
+ dieout( );
}
$perms = pg_fetch_result( $res, 0, 0 );
if ( $perms != 1 && $perms != 3 ) {
print '<li>ERROR: the user "' . htmlspecialchars( $superuser ) . '" cannot create other users. ';
print 'Please use a different Postgres user.</li>';
- dieout( '' );
+ dieout( );
}
print '<li>Creating user <b>' . htmlspecialchars( $wgDBuser ) . '</b>...';
$safepass = $this->addQuotes( $wgDBpassword );
if ( $perms < 1 ) {
print '<li>ERROR: the user "' . htmlspecialchars( $superuser ) . '" cannot create databases. ';
print 'Please use a different Postgres user.</li>';
- dieout( '' );
+ dieout( );
}
print '<li>Creating database <b>' . htmlspecialchars( $wgDBname ) . '</b>...';
$safename = $this->quote_ident( $wgDBname );
@$this->mConn = pg_connect( $this->makeConnectionString( $connectVars ) );
if ( !$this->mConn ) {
print "<b>FAILED TO CONNECT!</b></li>";
- dieout( '' );
+ dieout( );
}
print "OK</li>\n";
}
htmlspecialchars( $wgDBname ) . '".';
print 'Please see <a href="http://www.devx.com/opensource/Article/21674/0/page/2">this article</a>';
print " for instructions or ask on #postgresql on irc.freenode.net</li>\n";
- dieout( '' );
+ dieout( );
}
print "OK</li>\n";
print '<li>Ensuring that user "' . htmlspecialchars( $wgDBuser ) .
$result = $this->doQuery( "CREATE SCHEMA $safeschema AUTHORIZATION $safeuser" );
if ( !$result ) {
print "<b>FAILED</b>.</li>\n";
- dieout( '' );
+ dieout( );
}
print "OK</li>\n";
} else {
$res = $this->doQuery( $SQL );
if ( !$res ) {
print "<b>FAILED</b>. Could not set rights for the user.</li>\n";
- dieout( '' );
+ dieout( );
}
$this->doQuery( "SET search_path = $safeschema" );
$rows = $this->numRows( $res );
print '<b>FAILED</b>. Make sure tsearch2 is installed. See <a href="';
print 'http://www.devx.com/opensource/Article/21674/0/page/2">this article</a>';
print " for instructions.</li>\n";
- dieout( '' );
+ dieout( );
}
print "OK</li>\n";
print "<b>FAILED</b> to access " . htmlspecialchars( "pg_ts_$tname" ) .
". Make sure that the user \"". htmlspecialchars( $wgDBuser ) .
"\" has SELECT access to all four tsearch2 tables</li>\n";
- dieout( '' );
+ dieout( );
}
}
$SQL = "SELECT ts_name FROM $safetsschema.pg_ts_cfg WHERE locale = " . $this->addQuotes( $ctype ) ;
print '<b>FAILED</b>. ';
print 'Please make sure that the locale in pg_ts_cfg for "default" is set to "' .
htmlspecialchars( $ctype ) . "\"</li>\n";
- dieout( '' );
+ dieout( );
}
print 'OK</li>';
}
$res = $this->doQuery( $SQL );
if ( !$res ) {
print '<b>FAILED</b>. Specifically, "' . htmlspecialchars( $SQL ) . '" did not work.</li>';
- dieout( '' );
+ dieout( );
}
print 'OK</li>';
}
'You can try making them the owner of the database, or try creating the schema with a '.
'different user, and then grant access to the "' .
htmlspecialchars( $wgDBuser ) . "\" user.</li>\n";
- dieout( '' );
+ dieout( );
}
print "OK</li>\n";
} elseif ( $result != $wgDBuser ) {
$result = pg_query( $this->mConn, $SQL );
if ( !$result ) {
print "<b>FAILED</b>.</li>\n";
- dieout( '' );
+ dieout( );
}
print "OK</li>\n";
// Set for the rest of this session
$result = pg_query( $this->mConn, $SQL );
if ( !$result ) {
print "<li>Failed to set timezone</li>\n";
- dieout( '' );
+ dieout( );
}
print '<li>Setting the datestyle to ISO, YMD for user "' . htmlspecialchars( $wgDBuser ) . '" ...';
$result = pg_query( $this->mConn, $SQL );
if ( !$result ) {
print "<b>FAILED</b>.</li>\n";
- dieout( '' );
+ dieout( );
}
print "OK</li>\n";
// Set for the rest of this session
$result = pg_query( $this->mConn, $SQL );
if ( !$result ) {
print "<li>Failed to set datestyle</li>\n";
- dieout( '' );
+ dieout( );
}
// Fix up the search paths if needed
$result = pg_query( $this->mConn, $SQL );
if ( !$result ) {
print "<b>FAILED</b>.</li>\n";
- dieout( '' );
+ dieout( );
}
print "OK</li>\n";
// Set for the rest of this session
$result = pg_query( $this->mConn, $SQL );
if ( !$result ) {
print "<li>Failed to set search_path</li>\n";
- dieout( '' );
+ dieout( );
}
define( 'POSTGRES_SEARCHPATH', $path );
}
if ( !$result ) {
print '<b>FAILED</b>. You need to install the language PL/pgSQL in the database <tt>' .
htmlspecialchars( $wgDBname ) . '</tt></li>';
- dieout( '' );
+ dieout( );
}
} else {
print '<b>FAILED</b>. You need to install the language PL/pgSQL in the database <tt>' .
htmlspecialchars( $wgDBname ) . '</tt></li>';
- dieout( '' );
+ dieout( );
}
}
print "OK</li>\n";