Index: branches/REL1_17/phase3/includes/User.php |
— | — | @@ -2537,14 +2537,14 @@ |
2538 | 2538 | * Save this user's settings into the database. |
2539 | 2539 | * @todo Only rarely do all these fields need to be set! |
2540 | 2540 | */ |
2541 | | - function saveSettings() { |
| 2541 | + function saveSettings( $dbw = null ) { |
2542 | 2542 | $this->load(); |
2543 | 2543 | if ( wfReadOnly() ) { return; } |
2544 | 2544 | if ( 0 == $this->mId ) { return; } |
2545 | 2545 | |
2546 | 2546 | $this->mTouched = self::newTouchedTimestamp(); |
2547 | 2547 | |
2548 | | - $dbw = wfGetDB( DB_MASTER ); |
| 2548 | + if( $dbw === null ) $dbw = wfGetDB( DB_MASTER ); |
2549 | 2549 | $dbw->update( 'user', |
2550 | 2550 | array( /* SET */ |
2551 | 2551 | 'user_name' => $this->mName, |
— | — | @@ -2574,11 +2574,11 @@ |
2575 | 2575 | /** |
2576 | 2576 | * If only this user's username is known, and it exists, return the user ID. |
2577 | 2577 | */ |
2578 | | - function idForName() { |
| 2578 | + function idForName( $dbr = null ) { |
2579 | 2579 | $s = trim( $this->getName() ); |
2580 | 2580 | if ( $s === '' ) return 0; |
2581 | 2581 | |
2582 | | - $dbr = wfGetDB( DB_SLAVE ); |
| 2582 | + if( $dbr == null ) $dbr = wfGetDB( DB_SLAVE ); |
2583 | 2583 | $id = $dbr->selectField( 'user', 'user_id', array( 'user_name' => $s ), __METHOD__ ); |
2584 | 2584 | if ( $id === false ) { |
2585 | 2585 | $id = 0; |
Index: branches/REL1_17/phase3/includes/installer/Installer.php |
— | — | @@ -1382,7 +1382,7 @@ |
1383 | 1383 | return Status::newFatal( 'config-admin-error-user', $name ); |
1384 | 1384 | } |
1385 | 1385 | |
1386 | | - if ( $user->idForName() == 0 ) { |
| 1386 | + if ( $user->idForName( $db ) == 0 ) { |
1387 | 1387 | $user->addToDatabase( $db ); |
1388 | 1388 | |
1389 | 1389 | try { |