$conf->SysopPass = importPost( "SysopPass" );
$conf->SysopPass2 = importPost( "SysopPass2" );
$conf->RootUser = importPost( "RootUser", "root" );
- $conf->RootPW = importPost( "RootPW", "-" );
+ $conf->RootPW = importPost( "RootPW", "" );
+ $useRoot = importCheck( 'useroot', false );
## MySQL specific:
$conf->DBprefix = importPost( "DBprefix" );
$ok = true; # Let's be optimistic
# Decide if we're going to use the superuser or the regular database user
- if( $conf->RootPW == '-' ) {
- # Regular user
- $conf->Root = false;
- $db_user = $wgDBuser;
- $db_pass = $wgDBpassword;
- } else {
- # Superuser
- $conf->Root = true;
+ $conf->Root = $useRoot;
+ if( $conf->Root ) {
$db_user = $conf->RootUser;
$db_pass = $conf->RootPW;
+ } else {
+ $db_user = $wgDBuser;
+ $db_pass = $wgDBpassword;
}
# Attempt to connect
error_reporting( E_ALL );
$wgSuperUser = '';
## Possible connect as a superuser
- if( $conf->RootPW != '-' and strlen($conf->RootPW)) {
+ if( $conf->Root ) {
$wgDBsuperuser = $conf->RootUser;
echo( "<li>Attempting to connect to database \"postgres\" as superuser \"$wgDBsuperuser\"..." );
$wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW, "postgres", 1);
has SELECT, INSERT, UPDATE and DELETE permissions on the MediaWiki database.
</p>
+ <div class="config-input">
+ <label class="column">Superuser account:</label>
+ <input type="checkbox" name="useroot" id="useroot" <?php if( $useRoot ) { ?>checked="checked" <?php } ?>/>
+ <label for="useroot">Use superuser account</label>
+ </div>
<div class="config-input">
<?php
- aField( $conf, "RootUser", "Superuser account:", "superuser" );
+ aField( $conf, "RootUser", "Superuser name:", "superuser" );
?>
</div>
<div class="config-input">
<p class="config-desc">
If the database user specified above does not exist, or does not have access to create
- the database (if needed) or tables within it, please provide details of a superuser account,
- such as <strong>root</strong>, which does. Leave the password set to <strong>-</strong> if this is not needed.
+ the database (if needed) or tables within it, please check the box and provide details
+ of a superuser account, such as <strong>root</strong>, which does.
</p>
<?php database_switcher('mysql'); ?>
return importVar( $_POST, $name, $default );
}
+function importCheck( $name ) {
+ return isset( $_POST[$name] );
+}
+
function importRequest( $name, $default = "" ) {
return importVar( $_REQUEST, $name, $default );
}