From 5c336585dfe64868cadd4cf5837ccadcb678dd82 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Mon, 2 May 2011 18:54:31 +0000 Subject: [PATCH] (bug 28375) When using existing DB user, grants aren't added to new tables --- includes/installer/MysqlInstaller.php | 35 ++++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/includes/installer/MysqlInstaller.php b/includes/installer/MysqlInstaller.php index 7ef8ddf3bf..467f0e7a60 100644 --- a/includes/installer/MysqlInstaller.php +++ b/includes/installer/MysqlInstaller.php @@ -419,10 +419,6 @@ class MysqlInstaller extends DatabaseInstaller { } public function setupUser() { - if ( !$this->getVar( '_CreateDBAccount' ) ) { - return Status::newGood(); - } - $status = $this->getConnection(); if ( !$status->isOK() ) { return $status; @@ -436,21 +432,26 @@ class MysqlInstaller extends DatabaseInstaller { $password = $this->getVar( 'wgDBpassword' ); $grantableNames = array(); - // Before we blindly try to create a user that already has access, - try { // first attempt to connect to the database - new DatabaseMysql( - $server, - $dbUser, - $password, - false, - false, - 0, - $this->getVar( 'wgDBprefix' ) - ); + if ( $this->getVar( '_CreateDBAccount' ) ) { + // Before we blindly try to create a user that already has access, + try { // first attempt to connect to the database + new DatabaseMysql( + $server, + $dbUser, + $password, + false, + false, + 0, + $this->getVar( 'wgDBprefix' ) + ); + $grantableNames[] = $this->buildFullUserName( $dbUser, $server ); + $tryToCreate = false; + } catch ( DBConnectionError $e ) { + $tryToCreate = true; + } + } else { $grantableNames[] = $this->buildFullUserName( $dbUser, $server ); $tryToCreate = false; - } catch ( DBConnectionError $e ) { - $tryToCreate = true; } if( $tryToCreate ) { -- 2.20.1