r87278 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87277‎ | r87278 | r87279 >
Date:18:54, 2 May 2011
Author:demon
Status:ok
Tags:
Comment:
(bug 28375) When using existing DB user, grants aren't added to new tables
Modified paths:
  • /trunk/phase3/includes/installer/MysqlInstaller.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/MysqlInstaller.php
@@ -419,10 +419,6 @@
420420 }
421421
422422 public function setupUser() {
423 - if ( !$this->getVar( '_CreateDBAccount' ) ) {
424 - return Status::newGood();
425 - }
426 -
427423 $status = $this->getConnection();
428424 if ( !$status->isOK() ) {
429425 return $status;
@@ -436,21 +432,26 @@
437433 $password = $this->getVar( 'wgDBpassword' );
438434 $grantableNames = array();
439435
440 - // Before we blindly try to create a user that already has access,
441 - try { // first attempt to connect to the database
442 - new DatabaseMysql(
443 - $server,
444 - $dbUser,
445 - $password,
446 - false,
447 - false,
448 - 0,
449 - $this->getVar( 'wgDBprefix' )
450 - );
 436+ if ( $this->getVar( '_CreateDBAccount' ) ) {
 437+ // Before we blindly try to create a user that already has access,
 438+ try { // first attempt to connect to the database
 439+ new DatabaseMysql(
 440+ $server,
 441+ $dbUser,
 442+ $password,
 443+ false,
 444+ false,
 445+ 0,
 446+ $this->getVar( 'wgDBprefix' )
 447+ );
 448+ $grantableNames[] = $this->buildFullUserName( $dbUser, $server );
 449+ $tryToCreate = false;
 450+ } catch ( DBConnectionError $e ) {
 451+ $tryToCreate = true;
 452+ }
 453+ } else {
451454 $grantableNames[] = $this->buildFullUserName( $dbUser, $server );
452455 $tryToCreate = false;
453 - } catch ( DBConnectionError $e ) {
454 - $tryToCreate = true;
455456 }
456457
457458 if( $tryToCreate ) {

Sign-offs

UserFlagDate
Reedyinspected16:17, 3 May 2011
Reedytested16:17, 3 May 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r87332MFT r87278reedy16:08, 3 May 2011
r87512Fix for r87278: if we're installing with the same user we're going to use, sk...demon21:28, 5 May 2011

Status & tagging log