Index: trunk/phase3/includes/User.php |
— | — | @@ -2228,9 +2228,9 @@ |
2229 | 2229 | * This takes immediate effect. |
2230 | 2230 | * @param $group String Name of the group to add |
2231 | 2231 | */ |
2232 | | - function addGroup( $group, $dbw = null ) { |
| 2232 | + function addGroup( $group ) { |
2233 | 2233 | if( wfRunHooks( 'UserAddGroup', array( &$this, &$group ) ) ) { |
2234 | | - if( $dbw == null ) $dbw = wfGetDB( DB_MASTER ); |
| 2234 | + $dbw = wfGetDB( DB_MASTER ); |
2235 | 2235 | if( $this->getId() ) { |
2236 | 2236 | $dbw->insert( 'user_groups', |
2237 | 2237 | array( |
— | — | @@ -2601,14 +2601,14 @@ |
2602 | 2602 | * Save this user's settings into the database. |
2603 | 2603 | * @todo Only rarely do all these fields need to be set! |
2604 | 2604 | */ |
2605 | | - function saveSettings( $dbw = null ) { |
| 2605 | + function saveSettings() { |
2606 | 2606 | $this->load(); |
2607 | 2607 | if ( wfReadOnly() ) { return; } |
2608 | 2608 | if ( 0 == $this->mId ) { return; } |
2609 | 2609 | |
2610 | 2610 | $this->mTouched = self::newTouchedTimestamp(); |
2611 | 2611 | |
2612 | | - if( $dbw === null ) $dbw = wfGetDB( DB_MASTER ); |
| 2612 | + $dbw = wfGetDB( DB_MASTER ); |
2613 | 2613 | $dbw->update( 'user', |
2614 | 2614 | array( /* SET */ |
2615 | 2615 | 'user_name' => $this->mName, |
— | — | @@ -2628,7 +2628,7 @@ |
2629 | 2629 | ), __METHOD__ |
2630 | 2630 | ); |
2631 | 2631 | |
2632 | | - $this->saveOptions( $dbw ); |
| 2632 | + $this->saveOptions(); |
2633 | 2633 | |
2634 | 2634 | wfRunHooks( 'UserSaveSettings', array( $this ) ); |
2635 | 2635 | $this->clearSharedCache(); |
— | — | @@ -2639,11 +2639,11 @@ |
2640 | 2640 | * If only this user's username is known, and it exists, return the user ID. |
2641 | 2641 | * @return Int |
2642 | 2642 | */ |
2643 | | - function idForName( $dbr = null ) { |
| 2643 | + function idForName() { |
2644 | 2644 | $s = trim( $this->getName() ); |
2645 | 2645 | if ( $s === '' ) return 0; |
2646 | 2646 | |
2647 | | - if( $dbr == null ) $dbr = wfGetDB( DB_SLAVE ); |
| 2647 | + $dbr = wfGetDB( DB_SLAVE ); |
2648 | 2648 | $id = $dbr->selectField( 'user', 'user_id', array( 'user_name' => $s ), __METHOD__ ); |
2649 | 2649 | if ( $id === false ) { |
2650 | 2650 | $id = 0; |
— | — | @@ -2706,9 +2706,9 @@ |
2707 | 2707 | /** |
2708 | 2708 | * Add this existing user object to the database |
2709 | 2709 | */ |
2710 | | - function addToDatabase( $dbw = null ) { |
| 2710 | + function addToDatabase() { |
2711 | 2711 | $this->load(); |
2712 | | - if( $dbw === null ) $dbw = wfGetDB( DB_MASTER ); |
| 2712 | + $dbw = wfGetDB( DB_MASTER ); |
2713 | 2713 | $seqVal = $dbw->nextSequenceValue( 'user_user_id_seq' ); |
2714 | 2714 | $dbw->insert( 'user', |
2715 | 2715 | array( |
— | — | @@ -2731,7 +2731,7 @@ |
2732 | 2732 | // Clear instance cache other than user table data, which is already accurate |
2733 | 2733 | $this->clearInstanceCache(); |
2734 | 2734 | |
2735 | | - $this->saveOptions( $dbw ); |
| 2735 | + $this->saveOptions(); |
2736 | 2736 | } |
2737 | 2737 | |
2738 | 2738 | /** |
— | — | @@ -3776,13 +3776,13 @@ |
3777 | 3777 | wfRunHooks( 'UserLoadOptions', array( $this, &$this->mOptions ) ); |
3778 | 3778 | } |
3779 | 3779 | |
3780 | | - protected function saveOptions( $dbw = null ) { |
| 3780 | + protected function saveOptions() { |
3781 | 3781 | global $wgAllowPrefChange; |
3782 | 3782 | |
3783 | 3783 | $extuser = ExternalUser::newFromUser( $this ); |
3784 | 3784 | |
3785 | 3785 | $this->loadOptions(); |
3786 | | - if( $dbw === null ) $dbw = wfGetDB( DB_MASTER ); |
| 3786 | + $dbw = wfGetDB( DB_MASTER ); |
3787 | 3787 | |
3788 | 3788 | $insert_rows = array(); |
3789 | 3789 | |
Index: trunk/phase3/includes/installer/Installer.php |
— | — | @@ -1406,20 +1406,14 @@ |
1407 | 1407 | protected function createSysop() { |
1408 | 1408 | $name = $this->getVar( '_AdminName' ); |
1409 | 1409 | $user = User::newFromName( $name ); |
1410 | | - $status = $this->getDBInstaller()->getConnection(); |
1411 | | - if( $status->isOK() ) { |
1412 | | - $db = $status->value; |
1413 | | - } else { |
1414 | | - return Status::newFatal( 'config-admin-error-user', $name ); |
1415 | | - } |
1416 | 1410 | |
1417 | 1411 | if ( !$user ) { |
1418 | 1412 | // We should've validated this earlier anyway! |
1419 | 1413 | return Status::newFatal( 'config-admin-error-user', $name ); |
1420 | 1414 | } |
1421 | 1415 | |
1422 | | - if ( $user->idForName( $db ) == 0 ) { |
1423 | | - $user->addToDatabase( $db ); |
| 1416 | + if ( $user->idForName() == 0 ) { |
| 1417 | + $user->addToDatabase(); |
1424 | 1418 | |
1425 | 1419 | try { |
1426 | 1420 | $user->setPassword( $this->getVar( '_AdminPassword' ) ); |
— | — | @@ -1427,12 +1421,12 @@ |
1428 | 1422 | return Status::newFatal( 'config-admin-error-password', $name, $pwe->getMessage() ); |
1429 | 1423 | } |
1430 | 1424 | |
1431 | | - $user->addGroup( 'sysop', $db ); |
1432 | | - $user->addGroup( 'bureaucrat', $db ); |
| 1425 | + $user->addGroup( 'sysop' ); |
| 1426 | + $user->addGroup( 'bureaucrat' ); |
1433 | 1427 | if( $this->getVar( '_AdminEmail' ) ) { |
1434 | 1428 | $user->setEmail( $this->getVar( '_AdminEmail' ) ); |
1435 | 1429 | } |
1436 | | - $user->saveSettings( $db ); |
| 1430 | + $user->saveSettings(); |
1437 | 1431 | |
1438 | 1432 | // Update user count |
1439 | 1433 | $ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 ); |