Index: branches/REL1_17/phase3/includes/User.php |
— | — | @@ -2162,8 +2162,8 @@ |
2163 | 2163 | * This takes immediate effect. |
2164 | 2164 | * @param $group \string Name of the group to add |
2165 | 2165 | */ |
2166 | | - function addGroup( $group, $dbw = null ) { |
2167 | | - if( $dbw === null ) $dbw = wfGetDB( DB_MASTER ); |
| 2166 | + function addGroup( $group ) { |
| 2167 | + $dbw = wfGetDB( DB_MASTER ); |
2168 | 2168 | if( $this->getId() ) { |
2169 | 2169 | $dbw->insert( 'user_groups', |
2170 | 2170 | array( |
— | — | @@ -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( $dbw = null ) { |
| 2541 | + function saveSettings() { |
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 | | - if( $dbw === null ) $dbw = wfGetDB( DB_MASTER ); |
| 2548 | + $dbw = wfGetDB( DB_MASTER ); |
2549 | 2549 | $dbw->update( 'user', |
2550 | 2550 | array( /* SET */ |
2551 | 2551 | 'user_name' => $this->mName, |
— | — | @@ -2564,7 +2564,7 @@ |
2565 | 2565 | ), __METHOD__ |
2566 | 2566 | ); |
2567 | 2567 | |
2568 | | - $this->saveOptions( $dbw ); |
| 2568 | + $this->saveOptions(); |
2569 | 2569 | |
2570 | 2570 | wfRunHooks( 'UserSaveSettings', array( $this ) ); |
2571 | 2571 | $this->clearSharedCache(); |
— | — | @@ -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( $dbr = null ) { |
| 2578 | + function idForName() { |
2579 | 2579 | $s = trim( $this->getName() ); |
2580 | 2580 | if ( $s === '' ) return 0; |
2581 | 2581 | |
2582 | | - if( $dbr == null ) $dbr = wfGetDB( DB_SLAVE ); |
| 2582 | + $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; |
— | — | @@ -2641,9 +2641,9 @@ |
2642 | 2642 | /** |
2643 | 2643 | * Add this existing user object to the database |
2644 | 2644 | */ |
2645 | | - function addToDatabase( $dbw = null ) { |
| 2645 | + function addToDatabase() { |
2646 | 2646 | $this->load(); |
2647 | | - if( $dbw === null ) $dbw = wfGetDB( DB_MASTER ); |
| 2647 | + $dbw = wfGetDB( DB_MASTER ); |
2648 | 2648 | $seqVal = $dbw->nextSequenceValue( 'user_user_id_seq' ); |
2649 | 2649 | $dbw->insert( 'user', |
2650 | 2650 | array( |
— | — | @@ -2666,7 +2666,7 @@ |
2667 | 2667 | // Clear instance cache other than user table data, which is already accurate |
2668 | 2668 | $this->clearInstanceCache(); |
2669 | 2669 | |
2670 | | - $this->saveOptions( $dbw ); |
| 2670 | + $this->saveOptions(); |
2671 | 2671 | } |
2672 | 2672 | |
2673 | 2673 | /** |
— | — | @@ -3684,13 +3684,13 @@ |
3685 | 3685 | wfRunHooks( 'UserLoadOptions', array( $this, &$this->mOptions ) ); |
3686 | 3686 | } |
3687 | 3687 | |
3688 | | - protected function saveOptions( $dbw = null ) { |
| 3688 | + protected function saveOptions() { |
3689 | 3689 | global $wgAllowPrefChange; |
3690 | 3690 | |
3691 | 3691 | $extuser = ExternalUser::newFromUser( $this ); |
3692 | 3692 | |
3693 | 3693 | $this->loadOptions(); |
3694 | | - if( $dbw === null ) $dbw = wfGetDB( DB_MASTER ); |
| 3694 | + $dbw = wfGetDB( DB_MASTER ); |
3695 | 3695 | |
3696 | 3696 | $insert_rows = array(); |
3697 | 3697 | |
Index: branches/REL1_17/phase3/includes/installer/Installer.php |
— | — | @@ -961,7 +961,7 @@ |
962 | 962 | $this->showMessage( 'config-uploads-not-safe', $dir ); |
963 | 963 | } |
964 | 964 | } |
965 | | - |
| 965 | + |
966 | 966 | /** |
967 | 967 | * Checks if suhosin.get.max_value_length is set, and if so, sets |
968 | 968 | * $wgResourceLoaderMaxQueryLength to that value in the generated |
— | — | @@ -1393,20 +1393,14 @@ |
1394 | 1394 | protected function createSysop() { |
1395 | 1395 | $name = $this->getVar( '_AdminName' ); |
1396 | 1396 | $user = User::newFromName( $name ); |
1397 | | - $status = $this->getDBInstaller()->getConnection(); |
1398 | | - if( $status->isOK() ) { |
1399 | | - $db = $status->value; |
1400 | | - } else { |
1401 | | - return Status::newFatal( 'config-admin-error-user', $name ); |
1402 | | - } |
1403 | 1397 | |
1404 | 1398 | if ( !$user ) { |
1405 | 1399 | // We should've validated this earlier anyway! |
1406 | 1400 | return Status::newFatal( 'config-admin-error-user', $name ); |
1407 | 1401 | } |
1408 | 1402 | |
1409 | | - if ( $user->idForName( $db ) == 0 ) { |
1410 | | - $user->addToDatabase( $db ); |
| 1403 | + if ( $user->idForName() == 0 ) { |
| 1404 | + $user->addToDatabase(); |
1411 | 1405 | |
1412 | 1406 | try { |
1413 | 1407 | $user->setPassword( $this->getVar( '_AdminPassword' ) ); |
— | — | @@ -1414,12 +1408,12 @@ |
1415 | 1409 | return Status::newFatal( 'config-admin-error-password', $name, $pwe->getMessage() ); |
1416 | 1410 | } |
1417 | 1411 | |
1418 | | - $user->addGroup( 'sysop', $db ); |
1419 | | - $user->addGroup( 'bureaucrat', $db ); |
| 1412 | + $user->addGroup( 'sysop' ); |
| 1413 | + $user->addGroup( 'bureaucrat' ); |
1420 | 1414 | if( $this->getVar( '_AdminEmail' ) ) { |
1421 | 1415 | $user->setEmail( $this->getVar( '_AdminEmail' ) ); |
1422 | 1416 | } |
1423 | | - $user->saveSettings( $db ); |
| 1417 | + $user->saveSettings(); |
1424 | 1418 | |
1425 | 1419 | // Update user count |
1426 | 1420 | $ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 ); |