Index: trunk/phase3/includes/User.php |
— | — | @@ -2457,9 +2457,15 @@ |
2458 | 2458 | |
2459 | 2459 | /** |
2460 | 2460 | * Set the default cookies for this session on the user's client. |
| 2461 | + * |
| 2462 | + * @param $request WebRequest object to use; $wgRequest will be used if null |
| 2463 | + * is passed. |
2461 | 2464 | */ |
2462 | | - function setCookies() { |
2463 | | - global $wgRequest; |
| 2465 | + function setCookies( $request = null ) { |
| 2466 | + if ( $request === null ) { |
| 2467 | + global $wgRequest; |
| 2468 | + $request = $wgRequest; |
| 2469 | + } |
2464 | 2470 | |
2465 | 2471 | $this->load(); |
2466 | 2472 | if ( 0 == $this->mId ) return; |
— | — | @@ -2481,7 +2487,7 @@ |
2482 | 2488 | wfRunHooks( 'UserSetCookies', array( $this, &$session, &$cookies ) ); |
2483 | 2489 | |
2484 | 2490 | foreach ( $session as $name => $value ) { |
2485 | | - $wgRequest->setSessionData( $name, $value ); |
| 2491 | + $request->setSessionData( $name, $value ); |
2486 | 2492 | } |
2487 | 2493 | foreach ( $cookies as $name => $value ) { |
2488 | 2494 | if ( $value === false ) { |
Index: trunk/phase3/includes/api/ApiLogin.php |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | switch ( $authRes = $loginForm->authenticateUserData() ) { |
77 | 77 | case LoginForm::SUCCESS: |
78 | 78 | $wgUser->setOption( 'rememberpassword', 1 ); |
79 | | - $wgUser->setCookies(); |
| 79 | + $wgUser->setCookies( $this->getMain()->getRequest() ); |
80 | 80 | |
81 | 81 | // Run hooks. FIXME: split back and frontend from this hook. |
82 | 82 | // FIXME: This hook should be placed in the backend |