30 $localOffset = date(
'Z' ) / 60;
33 'wgLocaltimezone' => $localZone,
34 'wgLocalTZoffset' => $localOffset,
35 'wgNamespaceProtection' => [
43 $this->userName =
'Useruser';
44 $this->altUserName =
'Altuseruser';
45 date_default_timezone_set( $localZone );
48 if ( !isset( $this->userUser ) || !( $this->userUser instanceof
User ) ) {
51 if ( !$this->userUser->getId() ) {
53 "email" =>
"test@example.com",
54 "real_name" =>
"Test User" ] );
55 $this->userUser->load();
59 if ( !$this->altUser->getId() ) {
61 "email" =>
"alttest@example.com",
62 "real_name" =>
"Test User Alt" ] );
63 $this->altUser->load();
75 if ( is_array( $perm ) ) {
76 $this->
user->mRights = $perm;
78 $this->
user->mRights = [ $perm ];
102 $prefix = $wgContLang->getFormattedNsText(
NS_PROJECT );
107 $res = $this->
title->getUserPermissionsErrors(
'create', $this->
user );
108 $this->assertEquals( [],
$res );
112 $res = $this->
title->getUserPermissionsErrors(
'create', $this->
user );
113 $this->assertEquals( [ [
"nocreatetext" ] ],
$res );
117 $res = $this->
title->getUserPermissionsErrors(
'create', $this->
user );
118 $this->assertEquals( [ [
'nocreatetext' ] ],
$res );
122 $res = $this->
title->getUserPermissionsErrors(
'create', $this->
user );
123 $this->assertEquals( [],
$res );
127 $res = $this->
title->getUserPermissionsErrors(
'create', $this->
user );
128 $this->assertEquals( [ [
'nocreatetext' ] ],
$res );
130 $this->
setUser( $this->userName );
133 $res = $this->
title->getUserPermissionsErrors(
'create', $this->
user );
134 $this->assertEquals( [],
$res );
138 $res = $this->
title->getUserPermissionsErrors(
'create', $this->
user );
139 $this->assertEquals( [ [
'nocreate-loggedin' ] ],
$res );
143 $res = $this->
title->getUserPermissionsErrors(
'create', $this->
user );
144 $this->assertEquals( [ [
'nocreate-loggedin' ] ],
$res );
148 $res = $this->
title->getUserPermissionsErrors(
'create', $this->
user );
149 $this->assertEquals( [],
$res );
153 $res = $this->
title->getUserPermissionsErrors(
'create', $this->
user );
154 $this->assertEquals( [ [
'nocreate-loggedin' ] ],
$res );
158 $res = $this->
title->getUserPermissionsErrors(
'create', $this->
user );
159 $this->assertEquals( [ [
'nocreate-loggedin' ] ],
$res );
164 $res = $this->
title->getUserPermissionsErrors(
'move', $this->
user );
165 $this->assertEquals( [ [
'cant-move-user-page' ], [
'movenologintext' ] ],
$res );
169 $res = $this->
title->getUserPermissionsErrors(
'move', $this->
user );
170 $this->assertEquals( [ [
'movenologintext' ] ],
$res );
174 $res = $this->
title->getUserPermissionsErrors(
'move', $this->
user );
175 $this->assertEquals( [ [
'movenologintext' ] ],
$res );
179 $res = $this->
title->getUserPermissionsErrors(
'move', $this->
user );
180 $this->assertEquals( [ [
'movenologintext' ] ],
$res );
184 $res = $this->
title->getUserPermissionsErrors(
'move', $this->
user );
185 $this->assertEquals( [ [
'cant-move-user-page' ], [
'movenologintext' ] ],
$res );
189 $res = $this->
title->getUserPermissionsErrors(
'move', $this->
user );
190 $this->assertEquals( [ [
'movenologintext' ] ],
$res );
194 $res = $this->
title->getUserPermissionsErrors(
'move', $this->
user );
195 $this->assertEquals( [ [
'movenologintext' ] ],
$res );
199 $res = $this->
title->getUserPermissionsErrors(
'move', $this->
user );
200 $this->assertEquals( [ [
'movenologintext' ] ],
$res );
202 $this->
setUser( $this->userName );
205 $res = $this->
title->getUserPermissionsErrors(
'move', $this->
user );
206 $this->assertEquals( [ [
'movenotallowedfile' ], [
'movenotallowed' ] ],
$res );
210 $res = $this->
title->getUserPermissionsErrors(
'move', $this->
user );
211 $this->assertEquals( [ [
'movenotallowed' ] ],
$res );
216 $res = $this->
title->getUserPermissionsErrors(
'move', $this->
user );
217 $this->assertEquals( [ [
'movenotallowedfile' ], [
'movenologintext' ] ],
$res );
221 $res = $this->
title->getUserPermissionsErrors(
'move', $this->
user );
222 $this->assertEquals( [ [
'movenologintext' ] ],
$res );
224 $this->
setUser( $this->userName );
231 [ [
'movenotallowedfile' ], [
'movenotallowed' ] ]
241 [ [
'movenotallowedfile' ], [
'movenotallowed' ] ],
242 [ [
'movenotallowedfile' ], [
'movenologintext' ] ]
256 [ [
'movenologintext' ] ] );
258 $this->
setUser( $this->userName );
267 $res = $this->
title->getUserPermissionsErrors(
'move-target', $this->
user );
268 $this->assertEquals( [],
$res );
271 $res = $this->
title->getUserPermissionsErrors(
'move-target', $this->
user );
272 $this->assertEquals( [ [
'movenotallowed' ] ],
$res );
276 $this->
setUser( $this->userName );
277 $this->
setUserPerm( [
"move",
"move-rootuserpages" ] );
278 $res = $this->
title->getUserPermissionsErrors(
'move-target', $this->
user );
279 $this->assertEquals( [],
$res );
282 $res = $this->
title->getUserPermissionsErrors(
'move-target', $this->
user );
283 $this->assertEquals( [ [
'cant-move-to-user-page' ] ],
$res );
286 $this->
setUserPerm( [
"move",
"move-rootuserpages" ] );
287 $res = $this->
title->getUserPermissionsErrors(
'move-target', $this->
user );
288 $this->assertEquals( [],
$res );
291 $this->
setUserPerm( [
"move",
"move-rootuserpages" ] );
292 $res = $this->
title->getUserPermissionsErrors(
'move-target', $this->
user );
293 $this->assertEquals( [],
$res );
296 $res = $this->
title->getUserPermissionsErrors(
'move-target', $this->
user );
297 $this->assertEquals( [],
$res );
302 [ [
'badaccess-groups',
"*, [[$prefix:Users|Users]]", 2 ] ],
303 [ [
'badaccess-group0' ] ],
310 "[[$prefix:Administrators|Administrators]]", 1 ],
313 [ [
'badaccess-group0' ], [
'protect-cantedit' ] ],
314 [ [
'protect-cantedit' ] ],
317 '' => [ [], [], [],
true ]
320 foreach ( [
"edit",
"protect",
"" ]
as $action ) {
322 $this->assertEquals( $check[$action][0],
323 $this->
title->getUserPermissionsErrors( $action, $this->user,
true ) );
324 $this->assertEquals( $check[$action][0],
325 $this->
title->getUserPermissionsErrors( $action, $this->user,
'full' ) );
326 $this->assertEquals( $check[$action][0],
327 $this->
title->getUserPermissionsErrors( $action, $this->user,
'secure' ) );
329 global $wgGroupPermissions;
330 $old = $wgGroupPermissions;
331 $wgGroupPermissions = [];
333 $this->assertEquals( $check[$action][1],
334 $this->
title->getUserPermissionsErrors( $action, $this->user,
true ) );
335 $this->assertEquals( $check[$action][1],
336 $this->
title->getUserPermissionsErrors( $action, $this->user,
'full' ) );
337 $this->assertEquals( $check[$action][1],
338 $this->
title->getUserPermissionsErrors( $action, $this->user,
'secure' ) );
339 $wgGroupPermissions = $old;
342 $this->assertEquals( $check[$action][2],
343 $this->
title->getUserPermissionsErrors( $action, $this->user,
true ) );
344 $this->assertEquals( $check[$action][2],
345 $this->
title->getUserPermissionsErrors( $action, $this->user,
'full' ) );
346 $this->assertEquals( $check[$action][2],
347 $this->
title->getUserPermissionsErrors( $action, $this->user,
'secure' ) );
350 $this->assertEquals( $check[$action][3],
351 $this->
title->userCan( $action, $this->user,
true ) );
352 $this->assertEquals( $check[$action][3],
353 $this->
title->quickUserCan( $action, $this->user ) );
354 # count( User::getGroupsWithPermissions( $action ) ) < 1
359 global $wgGroupPermissions;
361 if ( $result2 === null ) {
365 $wgGroupPermissions[
'autoconfirmed'][
'move'] =
false;
366 $wgGroupPermissions[
'user'][
'move'] =
false;
367 $res = $this->
title->getUserPermissionsErrors( $action, $this->
user );
370 $wgGroupPermissions[
'autoconfirmed'][
'move'] =
true;
371 $wgGroupPermissions[
'user'][
'move'] =
false;
372 $res = $this->
title->getUserPermissionsErrors( $action, $this->
user );
373 $this->assertEquals( $result2,
$res );
375 $wgGroupPermissions[
'autoconfirmed'][
'move'] =
true;
376 $wgGroupPermissions[
'user'][
'move'] =
true;
377 $res = $this->
title->getUserPermissionsErrors( $action, $this->
user );
378 $this->assertEquals( $result2,
$res );
380 $wgGroupPermissions[
'autoconfirmed'][
'move'] =
false;
381 $wgGroupPermissions[
'user'][
'move'] =
true;
382 $res = $this->
title->getUserPermissionsErrors( $action, $this->
user );
383 $this->assertEquals( $result2,
$res );
392 $this->
setUser( $this->userName );
396 $this->assertEquals( [ [
'badaccess-group0' ], [
'ns-specialprotected' ] ],
397 $this->
title->getUserPermissionsErrors(
'bogus', $this->user ) );
401 $this->assertEquals( [],
402 $this->
title->getUserPermissionsErrors(
'bogus', $this->user ) );
406 $this->assertEquals( [ [
'badaccess-group0' ] ],
407 $this->
title->getUserPermissionsErrors(
'bogus', $this->user ) );
409 $wgNamespaceProtection[
NS_USER] = [
'bogus' ];
413 $this->assertEquals( [ [
'badaccess-group0' ],
414 [
'namespaceprotected',
'User',
'bogus' ] ],
415 $this->
title->getUserPermissionsErrors(
'bogus', $this->user ) );
419 $this->assertEquals( [ [
'protectedinterface',
'bogus' ] ],
420 $this->
title->getUserPermissionsErrors(
'bogus', $this->user ) );
424 $this->assertEquals( [ [
'protectedinterface',
'bogus' ] ],
425 $this->
title->getUserPermissionsErrors(
'bogus', $this->user ) );
427 $wgNamespaceProtection = null;
430 $this->assertEquals( [],
431 $this->
title->getUserPermissionsErrors(
'bogus', $this->user ) );
432 $this->assertEquals(
true,
433 $this->
title->userCan(
'bogus', $this->user ) );
436 $this->assertEquals( [ [
'badaccess-group0' ] ],
437 $this->
title->getUserPermissionsErrors(
'bogus', $this->user ) );
438 $this->assertEquals(
false,
439 $this->
title->userCan(
'bogus', $this->user ) );
447 $this->
setUser( $this->userName );
451 [ [
'badaccess-group0' ], [
'mycustomjsprotected',
'bogus' ] ],
452 [ [
'badaccess-group0' ], [
'mycustomjsprotected',
'bogus' ] ],
453 [ [
'badaccess-group0' ] ],
454 [ [
'badaccess-group0' ], [
'mycustomjsprotected',
'bogus' ] ],
455 [ [
'badaccess-group0' ] ]
460 [ [
'badaccess-group0' ], [
'mycustomcssprotected',
'bogus' ] ],
461 [ [
'badaccess-group0' ] ],
462 [ [
'badaccess-group0' ], [
'mycustomcssprotected',
'bogus' ] ],
463 [ [
'badaccess-group0' ] ],
464 [ [
'badaccess-group0' ], [
'mycustomcssprotected',
'bogus' ] ]
469 [ [
'badaccess-group0' ], [
'customjsprotected',
'bogus' ] ],
470 [ [
'badaccess-group0' ], [
'customjsprotected',
'bogus' ] ],
471 [ [
'badaccess-group0' ], [
'customjsprotected',
'bogus' ] ],
472 [ [
'badaccess-group0' ], [
'customjsprotected',
'bogus' ] ],
473 [ [
'badaccess-group0' ] ]
478 [ [
'badaccess-group0' ], [
'customcssprotected',
'bogus' ] ],
479 [ [
'badaccess-group0' ], [
'customcssprotected',
'bogus' ] ],
480 [ [
'badaccess-group0' ], [
'customcssprotected',
'bogus' ] ],
481 [ [
'badaccess-group0' ] ],
482 [ [
'badaccess-group0' ], [
'customcssprotected',
'bogus' ] ]
487 [ [
'badaccess-group0' ] ],
488 [ [
'badaccess-group0' ] ],
489 [ [
'badaccess-group0' ] ],
490 [ [
'badaccess-group0' ] ],
491 [ [
'badaccess-group0' ] ]
497 $this->assertEquals( $result0,
498 $this->
title->getUserPermissionsErrors(
'bogus',
502 $this->assertEquals( $result1,
503 $this->
title->getUserPermissionsErrors(
'bogus',
507 $this->assertEquals( $result2,
508 $this->
title->getUserPermissionsErrors(
'bogus',
512 $this->assertEquals( $result3,
513 $this->
title->getUserPermissionsErrors(
'bogus',
517 $this->assertEquals( $result4,
518 $this->
title->getUserPermissionsErrors(
'bogus',
522 $this->assertEquals( [ [
'badaccess-group0' ] ],
523 $this->
title->getUserPermissionsErrors(
'bogus',
526 $this->
setUserPerm( [
'edituserjs',
'editusercss' ] );
527 $this->assertEquals( [ [
'badaccess-group0' ] ],
528 $this->
title->getUserPermissionsErrors(
'bogus',
539 $prefix = $wgContLang->getFormattedNsText(
NS_PROJECT );
542 $this->
title->mRestrictionsLoaded =
true;
544 $this->
title->mRestrictions = [
"bogus" => [
'bogus',
"sysop",
"protect",
"" ] ];
546 $this->assertEquals( [],
547 $this->
title->getUserPermissionsErrors(
'edit',
550 $this->assertEquals(
true,
551 $this->
title->quickUserCan(
'edit', $this->user ) );
552 $this->
title->mRestrictions = [
"edit" => [
'bogus',
"sysop",
"protect",
"" ],
553 "bogus" => [
'bogus',
"sysop",
"protect",
"" ] ];
555 $this->assertEquals( [ [
'badaccess-group0' ],
556 [
'protectedpagetext',
'bogus',
'bogus' ],
557 [
'protectedpagetext',
'editprotected',
'bogus' ],
558 [
'protectedpagetext',
'protect',
'bogus' ] ],
559 $this->
title->getUserPermissionsErrors(
'bogus',
561 $this->assertEquals( [ [
'protectedpagetext',
'bogus',
'edit' ],
562 [
'protectedpagetext',
'editprotected',
'edit' ],
563 [
'protectedpagetext',
'protect',
'edit' ] ],
564 $this->
title->getUserPermissionsErrors(
'edit',
567 $this->assertEquals( [ [
'badaccess-group0' ],
568 [
'protectedpagetext',
'bogus',
'bogus' ],
569 [
'protectedpagetext',
'editprotected',
'bogus' ],
570 [
'protectedpagetext',
'protect',
'bogus' ] ],
571 $this->
title->getUserPermissionsErrors(
'bogus',
573 $this->assertEquals( [ [
'badaccess-groups',
"*, [[$prefix:Users|Users]]", 2 ],
574 [
'protectedpagetext',
'bogus',
'edit' ],
575 [
'protectedpagetext',
'editprotected',
'edit' ],
576 [
'protectedpagetext',
'protect',
'edit' ] ],
577 $this->
title->getUserPermissionsErrors(
'edit',
580 $this->assertEquals( [ [
'badaccess-group0' ],
581 [
'protectedpagetext',
'bogus',
'bogus' ],
582 [
'protectedpagetext',
'protect',
'bogus' ] ],
583 $this->
title->getUserPermissionsErrors(
'bogus',
585 $this->assertEquals( [
586 [
'protectedpagetext',
'bogus',
'edit' ],
587 [
'protectedpagetext',
'protect',
'edit' ] ],
588 $this->
title->getUserPermissionsErrors(
'edit',
591 $this->
title->mCascadeRestriction =
true;
593 $this->assertEquals(
false,
594 $this->
title->quickUserCan(
'bogus', $this->user ) );
595 $this->assertEquals(
false,
596 $this->
title->quickUserCan(
'edit', $this->user ) );
597 $this->assertEquals( [ [
'badaccess-group0' ],
598 [
'protectedpagetext',
'bogus',
'bogus' ],
599 [
'protectedpagetext',
'editprotected',
'bogus' ],
600 [
'protectedpagetext',
'protect',
'bogus' ] ],
601 $this->
title->getUserPermissionsErrors(
'bogus',
603 $this->assertEquals( [ [
'protectedpagetext',
'bogus',
'edit' ],
604 [
'protectedpagetext',
'editprotected',
'edit' ],
605 [
'protectedpagetext',
'protect',
'edit' ] ],
606 $this->
title->getUserPermissionsErrors(
'edit',
610 $this->assertEquals(
false,
611 $this->
title->quickUserCan(
'bogus', $this->user ) );
612 $this->assertEquals(
false,
613 $this->
title->quickUserCan(
'edit', $this->user ) );
614 $this->assertEquals( [ [
'badaccess-group0' ],
615 [
'protectedpagetext',
'bogus',
'bogus' ],
616 [
'protectedpagetext',
'protect',
'bogus' ],
617 [
'protectedpagetext',
'protect',
'bogus' ] ],
618 $this->
title->getUserPermissionsErrors(
'bogus',
620 $this->assertEquals( [ [
'protectedpagetext',
'bogus',
'edit' ],
621 [
'protectedpagetext',
'protect',
'edit' ],
622 [
'protectedpagetext',
'protect',
'edit' ] ],
623 $this->
title->getUserPermissionsErrors(
'edit',
631 $this->
title->mCascadeSources = [
635 $this->
title->mCascadingRestrictions = [
636 "bogus" => [
'bogus',
"sysop",
"protect",
"" ]
639 $this->assertEquals(
false,
640 $this->
title->userCan(
'bogus', $this->user ) );
641 $this->assertEquals( [
642 [
"cascadeprotected", 2,
"* [[:Bogus]]\n* [[:UnBogus]]\n",
'bogus' ],
643 [
"cascadeprotected", 2,
"* [[:Bogus]]\n* [[:UnBogus]]\n",
'bogus' ],
644 [
"cascadeprotected", 2,
"* [[:Bogus]]\n* [[:UnBogus]]\n",
'bogus' ] ],
645 $this->
title->getUserPermissionsErrors(
'bogus', $this->user ) );
647 $this->assertEquals(
true,
648 $this->
title->userCan(
'edit', $this->user ) );
649 $this->assertEquals( [],
650 $this->
title->getUserPermissionsErrors(
'edit', $this->user ) );
660 $this->
title->mTitleProtection[
'permission'] =
'';
661 $this->
title->mTitleProtection[
'user'] = $this->
user->getId();
662 $this->
title->mTitleProtection[
'expiry'] =
'infinity';
663 $this->
title->mTitleProtection[
'reason'] =
'test';
664 $this->
title->mCascadeRestriction =
false;
666 $this->assertEquals( [ [
'titleprotected',
'Useruser',
'test' ] ],
667 $this->
title->getUserPermissionsErrors(
'create', $this->user ) );
668 $this->assertEquals(
false,
669 $this->
title->userCan(
'create', $this->user ) );
671 $this->
title->mTitleProtection[
'permission'] =
'editprotected';
673 $this->assertEquals( [ [
'titleprotected',
'Useruser',
'test' ] ],
674 $this->
title->getUserPermissionsErrors(
'create', $this->user ) );
675 $this->assertEquals(
false,
676 $this->
title->userCan(
'create', $this->user ) );
678 $this->
setUserPerm( [
'createpage',
'editprotected' ] );
679 $this->assertEquals( [],
680 $this->
title->getUserPermissionsErrors(
'create', $this->user ) );
681 $this->assertEquals(
true,
682 $this->
title->userCan(
'create', $this->user ) );
685 $this->assertEquals( [ [
'titleprotected',
'Useruser',
'test' ] ],
686 $this->
title->getUserPermissionsErrors(
'create', $this->user ) );
687 $this->assertEquals(
false,
688 $this->
title->userCan(
'create', $this->user ) );
692 $this->assertEquals(
false,
693 $this->
title->userCan(
'move', $this->user ) );
694 $this->assertEquals( [ [
'immobile-source-namespace',
'Media' ] ],
695 $this->
title->getUserPermissionsErrors(
'move', $this->user ) );
698 $this->assertEquals( [],
699 $this->
title->getUserPermissionsErrors(
'move', $this->user ) );
700 $this->assertEquals(
true,
701 $this->
title->userCan(
'move', $this->user ) );
703 $this->
title->mInterwiki =
"no";
704 $this->assertEquals( [ [
'immobile-source-page' ] ],
705 $this->
title->getUserPermissionsErrors(
'move', $this->user ) );
706 $this->assertEquals(
false,
707 $this->
title->userCan(
'move', $this->user ) );
710 $this->assertEquals(
false,
711 $this->
title->userCan(
'move-target', $this->user ) );
712 $this->assertEquals( [ [
'immobile-target-namespace',
'Media' ] ],
713 $this->
title->getUserPermissionsErrors(
'move-target', $this->user ) );
716 $this->assertEquals( [],
717 $this->
title->getUserPermissionsErrors(
'move-target', $this->user ) );
718 $this->assertEquals(
true,
719 $this->
title->userCan(
'move-target', $this->user ) );
721 $this->
title->mInterwiki =
"no";
722 $this->assertEquals( [ [
'immobile-target-page' ] ],
723 $this->
title->getUserPermissionsErrors(
'move-target', $this->user ) );
724 $this->assertEquals(
false,
725 $this->
title->userCan(
'move-target', $this->user ) );
730 $wgEmailConfirmToEdit =
true;
731 $wgEmailAuthentication =
true;
737 $this->assertEquals( [ [
'confirmedittext' ] ],
738 $this->
title->getUserPermissionsErrors(
'move-target', $this->user ) );
739 $wgEmailConfirmToEdit =
false;
740 $this->assertEquals(
true, $this->
title->userCan(
'move-target', $this->user ) );
742 # $wgEmailConfirmToEdit && !$user->isEmailConfirmed() && $action != 'createaccount'
743 $this->assertEquals( [],
744 $this->
title->getUserPermissionsErrors(
'move-target',
750 $this->
user->mBlockedby = $this->
user->getId();
752 'address' =>
'127.0.8.1',
753 'by' => $this->
user->getId(),
754 'reason' =>
'no reason given',
755 'timestamp' => $prev + 3600,
759 $this->
user->mBlock->mTimestamp = 0;
760 $this->assertEquals( [ [
'autoblockedtext',
761 '[[User:Useruser|Useruser]]',
'no reason given',
'127.0.0.1',
762 'Useruser', null,
'infinite',
'127.0.8.1',
764 $this->
title->getUserPermissionsErrors(
'move-target',
767 $this->assertEquals(
false, $this->
title->userCan(
'move-target', $this->user ) );
769 $this->assertEquals(
true, $this->
title->quickUserCan(
'move-target', $this->user ) );
772 $wgLocalTZoffset = -60;
773 $this->
user->mBlockedby = $this->
user->getName();
775 'address' =>
'127.0.8.1',
776 'by' => $this->
user->getId(),
777 'reason' =>
'no reason given',
782 $this->assertEquals( [ [
'blockedtext',
783 '[[User:Useruser|Useruser]]',
'no reason given',
'127.0.0.1',
784 'Useruser', null,
'23:00, 31 December 1969',
'127.0.8.1',
786 $this->
title->getUserPermissionsErrors(
'move-target', $this->
user ) );
787 # $action != 'read' && $action != 'createaccount' && $user->isBlockedFrom( $this )
788 # $user->blockedFor() == ''
789 # $user->mBlock->mExpiry == 'infinity'
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
processing should stop and the error should be shown to the user * false
static newFromId($id)
Static factory method for creation from a given user ID.
static createNew($name, $params=[])
Add a user to the database, return the user object.
testCascadingSourcesRestrictions()
runCSSandJSPermissions($result0, $result1, $result2, $result3, $result4)
when a variable name is used in a it is silently declared as a new local masking the global
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message.Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item.Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page.Return false to stop further processing of the tag $reader:XMLReader object &$pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision.Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag.Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload.Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports.&$fullInterwikiPrefix:Interwiki prefix, may contain colons.&$pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable.Can be used to lazy-load the import sources list.&$importSources:The value of $wgImportSources.Modify as necessary.See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page.$context:IContextSource object &$pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect.&$title:Title object for the current page &$request:WebRequest &$ignoreRedirect:boolean to skip redirect check &$target:Title/string of redirect target &$article:Article object 'InternalParseBeforeLinks':during Parser's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InternalParseBeforeSanitize':during Parser's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings.Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not.Return true without providing an interwiki to continue interwiki search.$prefix:interwiki prefix we are looking for.&$iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user's email has been invalidated successfully.$user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification.Callee may modify $url and $query, URL will be constructed as $url.$query &$url:URL to index.php &$query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) &$article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() &$ip:IP being check &$result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from &$allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn't match your organization.$addr:The e-mail address entered by the user &$result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user &$result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we're looking for a messages file for &$file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED!Use $magicWords in a file listed in $wgExtensionMessagesFiles instead.Use this to define synonyms of magic words depending of the language &$magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces.Do not use this hook to add namespaces.Use CanonicalNamespaces for that.&$namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED!Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead.Use to define aliases of special pages names depending of the language &$specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names.&$names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page's language links.This is called in various places to allow extensions to define the effective language links for a page.$title:The page's Title.&$links:Associative array mapping language codes to prefixed links of the form"language:title".&$linkFlags:Associative array mapping prefixed links to arrays of flags.Currently unused, but planned to provide support for marking individual language links in the UI, e.g.for featured articles. 'LanguageSelector':Hook to change the language selector available on a page.$out:The output page.$cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED!Use HtmlPageLinkRendererBegin instead.Used when generating internal and interwiki links in Linker::link(), before processing starts.Return false to skip default processing and return $ret.See documentation for Linker::link() for details on the expected meanings of parameters.$skin:the Skin object $target:the Title that the link is pointing to &$html:the contents that the< a > tag should have(raw HTML) $result
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
if($wgScript===false) if($wgLoadScript===false) if($wgArticlePath===false) if(!empty($wgActionPaths)&&!isset($wgActionPaths['view'])) if($wgResourceBasePath===null) if($wgStylePath===false) if($wgLocalStylePath===false) if($wgExtensionAssetsPath===false) if($wgLogo===false) if($wgUploadPath===false) if($wgUploadDirectory===false) if($wgReadOnlyFile===false) if($wgFileCacheDirectory===false) if($wgDeletedDirectory===false) if($wgGitInfoCacheDirectory===false &&$wgCacheDirectory!==false) if($wgEnableParserCache===false) if($wgRightsIcon) if(isset($wgFooterIcons['copyright']['copyright'])&&$wgFooterIcons['copyright']['copyright']===[]) if(isset($wgFooterIcons['poweredby'])&&isset($wgFooterIcons['poweredby']['mediawiki'])&&$wgFooterIcons['poweredby']['mediawiki']['src']===null) $wgNamespaceProtection[NS_MEDIAWIKI]
Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a sysadmin to set $wgName...
testCssAndJavascriptPermissions()
setTitle($ns, $title="Main_Page")
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
Wikitext formatted, in the key only.
static resetMain()
Resets singleton returned by getMain().
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
$wgEmailAuthentication
Require email authentication before sending mail to an email address.
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
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
runGroupPermissions($action, $result, $result2=null)
$wgLocalTZoffset
Set an offset from UTC in minutes to use for the default timezone setting for anonymous users and new...
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
testSpecialsAndNSPermissions()