Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| InstallerSessionProvider | |
0.00% |
0 / 8 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| provideSessionInfo | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| persistsSessionId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| canChangeUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| persistSession | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| unpersistSession | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Session provider which always provides the same session ID and doesn't |
| 4 | * persist the session. For use in the installer when ObjectCache doesn't |
| 5 | * work anyway. |
| 6 | * |
| 7 | * @license GPL-2.0-or-later |
| 8 | * @file |
| 9 | * @ingroup Installer |
| 10 | */ |
| 11 | |
| 12 | namespace MediaWiki\Installer; |
| 13 | |
| 14 | use MediaWiki\Request\WebRequest; |
| 15 | use MediaWiki\Session\SessionBackend; |
| 16 | use MediaWiki\Session\SessionInfo; |
| 17 | use MediaWiki\Session\SessionProvider; |
| 18 | |
| 19 | class InstallerSessionProvider extends SessionProvider { |
| 20 | /** |
| 21 | * Pretend there is a session, to avoid MWCryptRand overhead |
| 22 | * @param WebRequest $request |
| 23 | * @return SessionInfo |
| 24 | */ |
| 25 | public function provideSessionInfo( WebRequest $request ) { |
| 26 | return new SessionInfo( 1, [ |
| 27 | 'provider' => $this, |
| 28 | 'id' => str_repeat( 'x', 32 ), |
| 29 | ] ); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Yes we will treat your data with great care! |
| 34 | * @return bool |
| 35 | */ |
| 36 | public function persistsSessionId() { |
| 37 | return true; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Sure, you can be whoever you want, as long as you have ID 0 |
| 42 | * @return bool |
| 43 | */ |
| 44 | public function canChangeUser() { |
| 45 | return true; |
| 46 | } |
| 47 | |
| 48 | public function persistSession( SessionBackend $session, WebRequest $request ) { |
| 49 | } |
| 50 | |
| 51 | public function unpersistSession( WebRequest $request ) { |
| 52 | } |
| 53 | } |