Added check for valid user permissions when updating database

This commit is contained in:
Tim Starling 2004-09-26 10:07:31 +00:00
parent 87c7a6b335
commit ce75d528b7

View file

@ -461,11 +461,24 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
$wgDatabase->selectDB( $wgDBname );
if( $wgDatabase->tableExists( "cur" ) ) {
print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n<pre>";
print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n";
# Create user if required
if ( $conf->Root ) {
$conn = Database::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
if ( $conn->isOpen() ) {
print "<li>DB user account ok</li>\n";
$conn->close();
} else {
print "<li>Granting user permissions...</li>\n";
dbsource( "../maintenance/users.sql", $wgDatabase );
}
}
print "<pre>\n";
chdir( ".." );
flush();
# Add missing tables
foreach ( $wgNewTables as $tableRecord ) {
add_table( $tableRecord[0], $tableRecord[1] );