MediaWiki REL1_33
BlockTest.php
Go to the documentation of this file.
1<?php
2
7
13
17 private function getUserForBlocking() {
18 $testUser = $this->getMutableTestUser();
19 $user = $testUser->getUser();
20 $user->addToDatabase();
21 TestUser::setPasswordForUser( $user, 'UTBlockeePassword' );
22 $user->saveSettings();
23 return $user;
24 }
25
32 private function addBlockForUser( User $user ) {
33 // Delete the last round's block if it's still there
34 $oldBlock = Block::newFromTarget( $user->getName() );
35 if ( $oldBlock ) {
36 // An old block will prevent our new one from saving.
37 $oldBlock->delete();
38 }
39
40 $blockOptions = [
41 'address' => $user->getName(),
42 'user' => $user->getId(),
43 'by' => $this->getTestSysop()->getUser()->getId(),
44 'reason' => 'Parce que',
45 'expiry' => time() + 100500,
46 ];
47 $block = new Block( $blockOptions );
48
49 $block->insert();
50 // save up ID for use in assertion. Since ID is an autoincrement,
51 // its value might change depending on the order the tests are run.
52 // ApiBlockTest insert its own blocks!
53 if ( !$block->getId() ) {
54 throw new MWException( "Failed to insert block for BlockTest; old leftover block remaining?" );
55 }
56
57 $this->addXffBlocks();
58
59 return $block;
60 }
61
66 $user = $this->getUserForBlocking();
67 $block = $this->addBlockForUser( $user );
68
69 $this->assertTrue(
70 $block->equals( Block::newFromTarget( $user->getName() ) ),
71 "newFromTarget() returns the same block as the one that was made"
72 );
73 }
74
79 $user = $this->getUserForBlocking();
80 $block = $this->addBlockForUser( $user );
81
82 $this->assertTrue(
83 $block->equals( Block::newFromID( $block->getId() ) ),
84 "newFromID() returns the same block as the one that was made"
85 );
86 }
87
93 $user = $this->getUserForBlocking();
94 $block = $this->addBlockForUser( $user );
95 $madeAt = wfTimestamp( TS_MW );
96
97 // delta to stop one-off errors when things happen to go over a second mark.
98 $delta = abs( $madeAt - $block->getTimestamp() );
99 $this->assertLessThan(
100 2,
101 $delta,
102 "If no timestamp is specified, the block is recorded as time()"
103 );
104 }
105
114 public function testT31116NewFromTargetWithEmptyIp( $vagueTarget ) {
115 $user = $this->getUserForBlocking();
116 $initialBlock = $this->addBlockForUser( $user );
117 $block = Block::newFromTarget( $user->getName(), $vagueTarget );
118
119 $this->assertTrue(
120 $initialBlock->equals( $block ),
121 "newFromTarget() returns the same block as the one that was made when "
122 . "given empty vagueTarget param " . var_export( $vagueTarget, true )
123 );
124 }
125
126 public static function provideT31116Data() {
127 return [
128 [ null ],
129 [ '' ],
130 [ false ]
131 ];
132 }
133
138 $username = 'BlockedUserToCreateAccountWith';
140 $u->addToDatabase();
141 $userId = $u->getId();
142 $this->assertNotEquals( 0, $userId, 'sanity' );
143 TestUser::setPasswordForUser( $u, 'NotRandomPass' );
144 unset( $u );
145
146 // Sanity check
147 $this->assertNull(
149 "$username should not be blocked"
150 );
151
152 // Reload user
154 $this->assertFalse(
155 $u->isBlockedFromCreateAccount(),
156 "Our sandbox user should be able to create account before being blocked"
157 );
158
159 // Foreign perspective (blockee not on current wiki)...
160 $blockOptions = [
161 'address' => $username,
162 'user' => $userId,
163 'reason' => 'crosswiki block...',
164 'timestamp' => wfTimestampNow(),
165 'expiry' => $this->db->getInfinity(),
166 'createAccount' => true,
167 'enableAutoblock' => true,
168 'hideName' => true,
169 'blockEmail' => true,
170 'byText' => 'm>MetaWikiUser',
171 ];
172 $block = new Block( $blockOptions );
173 $block->insert();
174
175 // Reload block from DB
176 $userBlock = Block::newFromTarget( $username );
177 $this->assertTrue(
178 (bool)$block->appliesToRight( 'createaccount' ),
179 "Block object in DB should block right 'createaccount'"
180 );
181
182 $this->assertInstanceOf(
183 Block::class,
184 $userBlock,
185 "'$username' block block object should be existent"
186 );
187
188 // Reload user
190 $this->assertTrue(
191 (bool)$u->isBlockedFromCreateAccount(),
192 "Our sandbox user '$username' should NOT be able to create account"
193 );
194 }
195
199 public function testCrappyCrossWikiBlocks() {
200 // Delete the last round's block if it's still there
201 $oldBlock = Block::newFromTarget( 'UserOnForeignWiki' );
202 if ( $oldBlock ) {
203 // An old block will prevent our new one from saving.
204 $oldBlock->delete();
205 }
206
207 // Local perspective (blockee on current wiki)...
208 $user = User::newFromName( 'UserOnForeignWiki' );
209 $user->addToDatabase();
210 $userId = $user->getId();
211 $this->assertNotEquals( 0, $userId, 'sanity' );
212
213 // Foreign perspective (blockee not on current wiki)...
214 $blockOptions = [
215 'address' => 'UserOnForeignWiki',
216 'user' => $user->getId(),
217 'reason' => 'crosswiki block...',
218 'timestamp' => wfTimestampNow(),
219 'expiry' => $this->db->getInfinity(),
220 'createAccount' => true,
221 'enableAutoblock' => true,
222 'hideName' => true,
223 'blockEmail' => true,
224 'byText' => 'Meta>MetaWikiUser',
225 ];
226 $block = new Block( $blockOptions );
227
228 $res = $block->insert( $this->db );
229 $this->assertTrue( (bool)$res['id'], 'Block succeeded' );
230
231 $user = null; // clear
232
233 $block = Block::newFromID( $res['id'] );
234 $this->assertEquals(
235 'UserOnForeignWiki',
236 $block->getTarget()->getName(),
237 'Correct blockee name'
238 );
239 $this->assertEquals( $userId, $block->getTarget()->getId(), 'Correct blockee id' );
240 $this->assertEquals( 'Meta>MetaWikiUser', $block->getBlocker()->getName(),
241 'Correct blocker name' );
242 $this->assertEquals( 'Meta>MetaWikiUser', $block->getByName(), 'Correct blocker name' );
243 $this->assertEquals( 0, $block->getBy(), 'Correct blocker id' );
244 }
245
246 protected function addXffBlocks() {
247 static $inited = false;
248
249 if ( $inited ) {
250 return;
251 }
252
253 $inited = true;
254
255 $blockList = [
256 [ 'target' => '70.2.0.0/16',
257 'type' => Block::TYPE_RANGE,
258 'desc' => 'Range Hardblock',
259 'ACDisable' => false,
260 'isHardblock' => true,
261 'isAutoBlocking' => false,
262 ],
263 [ 'target' => '2001:4860:4001::/48',
264 'type' => Block::TYPE_RANGE,
265 'desc' => 'Range6 Hardblock',
266 'ACDisable' => false,
267 'isHardblock' => true,
268 'isAutoBlocking' => false,
269 ],
270 [ 'target' => '60.2.0.0/16',
271 'type' => Block::TYPE_RANGE,
272 'desc' => 'Range Softblock with AC Disabled',
273 'ACDisable' => true,
274 'isHardblock' => false,
275 'isAutoBlocking' => false,
276 ],
277 [ 'target' => '50.2.0.0/16',
278 'type' => Block::TYPE_RANGE,
279 'desc' => 'Range Softblock',
280 'ACDisable' => false,
281 'isHardblock' => false,
282 'isAutoBlocking' => false,
283 ],
284 [ 'target' => '50.1.1.1',
285 'type' => Block::TYPE_IP,
286 'desc' => 'Exact Softblock',
287 'ACDisable' => false,
288 'isHardblock' => false,
289 'isAutoBlocking' => false,
290 ],
291 ];
292
293 $blocker = $this->getTestUser()->getUser();
294 foreach ( $blockList as $insBlock ) {
295 $target = $insBlock['target'];
296
297 if ( $insBlock['type'] === Block::TYPE_IP ) {
298 $target = User::newFromName( IP::sanitizeIP( $target ), false )->getName();
299 } elseif ( $insBlock['type'] === Block::TYPE_RANGE ) {
300 $target = IP::sanitizeRange( $target );
301 }
302
303 $block = new Block();
304 $block->setTarget( $target );
305 $block->setBlocker( $blocker );
306 $block->setReason( $insBlock['desc'] );
307 $block->setExpiry( 'infinity' );
308 $block->isCreateAccountBlocked( $insBlock['ACDisable'] );
309 $block->isHardblock( $insBlock['isHardblock'] );
310 $block->isAutoblocking( $insBlock['isAutoBlocking'] );
311 $block->insert();
312 }
313 }
314
315 public static function providerXff() {
316 return [
317 [ 'xff' => '1.2.3.4, 70.2.1.1, 60.2.1.1, 2.3.4.5',
318 'count' => 2,
319 'result' => 'Range Hardblock'
320 ],
321 [ 'xff' => '1.2.3.4, 50.2.1.1, 60.2.1.1, 2.3.4.5',
322 'count' => 2,
323 'result' => 'Range Softblock with AC Disabled'
324 ],
325 [ 'xff' => '1.2.3.4, 70.2.1.1, 50.1.1.1, 2.3.4.5',
326 'count' => 2,
327 'result' => 'Exact Softblock'
328 ],
329 [ 'xff' => '1.2.3.4, 70.2.1.1, 50.2.1.1, 50.1.1.1, 2.3.4.5',
330 'count' => 3,
331 'result' => 'Exact Softblock'
332 ],
333 [ 'xff' => '1.2.3.4, 70.2.1.1, 50.2.1.1, 2.3.4.5',
334 'count' => 2,
335 'result' => 'Range Hardblock'
336 ],
337 [ 'xff' => '1.2.3.4, 70.2.1.1, 60.2.1.1, 2.3.4.5',
338 'count' => 2,
339 'result' => 'Range Hardblock'
340 ],
341 [ 'xff' => '50.2.1.1, 60.2.1.1, 2.3.4.5',
342 'count' => 2,
343 'result' => 'Range Softblock with AC Disabled'
344 ],
345 [ 'xff' => '1.2.3.4, 50.1.1.1, 60.2.1.1, 2.3.4.5',
346 'count' => 2,
347 'result' => 'Exact Softblock'
348 ],
349 [ 'xff' => '1.2.3.4, <$A_BUNCH-OF{INVALID}TEXT>, 60.2.1.1, 2.3.4.5',
350 'count' => 1,
351 'result' => 'Range Softblock with AC Disabled'
352 ],
353 [ 'xff' => '1.2.3.4, 50.2.1.1, 2001:4860:4001:802::1003, 2.3.4.5',
354 'count' => 2,
355 'result' => 'Range6 Hardblock'
356 ],
357 ];
358 }
359
365 public function testBlocksOnXff( $xff, $exCount, $exResult ) {
366 $user = $this->getUserForBlocking();
367 $this->addBlockForUser( $user );
368
369 $list = array_map( 'trim', explode( ',', $xff ) );
370 $xffblocks = Block::getBlocksForIPList( $list, true );
371 $this->assertEquals( $exCount, count( $xffblocks ), 'Number of blocks for ' . $xff );
372 $block = Block::chooseBlock( $xffblocks, $list );
373 $this->assertEquals(
374 $exResult, $block->getReason(), 'Correct block type for XFF header ' . $xff
375 );
376 }
377
383 public function testSystemBlocks() {
384 $user = $this->getUserForBlocking();
385 $this->addBlockForUser( $user );
386
387 $blockOptions = [
388 'address' => $user->getName(),
389 'reason' => 'test system block',
390 'timestamp' => wfTimestampNow(),
391 'expiry' => $this->db->getInfinity(),
392 'byText' => 'MediaWiki default',
393 'systemBlock' => 'test',
394 'enableAutoblock' => true,
395 ];
396 $block = new Block( $blockOptions );
397
398 $this->assertSame( 'test', $block->getSystemBlockType() );
399
400 try {
401 $block->insert();
402 $this->fail( 'Expected exception not thrown' );
403 } catch ( MWException $ex ) {
404 $this->assertSame( 'Cannot insert a system block into the database', $ex->getMessage() );
405 }
406
407 try {
408 $block->doAutoblock( '192.0.2.2' );
409 $this->fail( 'Expected exception not thrown' );
410 } catch ( MWException $ex ) {
411 $this->assertSame( 'Cannot autoblock from a system block', $ex->getMessage() );
412 }
413 }
414
418 public function testNewFromRow() {
419 $badActor = $this->getTestUser()->getUser();
420 $sysop = $this->getTestSysop()->getUser();
421
422 $block = new Block( [
423 'address' => $badActor->getName(),
424 'user' => $badActor->getId(),
425 'by' => $sysop->getId(),
426 'expiry' => 'infinity',
427 ] );
428 $block->insert();
429
430 $blockQuery = Block::getQueryInfo();
431 $row = $this->db->select(
432 $blockQuery['tables'],
433 $blockQuery['fields'],
434 [
435 'ipb_id' => $block->getId(),
436 ],
437 __METHOD__,
438 [],
439 $blockQuery['joins']
440 )->fetchObject();
441
442 $block = Block::newFromRow( $row );
443 $this->assertInstanceOf( Block::class, $block );
444 $this->assertEquals( $block->getBy(), $sysop->getId() );
445 $this->assertEquals( $block->getTarget()->getName(), $badActor->getName() );
446 $block->delete();
447 }
448
452 public function testEquals() {
453 $block = new Block();
454
455 $this->assertTrue( $block->equals( $block ) );
456
457 $partial = new Block( [
458 'sitewide' => false,
459 ] );
460 $this->assertFalse( $block->equals( $partial ) );
461 }
462
466 public function testIsSitewide() {
467 $block = new Block();
468 $this->assertTrue( $block->isSitewide() );
469
470 $block = new Block( [
471 'sitewide' => true,
472 ] );
473 $this->assertTrue( $block->isSitewide() );
474
475 $block = new Block( [
476 'sitewide' => false,
477 ] );
478 $this->assertFalse( $block->isSitewide() );
479
480 $block = new Block( [
481 'sitewide' => false,
482 ] );
483 $block->isSitewide( true );
484 $this->assertTrue( $block->isSitewide() );
485 }
486
491 public function testRestrictions() {
492 $block = new Block();
493 $restrictions = [
494 new PageRestriction( 0, 1 )
495 ];
496 $block->setRestrictions( $restrictions );
497
498 $this->assertSame( $restrictions, $block->getRestrictions() );
499 }
500
506 $badActor = $this->getTestUser()->getUser();
507 $sysop = $this->getTestSysop()->getUser();
508
509 $block = new Block( [
510 'address' => $badActor->getName(),
511 'user' => $badActor->getId(),
512 'by' => $sysop->getId(),
513 'expiry' => 'infinity',
514 ] );
515 $page = $this->getExistingTestPage( 'Foo' );
516 $restriction = new PageRestriction( 0, $page->getId() );
517 $block->setRestrictions( [ $restriction ] );
518 $block->insert();
519
520 // Refresh the block from the database.
521 $block = Block::newFromID( $block->getId() );
522 $restrictions = $block->getRestrictions();
523 $this->assertCount( 1, $restrictions );
524 $this->assertTrue( $restriction->equals( $restrictions[0] ) );
525 $block->delete();
526 }
527
531 public function testInsertExistingBlock() {
532 $badActor = $this->getTestUser()->getUser();
533 $sysop = $this->getTestSysop()->getUser();
534
535 $block = new Block( [
536 'address' => $badActor->getName(),
537 'user' => $badActor->getId(),
538 'by' => $sysop->getId(),
539 'expiry' => 'infinity',
540 ] );
541 $page = $this->getExistingTestPage( 'Foo' );
542 $restriction = new PageRestriction( 0, $page->getId() );
543 $block->setRestrictions( [ $restriction ] );
544 $block->insert();
545
546 // Insert the block again, which should result in a failur
547 $result = $block->insert();
548
549 $this->assertFalse( $result );
550
551 // Ensure that there are no restrictions where the blockId is 0.
552 $count = $this->db->selectRowCount(
553 'ipblocks_restrictions',
554 '*',
555 [ 'ir_ipb_id' => 0 ],
556 __METHOD__
557 );
558 $this->assertSame( 0, $count );
559
560 $block->delete();
561 }
562
567 $this->setMwGlobals( [
568 'wgBlockDisablesLogin' => false,
569 ] );
570 $user = $this->getTestUser()->getUser();
571 $block = new Block( [
572 'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
573 'allowUsertalk' => true,
574 'sitewide' => true
575 ] );
576
577 $block->setTarget( $user );
578 $block->setBlocker( $this->getTestSysop()->getUser() );
579 $block->insert();
580
581 $title = $this->getExistingTestPage( 'Foo' )->getTitle();
582
583 $this->assertTrue( $block->appliesToTitle( $title ) );
584
585 // appliesToTitle() ignores allowUsertalk
586 $title = $user->getTalkPage();
587 $this->assertTrue( $block->appliesToTitle( $title ) );
588
589 $block->delete();
590 }
591
596 $this->setMwGlobals( [
597 'wgBlockDisablesLogin' => false,
598 ] );
599 $user = $this->getTestUser()->getUser();
600 $block = new Block( [
601 'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
602 'allowUsertalk' => true,
603 'sitewide' => false
604 ] );
605
606 $block->setTarget( $user );
607 $block->setBlocker( $this->getTestSysop()->getUser() );
608 $block->insert();
609
610 $pageFoo = $this->getExistingTestPage( 'Foo' );
611 $pageBar = $this->getExistingTestPage( 'Bar' );
612 $pageJohn = $this->getExistingTestPage( 'User:John' );
613
614 $pageRestriction = new PageRestriction( $block->getId(), $pageFoo->getId() );
615 $namespaceRestriction = new NamespaceRestriction( $block->getId(), NS_USER );
616 $this->getBlockRestrictionStore()->insert( [ $pageRestriction, $namespaceRestriction ] );
617
618 $this->assertTrue( $block->appliesToTitle( $pageFoo->getTitle() ) );
619 $this->assertFalse( $block->appliesToTitle( $pageBar->getTitle() ) );
620 $this->assertTrue( $block->appliesToTitle( $pageJohn->getTitle() ) );
621
622 $block->delete();
623 }
624
630 $this->setMwGlobals( [
631 'wgBlockDisablesLogin' => false,
632 ] );
633 $user = $this->getTestUser()->getUser();
634 $block = new Block( [
635 'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
636 'allowUsertalk' => true,
637 'sitewide' => true
638 ] );
639
640 $block->setTarget( $user );
641 $block->setBlocker( $this->getTestSysop()->getUser() );
642 $block->insert();
643
644 $title = $this->getExistingTestPage()->getTitle();
645
646 $this->assertTrue( $block->appliesToPage( $title->getArticleID() ) );
647 $this->assertTrue( $block->appliesToNamespace( NS_MAIN ) );
648 $this->assertTrue( $block->appliesToNamespace( NS_USER_TALK ) );
649
650 $block->delete();
651 }
652
657 $this->setMwGlobals( [
658 'wgBlockDisablesLogin' => false,
659 ] );
660 $user = $this->getTestUser()->getUser();
661 $block = new Block( [
662 'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
663 'allowUsertalk' => true,
664 'sitewide' => false
665 ] );
666
667 $block->setTarget( $user );
668 $block->setBlocker( $this->getTestSysop()->getUser() );
669 $block->insert();
670
671 $title = $this->getExistingTestPage()->getTitle();
672
673 $pageRestriction = new PageRestriction(
674 $block->getId(),
675 $title->getArticleID()
676 );
677 $this->getBlockRestrictionStore()->insert( [ $pageRestriction ] );
678
679 $this->assertTrue( $block->appliesToPage( $title->getArticleID() ) );
680
681 $block->delete();
682 }
683
688 $this->setMwGlobals( [
689 'wgBlockDisablesLogin' => false,
690 ] );
691 $user = $this->getTestUser()->getUser();
692 $block = new Block( [
693 'expiry' => wfTimestamp( TS_MW, wfTimestamp() + ( 40 * 60 * 60 ) ),
694 'allowUsertalk' => true,
695 'sitewide' => false
696 ] );
697
698 $block->setTarget( $user );
699 $block->setBlocker( $this->getTestSysop()->getUser() );
700 $block->insert();
701
702 $namespaceRestriction = new NamespaceRestriction( $block->getId(), NS_MAIN );
703 $this->getBlockRestrictionStore()->insert( [ $namespaceRestriction ] );
704
705 $this->assertTrue( $block->appliesToNamespace( NS_MAIN ) );
706 $this->assertFalse( $block->appliesToNamespace( NS_USER ) );
707
708 $block->delete();
709 }
710
714 public function testBlockAllowsPurge() {
715 $this->setMwGlobals( [
716 'wgBlockDisablesLogin' => false,
717 ] );
718 $block = new Block();
719 $this->assertFalse( $block->appliesToRight( 'purge' ) );
720 }
721
730}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
return[ 'abap'=> true, 'abl'=> true, 'abnf'=> true, 'aconf'=> true, 'actionscript'=> true, 'actionscript3'=> true, 'ada'=> true, 'ada2005'=> true, 'ada95'=> true, 'adl'=> true, 'agda'=> true, 'aheui'=> true, 'ahk'=> true, 'alloy'=> true, 'ambienttalk'=> true, 'ambienttalk/2'=> true, 'ampl'=> true, 'antlr'=> true, 'antlr-actionscript'=> true, 'antlr-as'=> true, 'antlr-c#'=> true, 'antlr-cpp'=> true, 'antlr-csharp'=> true, 'antlr-java'=> true, 'antlr-objc'=> true, 'antlr-perl'=> true, 'antlr-python'=> true, 'antlr-rb'=> true, 'antlr-ruby'=> true, 'apache'=> true, 'apacheconf'=> true, 'apl'=> true, 'applescript'=> true, 'arduino'=> true, 'arexx'=> true, 'as'=> true, 'as3'=> true, 'asm'=> true, 'aspectj'=> true, 'aspx-cs'=> true, 'aspx-vb'=> true, 'asy'=> true, 'asymptote'=> true, 'at'=> true, 'autohotkey'=> true, 'autoit'=> true, 'awk'=> true, 'b3d'=> true, 'basemake'=> true, 'bash'=> true, 'basic'=> true, 'bat'=> true, 'batch'=> true, 'bbcode'=> true, 'bc'=> true, 'befunge'=> true, 'bf'=> true, 'bib'=> true, 'bibtex'=> true, 'blitzbasic'=> true, 'blitzmax'=> true, 'bmax'=> true, 'bnf'=> true, 'boo'=> true, 'boogie'=> true, 'bplus'=> true, 'brainfuck'=> true, 'bro'=> true, 'bsdmake'=> true, 'bst'=> true, 'bst-pybtex'=> true, 'bugs'=> true, 'c'=> true, 'c#'=> true, 'c++'=> true, 'c++-objdumb'=> true, 'c-objdump'=> true, 'ca65'=> true, 'cadl'=> true, 'camkes'=> true, 'capdl'=> true, 'capnp'=> true, 'cbmbas'=> true, 'ceylon'=> true, 'cf3'=> true, 'cfc'=> true, 'cfengine3'=> true, 'cfg'=> true, 'cfm'=> true, 'cfs'=> true, 'chai'=> true, 'chaiscript'=> true, 'chapel'=> true, 'cheetah'=> true, 'chpl'=> true, 'cirru'=> true, 'cl'=> true, 'clay'=> true, 'clean'=> true, 'clipper'=> true, 'clj'=> true, 'cljs'=> true, 'clojure'=> true, 'clojurescript'=> true, 'cmake'=> true, 'cobol'=> true, 'cobolfree'=> true, 'coffee'=> true, 'coffee-script'=> true, 'coffeescript'=> true, 'common-lisp'=> true, 'componentpascal'=> true, 'console'=> true, 'control'=> true, 'coq'=> true, 'cp'=> true, 'cpp'=> true, 'cpp-objdump'=> true, 'cpsa'=> true, 'cr'=> true, 'crmsh'=> true, 'croc'=> true, 'cry'=> true, 'cryptol'=> true, 'crystal'=> true, 'csh'=> true, 'csharp'=> true, 'csound'=> true, 'csound-csd'=> true, 'csound-document'=> true, 'csound-orc'=> true, 'csound-sco'=> true, 'csound-score'=> true, 'css'=> true, 'css+django'=> true, 'css+erb'=> true, 'css+genshi'=> true, 'css+genshitext'=> true, 'css+jinja'=> true, 'css+lasso'=> true, 'css+mako'=> true, 'css+mozpreproc'=> true, 'css+myghty'=> true, 'css+php'=> true, 'css+ruby'=> true, 'css+smarty'=> true, 'cu'=> true, 'cucumber'=> true, 'cuda'=> true, 'cxx-objdump'=> true, 'cypher'=> true, 'cython'=> true, 'd'=> true, 'd-objdump'=> true, 'dart'=> true, 'debcontrol'=> true, 'debsources'=> true, 'delphi'=> true, 'dg'=> true, 'diff'=> true, 'django'=> true, 'do'=> true, 'docker'=> true, 'dockerfile'=> true, 'dosbatch'=> true, 'doscon'=> true, 'dosini'=> true, 'dpatch'=> true, 'dtd'=> true, 'duby'=> true, 'duel'=> true, 'dylan'=> true, 'dylan-console'=> true, 'dylan-lid'=> true, 'dylan-repl'=> true, 'earl-grey'=> true, 'earlgrey'=> true, 'easytrieve'=> true, 'ebnf'=> true, 'ec'=> true, 'ecl'=> true, 'eg'=> true, 'eiffel'=> true, 'elisp'=> true, 'elixir'=> true, 'elm'=> true, 'emacs'=> true, 'emacs-lisp'=> true, 'erb'=> true, 'erl'=> true, 'erlang'=> true, 'evoque'=> true, 'ex'=> true, 'exs'=> true, 'extempore'=> true, 'ezhil'=> true, 'factor'=> true, 'fan'=> true, 'fancy'=> true, 'felix'=> true, 'fish'=> true, 'fishshell'=> true, 'flatline'=> true, 'flx'=> true, 'forth'=> true, 'fortran'=> true, 'fortranfixed'=> true, 'foxpro'=> true, 'fsharp'=> true, 'fy'=> true, 'gap'=> true, 'gas'=> true, 'gawk'=> true, 'genshi'=> true, 'genshitext'=> true, 'gherkin'=> true, 'glsl'=> true, 'gnuplot'=> true, 'go'=> true, 'golo'=> true, 'gooddata-cl'=> true, 'gosu'=> true, 'groff'=> true, 'groovy'=> true, 'gst'=> true, 'haml'=> true, 'handlebars'=> true, 'haskell'=> true, 'haxe'=> true, 'haxeml'=> true, 'hexdump'=> true, 'hs'=> true, 'hsa'=> true, 'hsail'=> true, 'html'=> true, 'html+cheetah'=> true, 'html+django'=> true, 'html+erb'=> true, 'html+evoque'=> true, 'html+genshi'=> true, 'html+handlebars'=> true, 'html+jinja'=> true, 'html+kid'=> true, 'html+lasso'=> true, 'html+mako'=> true, 'html+myghty'=> true, 'html+ng2'=> true, 'html+php'=> true, 'html+ruby'=> true, 'html+smarty'=> true, 'html+spitfire'=> true, 'html+twig'=> true, 'html+velocity'=> true, 'htmlcheetah'=> true, 'htmldjango'=> true, 'http'=> true, 'hx'=> true, 'hxml'=> true, 'hxsl'=> true, 'hy'=> true, 'hybris'=> true, 'hylang'=> true, 'i6'=> true, 'i6t'=> true, 'i7'=> true, 'idl'=> true, 'idl4'=> true, 'idr'=> true, 'idris'=> true, 'iex'=> true, 'igor'=> true, 'igorpro'=> true, 'ik'=> true, 'inform6'=> true, 'inform7'=> true, 'ini'=> true, 'io'=> true, 'ioke'=> true, 'irb'=> true, 'irc'=> true, 'isabelle'=> true, 'j'=> true, 'jade'=> true, 'jags'=> true, 'jasmin'=> true, 'jasminxt'=> true, 'java'=> true, 'javascript'=> true, 'javascript+cheetah'=> true, 'javascript+django'=> true, 'javascript+erb'=> true, 'javascript+genshi'=> true, 'javascript+genshitext'=> true, 'javascript+jinja'=> true, 'javascript+lasso'=> true, 'javascript+mako'=> true, 'javascript+mozpreproc'=> true, 'javascript+myghty'=> true, 'javascript+php'=> true, 'javascript+ruby'=> true, 'javascript+smarty'=> true, 'javascript+spitfire'=> true, 'jbst'=> true, 'jcl'=> true, 'jinja'=> true, 'jl'=> true, 'jlcon'=> true, 'jproperties'=> true, 'js'=> true, 'js+cheetah'=> true, 'js+django'=> true, 'js+erb'=> true, 'js+genshi'=> true, 'js+genshitext'=> true, 'js+jinja'=> true, 'js+lasso'=> true, 'js+mako'=> true, 'js+myghty'=> true, 'js+php'=> true, 'js+ruby'=> true, 'js+smarty'=> true, 'js+spitfire'=> true, 'jsgf'=> true, 'json'=> true, 'json-ld'=> true, 'json-object'=> true, 'jsonld'=> true, 'jsonml+bst'=> true, 'jsp'=> true, 'julia'=> true, 'juttle'=> true, 'kal'=> true, 'kconfig'=> true, 'kernel-config'=> true, 'kid'=> true, 'koka'=> true, 'kotlin'=> true, 'ksh'=> true, 'lagda'=> true, 'lasso'=> true, 'lassoscript'=> true, 'latex'=> true, 'lcry'=> true, 'lcryptol'=> true, 'lean'=> true, 'less'=> true, 'lhaskell'=> true, 'lhs'=> true, 'lid'=> true, 'lidr'=> true, 'lidris'=> true, 'lighttpd'=> true, 'lighty'=> true, 'limbo'=> true, 'linux-config'=> true, 'liquid'=> true, 'lisp'=> true, 'literate-agda'=> true, 'literate-cryptol'=> true, 'literate-haskell'=> true, 'literate-idris'=> true, 'live-script'=> true, 'livescript'=> true, 'llvm'=> true, 'logos'=> true, 'logtalk'=> true, 'lsl'=> true, 'lua'=> true, 'm2'=> true, 'make'=> true, 'makefile'=> true, 'mako'=> true, 'man'=> true, 'maql'=> true, 'mask'=> true, 'mason'=> true, 'mathematica'=> true, 'matlab'=> true, 'matlabsession'=> true, 'mawk'=> true, 'md'=> true, 'menuconfig'=> true, 'mf'=> true, 'minid'=> true, 'mma'=> true, 'modelica'=> true, 'modula2'=> true, 'moin'=> true, 'monkey'=> true, 'monte'=> true, 'moo'=> true, 'moocode'=> true, 'moon'=> true, 'moonscript'=> true, 'mozhashpreproc'=> true, 'mozpercentpreproc'=> true, 'mq4'=> true, 'mq5'=> true, 'mql'=> true, 'mql4'=> true, 'mql5'=> true, 'msc'=> true, 'mscgen'=> true, 'mupad'=> true, 'mxml'=> true, 'myghty'=> true, 'mysql'=> true, 'nasm'=> true, 'nawk'=> true, 'nb'=> true, 'ncl'=> true, 'nemerle'=> true, 'nesc'=> true, 'newlisp'=> true, 'newspeak'=> true, 'ng2'=> true, 'nginx'=> true, 'nim'=> true, 'nimrod'=> true, 'nit'=> true, 'nix'=> true, 'nixos'=> true, 'nroff'=> true, 'nsh'=> true, 'nsi'=> true, 'nsis'=> true, 'numpy'=> true, 'nusmv'=> true, 'obj-c'=> true, 'obj-c++'=> true, 'obj-j'=> true, 'objc'=> true, 'objc++'=> true, 'objdump'=> true, 'objdump-nasm'=> true, 'objective-c'=> true, 'objective-c++'=> true, 'objective-j'=> true, 'objectivec'=> true, 'objectivec++'=> true, 'objectivej'=> true, 'objectpascal'=> true, 'objj'=> true, 'ocaml'=> true, 'octave'=> true, 'odin'=> true, 'ooc'=> true, 'opa'=> true, 'openbugs'=> true, 'openedge'=> true, 'pacmanconf'=> true, 'pan'=> true, 'parasail'=> true, 'pas'=> true, 'pascal'=> true, 'pawn'=> true, 'pcmk'=> true, 'perl'=> true, 'perl6'=> true, 'php'=> true, 'php3'=> true, 'php4'=> true, 'php5'=> true, 'pig'=> true, 'pike'=> true, 'pkgconfig'=> true, 'pl'=> true, 'pl6'=> true, 'plpgsql'=> true, 'po'=> true, 'posh'=> true, 'postgres'=> true, 'postgres-console'=> true, 'postgresql'=> true, 'postgresql-console'=> true, 'postscr'=> true, 'postscript'=> true, 'pot'=> true, 'pov'=> true, 'powershell'=> true, 'praat'=> true, 'progress'=> true, 'prolog'=> true, 'properties'=> true, 'proto'=> true, 'protobuf'=> true, 'ps1'=> true, 'ps1con'=> true, 'psm1'=> true, 'psql'=> true, 'pug'=> true, 'puppet'=> true, 'py'=> true, 'py3'=> true, 'py3tb'=> true, 'pycon'=> true, 'pypy'=> true, 'pypylog'=> true, 'pyrex'=> true, 'pytb'=> true, 'python'=> true, 'python3'=> true, 'pyx'=> true, 'qbasic'=> true, 'qbs'=> true, 'qml'=> true, 'qvt'=> true, 'qvto'=> true, 'r'=> true, 'racket'=> true, 'ragel'=> true, 'ragel-c'=> true, 'ragel-cpp'=> true, 'ragel-d'=> true, 'ragel-em'=> true, 'ragel-java'=> true, 'ragel-objc'=> true, 'ragel-rb'=> true, 'ragel-ruby'=> true, 'raw'=> true, 'rb'=> true, 'rbcon'=> true, 'rconsole'=> true, 'rd'=> true, 'rebol'=> true, 'red'=> true, 'red/system'=> true, 'redcode'=> true, 'registry'=> true, 'resource'=> true, 'resourcebundle'=> true, 'rest'=> true, 'restructuredtext'=> true, 'rexx'=> true, 'rhtml'=> true, 'rkt'=> true, 'rnc'=> true, 'rng-compact'=> true, 'roboconf-graph'=> true, 'roboconf-instances'=> true, 'robotframework'=> true, 'rout'=> true, 'rql'=> true, 'rsl'=> true, 'rst'=> true, 'rts'=> true, 'ruby'=> true, 'rust'=> true, 's'=> true, 'sage'=> true, 'salt'=> true, 'sas'=> true, 'sass'=> true, 'sc'=> true, 'scala'=> true, 'scaml'=> true, 'scheme'=> true, 'scilab'=> true, 'scm'=> true, 'scss'=> true, 'sh'=> true, 'shell'=> true, 'shell-session'=> true, 'shen'=> true, 'silver'=> true, 'slim'=> true, 'sls'=> true, 'smali'=> true, 'smalltalk'=> true, 'smarty'=> true, 'sml'=> true, 'snobol'=> true, 'snowball'=> true, 'sources.list'=> true, 'sourceslist'=> true, 'sp'=> true, 'sparql'=> true, 'spec'=> true, 'spitfire'=> true, 'splus'=> true, 'sql'=> true, 'sqlite3'=> true, 'squeak'=> true, 'squid'=> true, 'squid.conf'=> true, 'squidconf'=> true, 'ssp'=> true, 'st'=> true, 'stan'=> true, 'stata'=> true, 'supercollider'=> true, 'sv'=> true, 'swift'=> true, 'swig'=> true, 'systemverilog'=> true, 't-sql'=> true, 'tads3'=> true, 'tap'=> true, 'tasm'=> true, 'tcl'=> true, 'tcsh'=> true, 'tcshcon'=> true, 'tea'=> true, 'termcap'=> true, 'terminfo'=> true, 'terraform'=> true, 'tex'=> true, 'text'=> true, 'tf'=> true, 'thrift'=> true, 'todotxt'=> true, 'trac-wiki'=> true, 'trafficscript'=> true, 'treetop'=> true, 'ts'=> true, 'tsql'=> true, 'turtle'=> true, 'twig'=> true, 'typescript'=> true, 'typoscript'=> true, 'typoscriptcssdata'=> true, 'typoscripthtmldata'=> true, 'udiff'=> true, 'urbiscript'=> true, 'v'=> true, 'vala'=> true, 'vapi'=> true, 'vb.net'=> true, 'vbnet'=> true, 'vcl'=> true, 'vclsnippet'=> true, 'vclsnippets'=> true, 'vctreestatus'=> true, 'velocity'=> true, 'verilog'=> true, 'vfp'=> true, 'vgl'=> true, 'vhdl'=> true, 'vim'=> true, 'wdiff'=> true, 'whiley'=> true, 'winbatch'=> true, 'winbugs'=> true, 'x10'=> true, 'xbase'=> true, 'xml'=> true, 'xml+cheetah'=> true, 'xml+django'=> true, 'xml+erb'=> true, 'xml+evoque'=> true, 'xml+genshi'=> true, 'xml+jinja'=> true, 'xml+kid'=> true, 'xml+lasso'=> true, 'xml+mako'=> true, 'xml+myghty'=> true, 'xml+php'=> true, 'xml+ruby'=> true, 'xml+smarty'=> true, 'xml+spitfire'=> true, 'xml+velocity'=> true, 'xq'=> true, 'xql'=> true, 'xqm'=> true, 'xquery'=> true, 'xqy'=> true, 'xslt'=> true, 'xten'=> true, 'xtend'=> true, 'xul+mozpreproc'=> true, 'yaml'=> true, 'yaml+jinja'=> true, 'zephir'=> true, 'zsh'=> true,]
Database Blocking.
Definition BlockTest.php:12
testRestrictionsFromDatabase()
Block::getRestrictions Block::insert.
getUserForBlocking()
Definition BlockTest.php:17
testBlockedUserCanNotCreateAccount()
Block::appliesToRight.
testAppliesToTitleReturnsTrueOnSitewideBlock()
Block::appliesToTitle.
testAppliesToReturnsTrueOnSitewideBlock()
Block::appliesToNamespace Block::appliesToPage.
testINewFromIDReturnsCorrectBlock()
Block::newFromID.
Definition BlockTest.php:78
addBlockForUser(User $user)
Definition BlockTest.php:32
testEquals()
Block::equals.
testT31116NewFromTargetWithEmptyIp( $vagueTarget)
CheckUser since being changed to use Block::newFromTarget started failing because the new function di...
testAppliesToTitleOnPartialBlock()
Block::appliesToTitle.
testRestrictions()
Block::getRestrictions Block::setRestrictions.
getBlockRestrictionStore()
Get an instance of BlockRestrictionStore.
testNewFromRow()
Block::newFromRow.
testCrappyCrossWikiBlocks()
Block::insert.
testBlockAllowsPurge()
Block::appliesToRight.
testAppliesToPageOnPartialPageBlock()
Block::appliesToPage.
testInsertExistingBlock()
Block::insert.
static providerXff()
testAppliesToNamespaceOnPartialNamespaceBlock()
Block::appliesToNamespace.
testINewFromTargetReturnsCorrectBlock()
Block::newFromTarget.
Definition BlockTest.php:65
testT28425BlockTimestampDefaultsToTime()
per T28425 Block::__construct
Definition BlockTest.php:92
testIsSitewide()
Block::isSitewide.
testSystemBlocks()
Block::getSystemBlockType Block::insert Block::doAutoblock.
static provideT31116Data()
testBlocksOnXff( $xff, $exCount, $exResult)
providerXff Block::getBlocksForIPList Block::chooseBlock
static getQueryInfo()
Return the tables, fields, and join conditions to be selected to create a new block object.
Definition Block.php:260
static newFromRow( $row)
Create a new Block object from a database row.
Definition Block.php:505
static newFromID( $id)
Load a block from the block id.
Definition Block.php:192
static getBlocksForIPList(array $ipChain, $isAnon, $fromMaster=false)
Get all blocks that match any IP from an array of IP addresses.
Definition Block.php:1442
static chooseBlock(array $blocks, array $ipChain)
From a list of multiple blocks, find the most exact and strongest Block.
Definition Block.php:1523
const TYPE_RANGE
Definition Block.php:98
static newFromTarget( $specificTarget, $vagueTarget=null, $fromMaster=false)
Given a target and the target's type, get an existing Block object if possible.
Definition Block.php:1403
const TYPE_IP
Definition Block.php:97
MediaWiki exception.
Base class that store and restore the Language objects.
getExistingTestPage( $title=null)
Returns a WikiPage representing an existing page.
static getMutableTestUser( $groups=[])
Convenience method for getting a mutable test user.
static getTestSysop()
Convenience method for getting an immutable admin test user.
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
static getTestUser( $groups=[])
Convenience method for getting an immutable test user.
MediaWikiServices is the service locator for the application scope of MediaWiki.
static setPasswordForUser(User $user, $password)
Set the password on a testing user.
Definition TestUser.php:129
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:48
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition User.php:585
$res
Definition database.txt:21
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
Definition hooks.txt:783
this hook is for auditing only or null if authentication failed before getting that far $username
Definition hooks.txt:782
return true to allow those checks to and false if checking is done & $user
Definition hooks.txt:1510
processing should stop and the error should be shown to the user * false
Definition hooks.txt:187
const NS_MAIN
Definition Defines.php:73
const NS_USER_TALK
Definition Defines.php:76