MediaWiki  master
LocalPasswordPrimaryAuthenticationProviderTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace MediaWiki\Auth;
4 
11 
12  private $manager = null;
13  private $config = null;
14  private $validity = null;
15 
16  protected function setUp() {
18 
19  parent::setUp();
20  if ( $wgDisableAuthManager ) {
21  $this->markTestSkipped( '$wgDisableAuthManager is set' );
22  }
23  }
24 
34  protected function getProvider( $loginOnly = false ) {
35  if ( !$this->config ) {
36  $this->config = new \HashConfig();
37  }
38  $config = new \MultiConfig( [
39  $this->config,
40  \ConfigFactory::getDefaultInstance()->makeConfig( 'main' )
41  ] );
42 
43  if ( !$this->manager ) {
44  $this->manager = new AuthManager( new \FauxRequest(), $config );
45  }
46  $this->validity = \Status::newGood();
47 
48  $provider = $this->getMock(
50  [ 'checkPasswordValidity' ],
51  [ [ 'loginOnly' => $loginOnly ] ]
52  );
53  $provider->expects( $this->any() )->method( 'checkPasswordValidity' )
54  ->will( $this->returnCallback( function () {
55  return $this->validity;
56  } ) );
57  $provider->setConfig( $config );
58  $provider->setLogger( new \Psr\Log\NullLogger() );
59  $provider->setManager( $this->manager );
60 
61  return $provider;
62  }
63 
64  public function testBasics() {
65  $user = $this->getMutableTestUser()->getUser();
66  $userName = $user->getName();
67  $lowerInitialUserName = mb_strtolower( $userName[0] ) . substr( $userName, 1 );
68 
70 
71  $this->assertSame(
73  $provider->accountCreationType()
74  );
75 
76  $this->assertTrue( $provider->testUserExists( $userName ) );
77  $this->assertTrue( $provider->testUserExists( $lowerInitialUserName ) );
78  $this->assertFalse( $provider->testUserExists( 'DoesNotExist' ) );
79  $this->assertFalse( $provider->testUserExists( '<invalid>' ) );
80 
81  $provider = new LocalPasswordPrimaryAuthenticationProvider( [ 'loginOnly' => true ] );
82 
83  $this->assertSame(
85  $provider->accountCreationType()
86  );
87 
88  $this->assertTrue( $provider->testUserExists( $userName ) );
89  $this->assertFalse( $provider->testUserExists( 'DoesNotExist' ) );
90 
92  $req->action = AuthManager::ACTION_CHANGE;
93  $req->username = '<invalid>';
94  $provider->providerChangeAuthenticationData( $req );
95  }
96 
97  public function testTestUserCanAuthenticate() {
98  $user = $this->getMutableTestUser()->getUser();
99  $userName = $user->getName();
100  $dbw = wfGetDB( DB_MASTER );
101 
102  $provider = $this->getProvider();
103 
104  $this->assertFalse( $provider->testUserCanAuthenticate( '<invalid>' ) );
105 
106  $this->assertFalse( $provider->testUserCanAuthenticate( 'DoesNotExist' ) );
107 
108  $this->assertTrue( $provider->testUserCanAuthenticate( $userName ) );
109  $lowerInitialUserName = mb_strtolower( $userName[0] ) . substr( $userName, 1 );
110  $this->assertTrue( $provider->testUserCanAuthenticate( $lowerInitialUserName ) );
111 
112  $dbw->update(
113  'user',
114  [ 'user_password' => \PasswordFactory::newInvalidPassword()->toString() ],
115  [ 'user_name' => $userName ]
116  );
117  $this->assertFalse( $provider->testUserCanAuthenticate( $userName ) );
118 
119  // Really old format
120  $dbw->update(
121  'user',
122  [ 'user_password' => '0123456789abcdef0123456789abcdef' ],
123  [ 'user_name' => $userName ]
124  );
125  $this->assertTrue( $provider->testUserCanAuthenticate( $userName ) );
126  }
127 
128  public function testSetPasswordResetFlag() {
129  // Set instance vars
130  $this->getProvider();
131 
133  $this->setMwGlobals( [ 'wgPasswordExpireGrace' => 100 ] );
134 
135  $this->config->set( 'PasswordExpireGrace', 100 );
136  $this->config->set( 'InvalidPasswordReset', true );
137 
139  $provider->setConfig( $this->config );
140  $provider->setLogger( new \Psr\Log\NullLogger() );
141  $provider->setManager( $this->manager );
142  $providerPriv = \TestingAccessWrapper::newFromObject( $provider );
143 
144  $user = $this->getMutableTestUser()->getUser();
145  $userName = $user->getName();
146  $dbw = wfGetDB( DB_MASTER );
147  $row = $dbw->selectRow(
148  'user',
149  '*',
150  [ 'user_name' => $userName ],
151  __METHOD__
152  );
153 
154  $this->manager->removeAuthenticationSessionData( null );
155  $row->user_password_expires = wfTimestamp( TS_MW, time() + 200 );
156  $providerPriv->setPasswordResetFlag( $userName, \Status::newGood(), $row );
157  $this->assertNull( $this->manager->getAuthenticationSessionData( 'reset-pass' ) );
158 
159  $this->manager->removeAuthenticationSessionData( null );
160  $row->user_password_expires = wfTimestamp( TS_MW, time() - 200 );
161  $providerPriv->setPasswordResetFlag( $userName, \Status::newGood(), $row );
162  $ret = $this->manager->getAuthenticationSessionData( 'reset-pass' );
163  $this->assertNotNull( $ret );
164  $this->assertSame( 'resetpass-expired', $ret->msg->getKey() );
165  $this->assertTrue( $ret->hard );
166 
167  $this->manager->removeAuthenticationSessionData( null );
168  $row->user_password_expires = wfTimestamp( TS_MW, time() - 1 );
169  $providerPriv->setPasswordResetFlag( $userName, \Status::newGood(), $row );
170  $ret = $this->manager->getAuthenticationSessionData( 'reset-pass' );
171  $this->assertNotNull( $ret );
172  $this->assertSame( 'resetpass-expired-soft', $ret->msg->getKey() );
173  $this->assertFalse( $ret->hard );
174 
175  $this->manager->removeAuthenticationSessionData( null );
176  $row->user_password_expires = null;
178  $status->error( 'testing' );
179  $providerPriv->setPasswordResetFlag( $userName, $status, $row );
180  $ret = $this->manager->getAuthenticationSessionData( 'reset-pass' );
181  $this->assertNotNull( $ret );
182  $this->assertSame( 'resetpass-validity-soft', $ret->msg->getKey() );
183  $this->assertFalse( $ret->hard );
184  }
185 
186  public function testAuthentication() {
187  $testUser = $this->getMutableTestUser();
188  $userName = $testUser->getUser()->getName();
189 
190  $dbw = wfGetDB( DB_MASTER );
191  $id = \User::idFromName( $userName );
192 
196 
197  $provider = $this->getProvider();
198 
199  // General failures
200  $this->assertEquals(
202  $provider->beginPrimaryAuthentication( [] )
203  );
204 
205  $req->username = 'foo';
206  $req->password = null;
207  $this->assertEquals(
209  $provider->beginPrimaryAuthentication( $reqs )
210  );
211 
212  $req->username = null;
213  $req->password = 'bar';
214  $this->assertEquals(
216  $provider->beginPrimaryAuthentication( $reqs )
217  );
218 
219  $req->username = '<invalid>';
220  $req->password = 'WhoCares';
221  $ret = $provider->beginPrimaryAuthentication( $reqs );
222  $this->assertEquals(
224  $provider->beginPrimaryAuthentication( $reqs )
225  );
226 
227  $req->username = 'DoesNotExist';
228  $req->password = 'DoesNotExist';
229  $ret = $provider->beginPrimaryAuthentication( $reqs );
230  $this->assertEquals(
232  $provider->beginPrimaryAuthentication( $reqs )
233  );
234 
235  // Validation failure
236  $req->username = $userName;
237  $req->password = $testUser->getPassword();
238  $this->validity = \Status::newFatal( 'arbitrary-failure' );
239  $ret = $provider->beginPrimaryAuthentication( $reqs );
240  $this->assertEquals(
242  $ret->status
243  );
244  $this->assertEquals(
245  'arbitrary-failure',
246  $ret->message->getKey()
247  );
248 
249  // Successful auth
250  $this->manager->removeAuthenticationSessionData( null );
251  $this->validity = \Status::newGood();
252  $this->assertEquals(
253  AuthenticationResponse::newPass( $userName ),
254  $provider->beginPrimaryAuthentication( $reqs )
255  );
256  $this->assertNull( $this->manager->getAuthenticationSessionData( 'reset-pass' ) );
257 
258  // Successful auth after normalizing name
259  $this->manager->removeAuthenticationSessionData( null );
260  $this->validity = \Status::newGood();
261  $req->username = mb_strtolower( $userName[0] ) . substr( $userName, 1 );
262  $this->assertEquals(
263  AuthenticationResponse::newPass( $userName ),
264  $provider->beginPrimaryAuthentication( $reqs )
265  );
266  $this->assertNull( $this->manager->getAuthenticationSessionData( 'reset-pass' ) );
267  $req->username = $userName;
268 
269  // Successful auth with reset
270  $this->manager->removeAuthenticationSessionData( null );
271  $this->validity->error( 'arbitrary-warning' );
272  $this->assertEquals(
273  AuthenticationResponse::newPass( $userName ),
274  $provider->beginPrimaryAuthentication( $reqs )
275  );
276  $this->assertNotNull( $this->manager->getAuthenticationSessionData( 'reset-pass' ) );
277 
278  // Wrong password
279  $this->validity = \Status::newGood();
280  $req->password = 'Wrong';
281  $ret = $provider->beginPrimaryAuthentication( $reqs );
282  $this->assertEquals(
284  $ret->status
285  );
286  $this->assertEquals(
287  'wrongpassword',
288  $ret->message->getKey()
289  );
290 
291  // Correct handling of legacy encodings
292  $password = ':B:salt:' . md5( 'salt-' . md5( "\xe1\xe9\xed\xf3\xfa" ) );
293  $dbw->update( 'user', [ 'user_password' => $password ], [ 'user_name' => $userName ] );
294  $req->password = 'áéíóú';
295  $ret = $provider->beginPrimaryAuthentication( $reqs );
296  $this->assertEquals(
298  $ret->status
299  );
300  $this->assertEquals(
301  'wrongpassword',
302  $ret->message->getKey()
303  );
304 
305  $this->config->set( 'LegacyEncoding', true );
306  $this->assertEquals(
307  AuthenticationResponse::newPass( $userName ),
308  $provider->beginPrimaryAuthentication( $reqs )
309  );
310 
311  $req->password = 'áéíóú Wrong';
312  $ret = $provider->beginPrimaryAuthentication( $reqs );
313  $this->assertEquals(
315  $ret->status
316  );
317  $this->assertEquals(
318  'wrongpassword',
319  $ret->message->getKey()
320  );
321 
322  // Correct handling of really old password hashes
323  $this->config->set( 'PasswordSalt', false );
324  $password = md5( 'FooBar' );
325  $dbw->update( 'user', [ 'user_password' => $password ], [ 'user_name' => $userName ] );
326  $req->password = 'FooBar';
327  $this->assertEquals(
328  AuthenticationResponse::newPass( $userName ),
329  $provider->beginPrimaryAuthentication( $reqs )
330  );
331 
332  $this->config->set( 'PasswordSalt', true );
333  $password = md5( "$id-" . md5( 'FooBar' ) );
334  $dbw->update( 'user', [ 'user_password' => $password ], [ 'user_name' => $userName ] );
335  $req->password = 'FooBar';
336  $this->assertEquals(
337  AuthenticationResponse::newPass( $userName ),
338  $provider->beginPrimaryAuthentication( $reqs )
339  );
340 
341  }
342 
352  \StatusValue $expect1, \StatusValue $expect2
353  ) {
355  $req = new $type();
357  $req = new $type( [] );
358  } else {
359  $req = $this->getMock( $type );
360  }
362  $req->username = $user;
363  $req->password = 'NewPassword';
364  $req->retype = 'NewPassword';
365 
366  $provider = $this->getProvider();
367  $this->validity = $validity;
368  $this->assertEquals( $expect1, $provider->providerAllowsAuthenticationDataChange( $req, false ) );
369  $this->assertEquals( $expect2, $provider->providerAllowsAuthenticationDataChange( $req, true ) );
370 
371  $req->retype = 'BadRetype';
372  $this->assertEquals(
373  $expect1,
374  $provider->providerAllowsAuthenticationDataChange( $req, false )
375  );
376  $this->assertEquals(
377  $expect2->getValue() === 'ignored' ? $expect2 : \StatusValue::newFatal( 'badretype' ),
378  $provider->providerAllowsAuthenticationDataChange( $req, true )
379  );
380 
381  $provider = $this->getProvider( true );
382  $this->assertEquals(
383  \StatusValue::newGood( 'ignored' ),
384  $provider->providerAllowsAuthenticationDataChange( $req, true ),
385  'loginOnly mode should claim to ignore all changes'
386  );
387  }
388 
390  $err = \StatusValue::newGood();
391  $err->error( 'arbitrary-warning' );
392 
393  return [
395  \StatusValue::newGood( 'ignored' ), \StatusValue::newGood( 'ignored' ) ],
401  \StatusValue::newGood(), $err ],
402  [ PasswordAuthenticationRequest::class, 'UTSysop', \Status::newFatal( 'arbitrary-error' ),
403  \StatusValue::newGood(), \StatusValue::newFatal( 'arbitrary-error' ) ],
407  \StatusValue::newGood( 'ignored' ), \StatusValue::newGood( 'ignored' ) ],
408  ];
409  }
410 
419  $usernameTransform, $type, $loginOnly, $changed ) {
420  $testUser = $this->getMutableTestUser();
421  $user = $testUser->getUser()->getName();
422  if ( is_callable( $usernameTransform ) ) {
423  $user = call_user_func( $usernameTransform, $user );
424  }
425  $cuser = ucfirst( $user );
426  $oldpass = $testUser->getPassword();
427  $newpass = 'NewPassword';
428 
429  $dbw = wfGetDB( DB_MASTER );
430  $oldExpiry = $dbw->selectField( 'user', 'user_password_expires', [ 'user_name' => $cuser ] );
431 
432  $this->mergeMwGlobalArrayValue( 'wgHooks', [
433  'ResetPasswordExpiration' => [ function ( $user, &$expires ) {
434  $expires = '30001231235959';
435  } ]
436  ] );
437 
438  $provider = $this->getProvider( $loginOnly );
439 
440  // Sanity check
441  $loginReq = new PasswordAuthenticationRequest();
442  $loginReq->action = AuthManager::ACTION_LOGIN;
443  $loginReq->username = $user;
444  $loginReq->password = $oldpass;
445  $loginReqs = [ PasswordAuthenticationRequest::class => $loginReq ];
446  $this->assertEquals(
448  $provider->beginPrimaryAuthentication( $loginReqs ),
449  'Sanity check'
450  );
451 
453  $changeReq = new $type();
454  } else {
455  $changeReq = $this->getMock( $type );
456  }
457  $changeReq->action = AuthManager::ACTION_CHANGE;
458  $changeReq->username = $user;
459  $changeReq->password = $newpass;
460  $provider->providerChangeAuthenticationData( $changeReq );
461 
462  if ( $loginOnly ) {
463  $old = 'fail';
464  $new = 'fail';
465  $expectExpiry = null;
466  } elseif ( $changed ) {
467  $old = 'fail';
468  $new = 'pass';
469  $expectExpiry = '30001231235959';
470  } else {
471  $old = 'pass';
472  $new = 'fail';
473  $expectExpiry = $oldExpiry;
474  }
475 
476  $loginReq->password = $oldpass;
477  $ret = $provider->beginPrimaryAuthentication( $loginReqs );
478  if ( $old === 'pass' ) {
479  $this->assertEquals(
481  $ret,
482  'old password should pass'
483  );
484  } else {
485  $this->assertEquals(
487  $ret->status,
488  'old password should fail'
489  );
490  $this->assertEquals(
491  'wrongpassword',
492  $ret->message->getKey(),
493  'old password should fail'
494  );
495  }
496 
497  $loginReq->password = $newpass;
498  $ret = $provider->beginPrimaryAuthentication( $loginReqs );
499  if ( $new === 'pass' ) {
500  $this->assertEquals(
502  $ret,
503  'new password should pass'
504  );
505  } else {
506  $this->assertEquals(
508  $ret->status,
509  'new password should fail'
510  );
511  $this->assertEquals(
512  'wrongpassword',
513  $ret->message->getKey(),
514  'new password should fail'
515  );
516  }
517 
518  $this->assertSame(
519  $expectExpiry,
520  $dbw->selectField( 'user', 'user_password_expires', [ 'user_name' => $cuser ] )
521  );
522  }
523 
524  public static function provideProviderChangeAuthenticationData() {
525  return [
526  [ false, AuthenticationRequest::class, false, false ],
527  [ false, PasswordAuthenticationRequest::class, false, true ],
528  [ false, AuthenticationRequest::class, true, false ],
529  [ false, PasswordAuthenticationRequest::class, true, true ],
530  [ 'ucfirst', PasswordAuthenticationRequest::class, false, true ],
531  [ 'ucfirst', PasswordAuthenticationRequest::class, true, true ],
532  ];
533  }
534 
535  public function testTestForAccountCreation() {
536  $user = \User::newFromName( 'foo' );
539  $req->username = 'Foo';
540  $req->password = 'Bar';
541  $req->retype = 'Bar';
543 
544  $provider = $this->getProvider();
545  $this->assertEquals(
547  $provider->testForAccountCreation( $user, $user, [] ),
548  'No password request'
549  );
550 
551  $this->assertEquals(
553  $provider->testForAccountCreation( $user, $user, $reqs ),
554  'Password request, validated'
555  );
556 
557  $req->retype = 'Baz';
558  $this->assertEquals(
559  \StatusValue::newFatal( 'badretype' ),
560  $provider->testForAccountCreation( $user, $user, $reqs ),
561  'Password request, bad retype'
562  );
563  $req->retype = 'Bar';
564 
565  $this->validity->error( 'arbitrary warning' );
566  $expect = \StatusValue::newGood();
567  $expect->error( 'arbitrary warning' );
568  $this->assertEquals(
569  $expect,
570  $provider->testForAccountCreation( $user, $user, $reqs ),
571  'Password request, not validated'
572  );
573 
574  $provider = $this->getProvider( true );
575  $this->validity->error( 'arbitrary warning' );
576  $this->assertEquals(
578  $provider->testForAccountCreation( $user, $user, $reqs ),
579  'Password request, not validated, loginOnly'
580  );
581  }
582 
583  public function testAccountCreation() {
584  $user = \User::newFromName( 'Foo' );
585 
589 
590  $provider = $this->getProvider( true );
591  try {
592  $provider->beginPrimaryAccountCreation( $user, $user, [] );
593  $this->fail( 'Expected exception was not thrown' );
594  } catch ( \BadMethodCallException $ex ) {
595  $this->assertSame(
596  'Shouldn\'t call this when accountCreationType() is NONE', $ex->getMessage()
597  );
598  }
599 
600  try {
601  $provider->finishAccountCreation( $user, $user, AuthenticationResponse::newPass() );
602  $this->fail( 'Expected exception was not thrown' );
603  } catch ( \BadMethodCallException $ex ) {
604  $this->assertSame(
605  'Shouldn\'t call this when accountCreationType() is NONE', $ex->getMessage()
606  );
607  }
608 
609  $provider = $this->getProvider( false );
610 
611  $this->assertEquals(
613  $provider->beginPrimaryAccountCreation( $user, $user, [] )
614  );
615 
616  $req->username = 'foo';
617  $req->password = null;
618  $this->assertEquals(
620  $provider->beginPrimaryAccountCreation( $user, $user, $reqs )
621  );
622 
623  $req->username = null;
624  $req->password = 'bar';
625  $this->assertEquals(
627  $provider->beginPrimaryAccountCreation( $user, $user, $reqs )
628  );
629 
630  $req->username = 'foo';
631  $req->password = 'bar';
632 
633  $expect = AuthenticationResponse::newPass( 'Foo' );
634  $expect->createRequest = clone( $req );
635  $expect->createRequest->username = 'Foo';
636  $this->assertEquals( $expect, $provider->beginPrimaryAccountCreation( $user, $user, $reqs ) );
637 
638  // We have to cheat a bit to avoid having to add a new user to
639  // the database to test the actual setting of the password works right
640  $dbw = wfGetDB( DB_MASTER );
641 
642  $user = \User::newFromName( 'UTSysop' );
643  $req->username = $user->getName();
644  $req->password = 'NewPassword';
645  $expect = AuthenticationResponse::newPass( 'UTSysop' );
646  $expect->createRequest = $req;
647 
648  $res2 = $provider->beginPrimaryAccountCreation( $user, $user, $reqs );
649  $this->assertEquals( $expect, $res2, 'Sanity check' );
650 
651  $ret = $provider->beginPrimaryAuthentication( $reqs );
652  $this->assertEquals( AuthenticationResponse::FAIL, $ret->status, 'sanity check' );
653 
654  $this->assertNull( $provider->finishAccountCreation( $user, $user, $res2 ) );
655  $ret = $provider->beginPrimaryAuthentication( $reqs );
656  $this->assertEquals( AuthenticationResponse::PASS, $ret->status, 'new password is set' );
657 
658  }
659 
660 }
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
Definition: User.php:522
mergeMwGlobalArrayValue($name, $values)
Merges the given values into a MW global array variable.
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
static wrap($sv)
Succinct helper method to wrap a StatusValue.
Definition: Status.php:79
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:189
static newFatal($message)
Factory function for fatal errors.
Definition: StatusValue.php:63
Generic operation result class Has warning/error list, boolean status and arbitrary value...
Definition: Status.php:40
A primary authentication provider that uses the password field in the 'user' table.
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
static newFatal($message)
Factory function for fatal errors.
Definition: Status.php:89
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
Definition: hooks.txt:1816
const FAIL
Indicates that the authentication failed.
const ACTION_CHANGE
Change a user's credentials.
Definition: AuthManager.php:60
const PASS
Indicates that the authentication succeeded.
Generic operation result class Has warning/error list, boolean status and arbitrary value...
Definition: StatusValue.php:42
testProviderChangeAuthenticationData($usernameTransform, $type, $loginOnly, $changed)
provideProviderChangeAuthenticationData
static newGood($value=null)
Factory function for good results.
Definition: StatusValue.php:76
This serves as the entry point to the authentication system.
Definition: AuthManager.php:43
const TYPE_NONE
Provider cannot create or link to accounts.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Definition: hooks.txt:1816
static newInvalidPassword()
Create an InvalidPassword.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Definition: hooks.txt:242
This is a value object for authentication requests with a username and password.
static getDefaultInstance()
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
this hook is for auditing only $req
Definition: hooks.txt:981
AuthManager Database MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider.
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
WebRequest clone which takes values from a provided array.
Definition: FauxRequest.php:33
$wgDisableAuthManager
Disable AuthManager.
static idFromName($name, $flags=self::READ_NORMAL)
Get database id given a user name.
Definition: User.php:764
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
Definition: hooks.txt:1020
static getMutableTestUser($groups=[])
Convenience method for getting a mutable test user.
const ACTION_CREATE
Create a new user.
Definition: AuthManager.php:50
const DB_MASTER
Definition: Defines.php:47
static newFromObject($object)
Return the same object, without access restrictions.
const ACTION_LOGIN
Log in with an existing (not necessarily local) user.
Definition: AuthManager.php:45
setMwGlobals($pairs, $value=null)
testProviderAllowsAuthenticationDataChange($type, $user,\Status $validity,\StatusValue $expect1,\StatusValue $expect2)
provideProviderAllowsAuthenticationDataChange
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Definition: hooks.txt:2376
static newGood($value=null)
Factory function for good results.
Definition: Status.php:101