MediaWiki master
OutputPage.php
Go to the documentation of this file.
1<?php
8
9namespace MediaWiki\Output;
10
11use CSSJanus;
12use Exception;
13use InvalidArgumentException;
14use MediaWiki\Config\Config;
15use MediaWiki\Content\Content;
16use MediaWiki\Content\JavaScriptContent;
17use MediaWiki\Content\TextContent;
18use MediaWiki\Context\ContextSource;
19use MediaWiki\Context\IContextSource;
20use MediaWiki\Context\RequestContext;
21use MediaWiki\Debug\DeprecationHelper;
22use MediaWiki\Debug\MWDebug;
23use MediaWiki\FileRepo\File\File;
24use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
25use MediaWiki\Html\Html;
26use MediaWiki\Language\Language;
27use MediaWiki\Language\LanguageCode;
28use MediaWiki\Linker\LinkTarget;
29use MediaWiki\MainConfigNames;
30use MediaWiki\MediaWikiServices;
31use MediaWiki\Message\Message;
32use MediaWiki\Page\Article;
33use MediaWiki\Page\LinkCache;
34use MediaWiki\Page\PageRecord;
35use MediaWiki\Page\PageReference;
36use MediaWiki\Parser\Parser;
37use MediaWiki\Parser\ParserOptions;
38use MediaWiki\Parser\ParserOutput;
39use MediaWiki\Parser\ParserOutputFlags;
40use MediaWiki\Parser\ParserOutputLinkTypes;
41use MediaWiki\Parser\Sanitizer;
42use MediaWiki\Permissions\PermissionStatus;
43use MediaWiki\Registration\ExtensionRegistry;
44use MediaWiki\Request\ContentSecurityPolicy;
45use MediaWiki\Request\FauxRequest;
46use MediaWiki\Request\WebRequest;
47use MediaWiki\ResourceLoader as RL;
48use MediaWiki\ResourceLoader\ResourceLoader;
49use MediaWiki\Session\SessionManagerInterface;
50use MediaWiki\Skin\QuickTemplate;
51use MediaWiki\Skin\Skin;
52use MediaWiki\SpecialPage\SpecialPage;
53use MediaWiki\Title\Title;
54use MediaWiki\Title\TitleValue;
55use MediaWiki\Utils\MWTimestamp;
56use OOUI\Element;
57use OOUI\Theme;
58use RuntimeException;
59use Wikimedia\Assert\Assert;
60use Wikimedia\Bcp47Code\Bcp47Code;
61use Wikimedia\HtmlArmor\HtmlArmor;
62use Wikimedia\Message\MessageParam;
63use Wikimedia\Message\MessageSpecifier;
64use Wikimedia\Parsoid\Core\LinkTarget as ParsoidLinkTarget;
65use Wikimedia\Parsoid\Core\TOCData;
66use Wikimedia\Rdbms\IResultWrapper;
67use Wikimedia\RelPath;
68use Wikimedia\Timestamp\TimestampFormat as TS;
69use Wikimedia\WrappedString;
70use Wikimedia\WrappedStringList;
71
85 use ProtectedHookAccessorTrait;
86 use DeprecationHelper;
87
89 public const CSP_HEADERS = 'headers';
91 public const CSP_META = 'meta';
92
93 // Constants for getJSVars()
94 private const JS_VAR_EARLY = 1;
95 private const JS_VAR_LATE = 2;
96
97 // Core config vars that opt-in to JS_VAR_LATE.
98 // Extensions use the 'LateJSConfigVarNames' attribute instead.
99 private const CORE_LATE_JS_CONFIG_VAR_NAMES = [];
100
102 private static $oouiSetupDone = false;
103
105 protected $mMetatags = [];
106
108 protected $mLinktags = [];
109
111 protected $mCanonicalUrl = false;
112
116 private $mPageTitle = '';
117
132 private ?array $displayTitleParts = null;
133
135 private $cacheIsFinal = false;
136
141 public $mBodytext = '';
142
144 private $mHTMLtitle = '';
145
150 private $mIsArticle = false;
151
153 private $mIsArticleRelated = true;
154
156 private $mHasCopyright = false;
157
169 private $tocData;
170
175 private $mSubtitle = [];
176
178 public $mRedirect = '';
179
181 protected $mStatusCode;
182
187 protected $mLastModified = '';
188
190 private $mCategoryLinks = [];
191
193 private $mCategories = [
194 'hidden' => [],
195 'normal' => [],
196 ];
197
207 private array $mCategoryData = [];
208
214 private bool $mCategoriesSorted = true;
215
227 private array $mIndicators = [];
228
236 private $mScripts = '';
237
239 protected $mInlineStyles = '';
240
246
251 private $mHeadItems = [];
252
255
259 private $mModules = [];
260
264 private $mModuleStyles = [];
265
268
270 private $rlClient;
271
273 private $rlClientContext;
274
276 private $rlExemptStyleModules;
277
279 private $mJsConfigVars = [];
280
282 public $mRedirectCode = '';
283
285 protected $mFeedLinksAppendQuery = null;
286
292 protected $mAllowedModules = [
293 RL\Module::TYPE_COMBINED => RL\Module::ORIGIN_ALL,
294 ];
295
297 protected $mDoNothing = false;
298
299 // Parser related.
300
306 private $mParserOptions = null;
307
314 private $mFeedLinks = [];
315
321 private $mEnableClientCache = true;
322
324 private $mArticleBodyOnly = false;
325
327 protected $mCdnMaxage = 0;
329 protected $mCdnMaxageLimit = INF;
330
332 private $mRevisionId = null;
333
335 private $mRevisionIsCurrent = null;
336
338 protected $mFileVersion = null;
339
348 protected $styles = [];
349
351 private $mFollowPolicy = 'follow';
352
354 private $mRobotsOptions = [ 'max-image-preview' => 'standard' ];
355
361 private $mVaryHeader = [
362 'Accept-Encoding' => null,
363 ];
364
371 private $mRedirectedFrom = null;
372
377 private $mProperties = [];
378
382 private $mEnableTOC = false;
383
387 private $copyrightUrl;
388
392 private $contentLang;
393
395 private $contentOverrides = [];
396
398 private $contentOverrideCallbacks = [];
399
404 private $mLinkHeader = [];
405
409 private $CSP;
410
411 private string $cspOutputMode = self::CSP_HEADERS;
412
421 private ParserOutput $metadata;
422
426 private static $cacheVaryCookies = null;
427
429 private $debugMode = null;
430
436 public function __construct( IContextSource $context ) {
437 $this->deprecatePublicProperty( 'mCategoryLinks', '1.38', __CLASS__ );
438 $this->deprecatePublicProperty( 'mCategories', '1.38', __CLASS__ );
439 $this->deprecatePublicProperty( 'mIndicators', '1.38', __CLASS__ );
440 $this->deprecatePublicProperty( 'mHeadItems', '1.38', __CLASS__ );
441 $this->deprecatePublicProperty( 'mJsConfigVars', '1.38', __CLASS__ );
442 $this->deprecatePublicProperty( 'mEnableClientCache', '1.38', __CLASS__ );
443 $this->deprecatePublicProperty( 'mParserOptions', '1.44', __CLASS__ );
444 $this->setContext( $context );
445 $this->metadata = new ParserOutput( null );
446 // OutputPage default
447 $this->metadata->setPreventClickjacking( true );
448 $this->CSP = new ContentSecurityPolicy(
449 $context->getRequest()->response(),
450 $context->getConfig(),
451 $this->getHookContainer()
452 );
453 $this->metadata->setNoGallery( false );
454 $this->metadata->setNewSection( false );
455 $this->metadata->setHideNewSection( false );
456 $this->metadata->setRevisionTimestamp( null );
457 }
458
465 public function redirect( $url, $responsecode = '302' ) {
466 # Strip newlines as a paranoia check for header injection in PHP<5.1.2
467 $this->mRedirect = str_replace( [ "\r", "\n" ], '', $url );
468 $this->mRedirectCode = (string)$responsecode;
469 }
470
476 public function getRedirect() {
477 return $this->mRedirect;
478 }
479
488 public function setCopyrightUrl( $url ) {
489 $this->copyrightUrl = $url;
490 }
491
497 public function setStatusCode( $statusCode ) {
498 $this->mStatusCode = $statusCode;
499 }
500
505 public function getMetadata(): ParserOutput {
506 // We can deprecate the redundant
507 // methods on OutputPage which simply turn around
508 // and invoke the corresponding method on the metadata
509 // ParserOutput.
510 return $this->metadata;
511 }
512
520 public function addMeta( $name, $val ) {
521 $this->mMetatags[] = [ $name, $val ];
522 }
523
530 public function getMetaTags() {
531 return $this->mMetatags;
532 }
533
541 public function addLink( array $linkarr ) {
542 $this->mLinktags[] = $linkarr;
543 }
544
551 public function getLinkTags() {
552 return $this->mLinktags;
553 }
554
560 public function setCanonicalUrl( $url ) {
561 $this->mCanonicalUrl = $url;
562 }
563
571 public function getCanonicalUrl() {
572 return $this->mCanonicalUrl;
573 }
574
583 public function addScript( $script ) {
584 $this->mScripts .= $script;
585 }
586
595 public function addScriptFile( $file, $unused = null ) {
596 $this->addScript( Html::linkedScript( $file ) );
597 }
598
606 public function addInlineScript( $script ) {
607 $this->mScripts .= Html::inlineScript( "\n$script\n" ) . "\n";
608 }
609
618 protected function filterModules( array $modules, $position = null,
619 $type = RL\Module::TYPE_COMBINED
620 ) {
621 $resourceLoader = $this->getResourceLoader();
622 $filteredModules = [];
623 foreach ( $modules as $val ) {
624 $module = $resourceLoader->getModule( $val );
625 if ( $module instanceof RL\Module
626 && $module->getOrigin() <= $this->getAllowedModules( $type )
627 ) {
628 $filteredModules[] = $val;
629 }
630 }
631 return $filteredModules;
632 }
633
640 public function getModules( $filter = false ) {
641 return $this->getModulesInternal(
642 $filter, 'mModules', RL\Module::TYPE_COMBINED,
643 );
644 }
645
654 private function getModulesInternal(
655 bool $filter, string $param, string $type
656 ) {
657 $modules = array_values( $this->$param );
658 return $filter
659 ? $this->filterModules( $modules, null, $type )
660 : $modules;
661 }
662
669 public function addModules( $modules ) {
670 foreach ( (array)$modules as $moduleName ) {
671 $this->mModules[$moduleName] = $moduleName;
672 }
673 }
674
681 public function getModuleStyles( $filter = false ) {
682 return $this->getModulesInternal(
683 $filter, 'mModuleStyles', RL\Module::TYPE_STYLES
684 );
685 }
686
697 public function addModuleStyles( $modules ) {
698 foreach ( (array)$modules as $moduleName ) {
699 $this->mModuleStyles[$moduleName] = $moduleName;
700 }
701 }
702
710 public function addContentOverride( $target, Content $content ) {
711 if ( !$this->contentOverrides ) {
712 // Register a callback for $this->contentOverrides on the first call
713 $this->addContentOverrideCallback( function ( $target ) {
714 $key = $target->getNamespace() . ':' . $target->getDBkey();
715 return $this->contentOverrides[$key] ?? null;
716 } );
717 }
718
719 $key = $target->getNamespace() . ':' . $target->getDBkey();
720 $this->contentOverrides[$key] = $content;
721 }
722
730 public function addContentOverrideCallback( callable $callback ) {
731 $this->contentOverrideCallbacks[] = $callback;
732 }
733
744 public function addHtmlClasses( $classes ) {
745 $this->mAdditionalHtmlClasses = array_merge( $this->mAdditionalHtmlClasses, (array)$classes );
746 }
747
751 public function getHeadItemsArray() {
752 return $this->mHeadItems;
753 }
754
768 public function addHeadItem( $name, $value ) {
769 $this->mHeadItems[$name] = $value;
770 }
771
779 public function addHeadItems( $values ) {
780 $this->mHeadItems = array_merge( $this->mHeadItems, (array)$values );
781 }
782
789 public function hasHeadItem( $name ) {
790 return isset( $this->mHeadItems[$name] );
791 }
792
802 public function addBodyClasses( $classes ) {
803 $this->mAdditionalBodyClasses = array_merge( $this->mAdditionalBodyClasses, (array)$classes );
804 }
805
813 public function setArticleBodyOnly( $only ) {
814 $this->mArticleBodyOnly = $only;
815 }
816
822 public function getArticleBodyOnly() {
823 return $this->mArticleBodyOnly;
824 }
825
833 public function setProperty( $name, $value ) {
834 $this->mProperties[$name] = $value;
835 }
836
844 public function getProperty( $name ) {
845 return $this->mProperties[$name] ?? null;
846 }
847
859 public function checkLastModified( $timestamp ) {
860 if ( !$timestamp || $timestamp == '19700101000000' ) {
861 wfDebug( __METHOD__ . ': CACHE DISABLED, NO TIMESTAMP' );
862 return false;
863 }
864 $config = $this->getConfig();
865 if ( !$config->get( MainConfigNames::CachePages ) ) {
866 wfDebug( __METHOD__ . ': CACHE DISABLED' );
867 return false;
868 }
869
870 $timestamp = wfTimestamp( TS::MW, $timestamp );
871 $modifiedTimes = [
872 'page' => $timestamp,
873 'user' => $this->getUser()->getTouched(),
874 'epoch' => $config->get( MainConfigNames::CacheEpoch )
875 ];
876 if ( $config->get( MainConfigNames::UseCdn ) ) {
877 // Ensure Last-Modified is never more than "$wgCdnMaxAge" seconds in the past,
878 // because even if the wiki page hasn't been edited, other static resources may
879 // change (site configuration, default preferences, skin HTML, interface messages,
880 // URLs to other files and services) and must roll-over in a timely manner (T46570)
881 $modifiedTimes['sepoch'] = wfTimestamp(
882 TS::MW,
883 MWTimestamp::time() - $config->get( MainConfigNames::CdnMaxAge )
884 );
885 }
886 $this->getHookRunner()->onOutputPageCheckLastModified( $modifiedTimes, $this );
887
888 $maxModified = max( $modifiedTimes );
889 $this->mLastModified = wfTimestamp( TS::RFC2822, $maxModified );
890
891 $clientHeader = $this->getRequest()->getHeader( 'If-Modified-Since' );
892 if ( $clientHeader === false ) {
893 wfDebug( __METHOD__ . ': client did not send If-Modified-Since header', 'private' );
894 return false;
895 }
896
897 # IE sends sizes after the date like this:
898 # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
899 # this breaks strtotime().
900 $clientHeader = preg_replace( '/;.*$/', '', $clientHeader );
901
902 // Ignore timezone warning
903 // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
904 $clientHeaderTime = @strtotime( $clientHeader );
905 if ( !$clientHeaderTime ) {
906 wfDebug( __METHOD__
907 . ": unable to parse the client's If-Modified-Since header: $clientHeader" );
908 return false;
909 }
910 $clientHeaderTime = wfTimestamp( TS::MW, $clientHeaderTime );
911
912 # Make debug info
913 $info = '';
914 foreach ( $modifiedTimes as $name => $value ) {
915 if ( $info !== '' ) {
916 $info .= ', ';
917 }
918 $info .= "$name=" . wfTimestamp( TS::ISO_8601, $value );
919 }
920
921 wfDebug( __METHOD__ . ': client sent If-Modified-Since: ' .
922 wfTimestamp( TS::ISO_8601, $clientHeaderTime ), 'private' );
923 wfDebug( __METHOD__ . ': effective Last-Modified: ' .
924 wfTimestamp( TS::ISO_8601, $maxModified ), 'private' );
925 if ( $clientHeaderTime < $maxModified ) {
926 wfDebug( __METHOD__ . ": STALE, $info", 'private' );
927 return false;
928 }
929
930 # Not modified
931 # Give a 304 Not Modified response code and disable body output
932 wfDebug( __METHOD__ . ": NOT MODIFIED, $info", 'private' );
933 if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
934 // Avoid "headers already sent" warnings in tests.
935 ini_set( 'zlib.output_compression', 0 );
936 }
937 $this->getRequest()->response()->statusHeader( 304 );
938 $this->sendCacheControl();
939 $this->disable();
940
941 // Don't output a compressed blob when using ob_gzhandler;
942 // it's technically against HTTP spec and seems to confuse
943 // Firefox when the response gets split over two packets.
944 wfResetOutputBuffers( false );
945
946 return true;
947 }
948
955 public function setLastModified( $timestamp ) {
956 $this->mLastModified = wfTimestamp( TS::RFC2822, $timestamp );
957 }
958
966 public function setRobotPolicy( $policy ) {
967 $policy = Article::formatRobotPolicy( $policy );
968
969 if ( isset( $policy['index'] ) ) {
970 $this->setIndexPolicy( $policy['index'] );
971 }
972 if ( isset( $policy['follow'] ) ) {
973 $this->setFollowPolicy( $policy['follow'] );
974 }
975 }
976
983 public function getRobotPolicy() {
984 $indexPolicy = $this->getIndexPolicy();
985 return "{$indexPolicy},{$this->mFollowPolicy}";
986 }
987
993 private function formatRobotsOptions(): string {
994 $options = [];
995 foreach ( $this->mRobotsOptions as $key => $value ) {
996 // Robots meta tags can have directives that are single strings or
997 // have parameters that should be formatted like <directive>:<setting>.
998 // If the options keys are strings, format them accordingly.
999 // https://developers.google.com/search/docs/advanced/robots/robots_meta_tag
1000 if ( is_string( $key ) ) {
1001 $options[] = "$key:$value";
1002 } else {
1003 // string cast done by implode below
1004 $options[] = $value;
1005 }
1006 }
1007 return implode( ',', $options );
1008 }
1009
1017 public function setRobotsOptions( array $options = [] ): void {
1018 $this->mRobotsOptions = array_merge( $this->mRobotsOptions, $options );
1019 }
1020
1025 private function getRobotsContent(): string {
1026 $robotOptionString = $this->formatRobotsOptions();
1027 $robotArgs = ( $this->getIndexPolicy() === 'index' &&
1028 $this->mFollowPolicy === 'follow' ) ?
1029 [] :
1030 [
1031 $this->getIndexPolicy(),
1032 $this->mFollowPolicy,
1033 ];
1034 if ( $robotOptionString ) {
1035 $robotArgs[] = $robotOptionString;
1036 }
1037 return implode( ',', $robotArgs );
1038 }
1039
1053 public function setIndexPolicy( $policy ) {
1054 $policy = trim( $policy );
1055 $this->metadata->setIndexPolicy( $policy );
1056 }
1057
1064 public function getIndexPolicy() {
1065 // Unlike ParserOutput, in OutputPage getIndexPolicy() defaults to
1066 // 'index' if unset.
1067 $policy = $this->metadata->getIndexPolicy();
1068 if ( $policy === '' ) {
1069 $policy = 'index';
1070 }
1071 return $policy;
1072 }
1073
1080 public function setFollowPolicy( $policy ) {
1081 $policy = trim( $policy );
1082 if ( in_array( $policy, [ 'follow', 'nofollow' ] ) ) {
1083 $this->mFollowPolicy = $policy;
1084 }
1085 }
1086
1092 public function getFollowPolicy() {
1093 return $this->mFollowPolicy;
1094 }
1095
1102 public function setHTMLTitle( $name ) {
1103 if ( $name instanceof Message ) {
1104 $this->mHTMLtitle = $name->setContext( $this->getContext() )->text();
1105 } else {
1106 $this->mHTMLtitle = $name;
1107 }
1108 }
1109
1115 public function getHTMLTitle() {
1116 return $this->mHTMLtitle;
1117 }
1118
1122 public function setRedirectedFrom( PageReference $t ) {
1123 $this->mRedirectedFrom = $t;
1124 }
1125
1139 public function setPageTitle( $name ) {
1140 // This is a stronger check than a `string $name` type hint, which automatically stringifies
1141 // stringable objects such as Message when not using strict_types, and we don't want that.
1142 Assert::parameterType( 'string', $name, '$name' );
1143 $this->setPageTitleInternal( $name );
1144 }
1145
1161 public function setPageTitleMsg( Message $msg ): void {
1162 $this->setPageTitleInternal(
1163 $msg->setContext( $this->getContext() )->escaped()
1164 );
1165 }
1166
1167 private function setPageTitleInternal( string $name ): void {
1168 # change "<script>foo&bar</script>" to "&lt;script&gt;foo&amp;bar&lt;/script&gt;"
1169 # but leave "<i>foobar</i>" alone
1170 $nameWithTags = Sanitizer::removeSomeTags( $name );
1171 $this->mPageTitle = $nameWithTags;
1172
1173 # change "<i>foo&amp;bar</i>" to "foo&bar"
1174 $this->setHTMLTitle(
1175 $this->msg( 'pagetitle' )->plaintextParams( Sanitizer::stripAllTags( $nameWithTags ) )
1176 ->inContentLanguage()
1177 );
1178 }
1179
1185 public function getPageTitle() {
1186 return $this->mPageTitle;
1187 }
1188
1203 public function setDisplayTitle( $html ) {
1204 // clears any split parts previously set by ::setDisplayTitleParts()
1205 $this->displayTitleParts = [ null, null, null, (string)$html ];
1206 }
1207
1228 public function setDisplayTitleParts(
1229 string|HtmlArmor $nsText,
1230 string|HtmlArmor $nsSeparator,
1231 string|HtmlArmor $mainText,
1232 string|HtmlArmor|null $combinedText = null
1233 ): void {
1234 // Use the same rules as ParserOutput::setDisplayTitleParts()
1235 $parts = [
1236 HtmlArmor::getHtml( $nsText ) ?? '',
1237 HtmlArmor::getHtml( $nsSeparator ) ?? '',
1238 HtmlArmor::getHtml( $mainText ) ?? '',
1239 ];
1240 if ( $combinedText !== null ) {
1241 $combinedText = HtmlArmor::getHtml( $combinedText );
1242 }
1243 $combinedText ??= $parts[0] ? implode( '', $parts ) : $parts[2];
1244 $this->displayTitleParts = [ ...$parts, $combinedText ];
1245 }
1246
1255 public function getDisplayTitle() {
1256 $html = ( $this->displayTitleParts[3] ?? '' ) ?: null;
1257 if ( $html === null ) {
1258 return htmlspecialchars( $this->getTitle()->getPrefixedText(), ENT_NOQUOTES );
1259 }
1260
1261 return Sanitizer::removeSomeTags( $html );
1262 }
1263
1281 public function getDisplayTitleParts(): array {
1282 if ( ( $this->displayTitleParts[0] ?? null ) !== null ) {
1283 return array_map(
1284 static fn ( string $s ) => new HtmlArmor( $s ),
1285 array_slice( $this->displayTitleParts, 0, 3 ),
1286 );
1287 }
1288 $displayTitle = $this->displayTitleParts[3] ?? '';
1289 $converter = MediaWikiServices::getInstance()
1290 ->getLanguageConverterFactory()
1291 ->getLanguageConverter(
1292 MediaWikiServices::getInstance()->getContentLanguage()
1293 );
1294 if ( $displayTitle !== '' ) {
1295 // Fallback for unsplit display title; unnecessary after
1296 // T314399#12254509 is complete because $displayTitleParts === null
1297 // will always imply $displayTitle === ''. Since we're supposed
1298 // to maintain ParserCache compatibility with the past two LTS
1299 // releases, this can be removed in MW >= 1.52.
1300 return Parser::splitPageTitle(
1301 new HtmlArmor( $displayTitle ),
1302 $this->getTitle(),
1303 $converter,
1304 );
1305 }
1306 return array_map( static function ( $s ): HtmlArmor {
1307 return new HtmlArmor( HtmlArmor::getHtml( $s ) );
1308 }, $converter->convertSplitTitle( $this->getTitle() ) );
1309 }
1310
1320 public function getUnprefixedDisplayTitle(): string {
1321 // The parts are HtmlArmor objects. Thus getHtml() does not escape them again.
1322 // @phan-suppress-next-line SecurityCheck-DoubleEscaped
1323 return HtmlArmor::getHtml( $this->getDisplayTitleParts()[2] );
1324 }
1325
1329 public function setTitle( PageReference $t ) {
1330 $t = Title::newFromPageReference( $t );
1331
1332 // @phan-suppress-next-next-line PhanUndeclaredMethod
1333 // @fixme Not all implementations of IContextSource have this method!
1334 $this->getContext()->setTitle( $t );
1335 }
1336
1342 public function setSubtitle( $str ) {
1343 $this->clearSubtitle();
1344 $this->addSubtitle( $str );
1345 }
1346
1353 public function addSubtitle( $str ) {
1354 if ( $str instanceof Message ) {
1355 $this->mSubtitle[] = $str->setContext( $this->getContext() )->parse();
1356 } else {
1357 $this->mSubtitle[] = $str;
1358 }
1359 }
1360
1369 public static function buildBacklinkSubtitle( PageReference $page, $query = [] ) {
1370 if ( $page instanceof PageRecord || $page instanceof Title ) {
1371 // Callers will typically have a PageRecord
1372 if ( $page->isRedirect() ) {
1373 $query['redirect'] = 'no';
1374 }
1375 } elseif ( $page->getNamespace() !== NS_SPECIAL ) {
1376 // We don't know whether it's a redirect, so add the parameter, just to be sure.
1377 $query['redirect'] = 'no';
1378 }
1379
1380 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
1381 return wfMessage( 'backlinksubtitle' )
1382 ->rawParams( $linkRenderer->makeLink( $page, null, [], $query ) );
1383 }
1384
1391 public function addBacklinkSubtitle( PageReference $title, $query = [] ) {
1392 $this->addSubtitle( self::buildBacklinkSubtitle( $title, $query ) );
1393 }
1394
1398 public function clearSubtitle() {
1399 $this->mSubtitle = [];
1400 }
1401
1405 public function getSubtitle() {
1406 return implode( "<br />\n\t\t\t\t", $this->mSubtitle );
1407 }
1408
1412 public function setPrintable() {
1413 wfDeprecated( __METHOD__, '1.47' );
1414 }
1415
1420 public function isPrintable() {
1421 wfDeprecated( __METHOD__, '1.47' );
1422 return false;
1423 }
1424
1428 public function disable() {
1429 $this->mDoNothing = true;
1430 }
1431
1437 public function isDisabled() {
1438 return $this->mDoNothing;
1439 }
1440
1449 public function setSyndicated( $show = true ) {
1450 if ( $show ) {
1451 $this->setFeedAppendQuery( false );
1452 } else {
1453 $this->mFeedLinks = [];
1454 }
1455 }
1456
1463 protected function getAdvertisedFeedTypes() {
1464 if ( $this->getConfig()->get( MainConfigNames::Feed ) ) {
1465 return $this->getConfig()->get( MainConfigNames::AdvertisedFeedTypes );
1466 } else {
1467 return [];
1468 }
1469 }
1470
1480 public function setFeedAppendQuery( $val ) {
1481 $this->mFeedLinks = [];
1482
1483 foreach ( $this->getAdvertisedFeedTypes() as $type ) {
1484 $query = "feed=$type";
1485 if ( is_string( $val ) ) {
1486 $query .= '&' . $val;
1487 }
1488 $this->mFeedLinks[$type] = $this->getTitle()->getLocalURL( $query );
1489 }
1490 }
1491
1498 public function addFeedLink( $format, $href ) {
1499 if ( in_array( $format, $this->getAdvertisedFeedTypes() ) ) {
1500 $this->mFeedLinks[$format] = $href;
1501 }
1502 }
1503
1508 public function isSyndicated() {
1509 return count( $this->mFeedLinks ) > 0;
1510 }
1511
1516 public function getSyndicationLinks() {
1517 return $this->mFeedLinks;
1518 }
1519
1525 public function getFeedAppendQuery() {
1526 return $this->mFeedLinksAppendQuery;
1527 }
1528
1536 public function setArticleFlag( $newVal ) {
1537 $this->mIsArticle = $newVal;
1538 if ( $newVal ) {
1539 $this->mIsArticleRelated = $newVal;
1540 }
1541 }
1542
1549 public function isArticle() {
1550 return $this->mIsArticle;
1551 }
1552
1559 public function setArticleRelated( $newVal ) {
1560 $this->mIsArticleRelated = $newVal;
1561 if ( !$newVal ) {
1562 $this->mIsArticle = false;
1563 }
1564 }
1565
1571 public function isArticleRelated() {
1572 return $this->mIsArticleRelated;
1573 }
1574
1580 public function setCopyright( $hasCopyright ) {
1581 $this->mHasCopyright = $hasCopyright;
1582 }
1583
1593 public function showsCopyright() {
1594 return $this->isArticle() || $this->mHasCopyright;
1595 }
1596
1603 public function addLanguageLinks( array $newLinkArray ) {
1604 # $newLinkArray is in order of appearance on the page;
1605 # deduplicate so only the first for a given prefix is used
1606 # using code in ParserOutput (T26502)
1607 foreach ( $newLinkArray as $t ) {
1608 $this->metadata->addLanguageLink( $t );
1609 }
1610 }
1611
1617 public function getLanguageLinks() {
1618 $result = [];
1619 foreach ( $this->metadata->getLinkList( ParserOutputLinkTypes::LANGUAGE ) as [ 'link' => $link ] ) {
1620 $ll = $link->getInterwiki() . ':' . $link->getDBkey();
1621 # language links can have fragments
1622 if ( $link->getFragment() !== '' ) {
1623 $ll .= '#' . $link->getFragment();
1624 }
1625 $result[] = $ll;
1626 }
1627 return $result;
1628 }
1629
1635 public function addCategoryLinks( array $categories ) {
1636 if ( !$categories ) {
1637 return;
1638 }
1639
1640 $res = $this->addCategoryLinksToLBAndGetResult( $categories );
1641
1642 # Set all the values to 'normal'.
1643 $categories = array_fill_keys( array_keys( $categories ), 'normal' );
1644 $pageData = [];
1645
1646 # Mark hidden categories
1647 foreach ( $res as $row ) {
1648 if ( isset( $row->pp_value ) ) {
1649 $categories[$row->page_title] = 'hidden';
1650 }
1651 // Page exists, cache results
1652 if ( isset( $row->page_id ) ) {
1653 $pageData[$row->page_title] = $row;
1654 }
1655 }
1656
1657 # Add the remaining categories to the skin
1658 $services = MediaWikiServices::getInstance();
1659 $linkRenderer = $services->getLinkRenderer();
1660 $languageConverter = $services->getLanguageConverterFactory()
1661 ->getLanguageConverter( $services->getContentLanguage() );
1662 $collation = $services->getCollationFactory()->getCategoryCollation();
1663 foreach ( $categories as $category => $type ) {
1664 // array keys will cast numeric category names to ints, so cast back to string
1665 $category = (string)$category;
1666 $origcategory = $category;
1667 if ( array_key_exists( $category, $pageData ) ) {
1668 $title = Title::newFromRow( $pageData[$category] );
1669 } else {
1670 $title = Title::makeTitleSafe( NS_CATEGORY, $category );
1671 }
1672 if ( !$title ) {
1673 continue;
1674 }
1675 $languageConverter->findVariantLink( $category, $title, true );
1676
1677 if ( $category != $origcategory && array_key_exists( $category, $categories ) ) {
1678 continue;
1679 }
1680 $text = $languageConverter->convertHtml( $title->getText() );
1681 $link = null;
1682 $this->getHookRunner()->onOutputPageRenderCategoryLink( $this, $title->toPageIdentity(), $text, $link );
1683 if ( $link === null ) {
1684 $link = $linkRenderer->makeLink( $title, new HtmlArmor( $text ) );
1685 }
1686 $this->mCategoryData[] = [
1687 'sortKey' => $collation->getSortKey( $text ),
1688 'type' => $type,
1689 'title' => $title->getText(),
1690 'link' => $link,
1691 ];
1692 $this->mCategoriesSorted = false;
1693 // Setting mCategories and mCategoryLinks is redundant here,
1694 // but is needed for compatibility until mCategories and
1695 // mCategoryLinks are made private (T301020)
1696 $this->mCategories[$type][] = $title->getText();
1697 $this->mCategoryLinks[$type][] = $link;
1698 }
1699 }
1700
1705 protected function addCategoryLinksToLBAndGetResult( array $categories ) {
1706 # Add the links to a LinkBatch
1707 $arr = [ NS_CATEGORY => $categories ];
1708 $linkBatchFactory = MediaWikiServices::getInstance()->getLinkBatchFactory();
1709 $lb = $linkBatchFactory->newLinkBatch();
1710 $lb->setArray( $arr );
1711
1712 # Fetch existence plus the hiddencat property
1713 $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
1714 $fields = array_merge(
1715 LinkCache::getSelectFields(),
1716 [ 'pp_value' ]
1717 );
1718
1719 $res = $dbr->newSelectQueryBuilder()
1720 ->select( $fields )
1721 ->from( 'page' )
1722 ->leftJoin( 'page_props', null, [
1723 'pp_propname' => 'hiddencat',
1724 'pp_page = page_id',
1725 ] )
1726 ->where( $lb->constructSet( 'page', $dbr ) )
1727 ->caller( __METHOD__ )
1728 ->fetchResultSet();
1729
1730 # Add the results to the link cache
1731 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
1732 $lb->addResultToCache( $linkCache, $res );
1733
1734 return $res;
1735 }
1736
1746 public function getCategoryLinks() {
1747 $this->maybeSortCategories();
1748 return $this->mCategoryLinks;
1749 }
1750
1760 public function getCategories( $type = 'all' ) {
1761 $this->maybeSortCategories();
1762 if ( $type === 'all' ) {
1763 $allCategories = [];
1764 foreach ( $this->mCategories as $categories ) {
1765 $allCategories = array_merge( $allCategories, $categories );
1766 }
1767 return $allCategories;
1768 }
1769 if ( !isset( $this->mCategories[$type] ) ) {
1770 throw new InvalidArgumentException( 'Invalid category type given: ' . $type );
1771 }
1772 return $this->mCategories[$type];
1773 }
1774
1780 private function maybeSortCategories(): void {
1781 if ( $this->mCategoriesSorted ) {
1782 return;
1783 }
1784 // Check wiki configuration...
1785 $sortCategories = $this->getConfig()->get( MainConfigNames::SortedCategories );
1786 // ...but allow override with query parameter.
1787 $sortCategories = $this->getRequest()->getFuzzyBool( 'sortcat', $sortCategories );
1788 if ( $sortCategories ) {
1789 // Primary sort key is the first element of category data, but
1790 // break ties by looking at the other elements.
1791 usort( $this->mCategoryData, static function ( $a, $b ): int {
1792 return $a['type'] <=> $b['type'] ?:
1793 $a['sortKey'] <=> $b['sortKey'] ?:
1794 $a['title'] <=> $b['sortKey'] ?:
1795 $a['link'] <=> $b['link'];
1796 } );
1797 }
1798 // Remove duplicate entries
1799 $this->mCategoryData = array_values( array_unique( $this->mCategoryData, SORT_REGULAR ) );
1800
1801 // Rebuild mCategories and mCategoryLinks
1802 $this->mCategories = [
1803 'hidden' => [],
1804 'normal' => [],
1805 ];
1806 $this->mCategoryLinks = [];
1807 foreach ( $this->mCategoryData as $c ) {
1808 $this->mCategories[$c['type']][] = $c['title'];
1809 if ( $c['link'] !== null ) {
1810 // This test only needed because of ::setCategoryLinks()
1811 $this->mCategoryLinks[$c['type']][] = $c['link'];
1812 }
1813 }
1814 $this->mCategoriesSorted = true;
1815 }
1816
1831 public function setIndicators( array $indicators ) {
1832 $this->mIndicators = $indicators + $this->mIndicators;
1833 // Keep ordered by key
1834 ksort( $this->mIndicators );
1835 }
1836
1845 public function getIndicators(): array {
1846 // Note that some -- but not all -- indicators will be wrapped
1847 // with a class appropriate for user-generated wikitext content
1848 // (usually .mw-parser-output). The exceptions would be an
1849 // indicator added via ::addHelpLink() below, which adds content
1850 // which don't come from the parser and is not user-generated;
1851 // and any indicators added by extensions which may call
1852 // OutputPage::setIndicators() directly. In the latter case the
1853 // caller is responsible for wrapping any parser-generated
1854 // indicators.
1855 return $this->mIndicators;
1856 }
1857
1866 public function addHelpLink( $to, $overrideBaseUrl = false ) {
1867 $this->addModuleStyles( 'mediawiki.helplink' );
1868 $text = $this->msg( 'helppage-top-gethelp' )->escaped();
1869
1870 if ( $overrideBaseUrl ) {
1871 $helpUrl = $to;
1872 } else {
1873 $toUrlencoded = wfUrlencode( str_replace( ' ', '_', $to ) );
1874 $helpUrl = "https://www.mediawiki.org/wiki/Special:MyLanguage/$toUrlencoded";
1875 }
1876
1877 $link = Html::rawElement(
1878 'a',
1879 [
1880 'href' => $helpUrl,
1881 'target' => '_blank',
1882 'class' => 'mw-helplink',
1883 ],
1884 Html::element( 'span', [ 'class' => 'mw-helplink-icon' ] ) . $text
1885 );
1886
1887 // See note in ::getIndicators() above -- unlike wikitext-generated
1888 // indicators which come from ParserOutput, this indicator will not
1889 // be wrapped.
1890 $this->setIndicators( [ 'mw-helplink' => $link ] );
1891 }
1892
1901 public function disallowUserJs() {
1902 $this->reduceAllowedModules(
1903 RL\Module::TYPE_SCRIPTS,
1904 RL\Module::ORIGIN_CORE_INDIVIDUAL
1905 );
1906
1907 // Site-wide styles are controlled by a config setting, see T73621
1908 // for background on why. User styles are never allowed.
1910 $styleOrigin = RL\Module::ORIGIN_USER_SITEWIDE;
1911 } else {
1912 $styleOrigin = RL\Module::ORIGIN_CORE_INDIVIDUAL;
1913 }
1914 $this->reduceAllowedModules(
1915 RL\Module::TYPE_STYLES,
1916 $styleOrigin
1917 );
1918 }
1919
1926 public function getAllowedModules( $type ) {
1927 if ( $type == RL\Module::TYPE_COMBINED ) {
1928 return min( array_values( $this->mAllowedModules ) );
1929 } else {
1930 return $this->mAllowedModules[$type] ?? RL\Module::ORIGIN_ALL;
1931 }
1932 }
1933
1943 public function reduceAllowedModules( $type, $level ) {
1944 $this->mAllowedModules[$type] = min( $this->getAllowedModules( $type ), $level );
1945 }
1946
1953 public function prependHTML( $text ) {
1954 $this->mBodytext = $text . $this->mBodytext;
1955 }
1956
1963 public function addHTML( $text ) {
1964 $this->mBodytext .= $text;
1965 }
1966
1976 public function addElement( $element, array $attribs = [], $contents = '' ) {
1977 $this->addHTML( Html::element( $element, $attribs, $contents ) );
1978 }
1979
1983 public function clearHTML() {
1984 $this->mBodytext = '';
1985 }
1986
1992 public function getHTML() {
1993 return $this->mBodytext;
1994 }
1995
2002 private function internalParserOptions( bool $interface ): ParserOptions {
2003 if ( !$this->getUser()->isSafeToLoad() ) {
2004 // Context user isn't unstubbable yet, so don't try to get a
2005 // ParserOptions for it. And don't cache this ParserOptions
2006 // either.
2007 $parserOptions = ParserOptions::newFromAnon();
2008 } else {
2009 $parserOptions = ParserOptions::newFromContext( $this->getContext() );
2010 }
2011 $parserOptions->setAllowUnsafeRawHtml( false );
2012 $parserOptions->setSuppressSectionEditLinks();
2013 $parserOptions->setInterfaceMessage( $interface );
2014 return $parserOptions;
2015 }
2016
2024 public function setRevisionId( $revid ) {
2025 $val = $revid === null ? null : intval( $revid );
2026 return wfSetVar( $this->mRevisionId, $val, true );
2027 }
2028
2034 public function getRevisionId() {
2035 return $this->mRevisionId;
2036 }
2037
2042 public function setRevisionIsCurrent( bool $isCurrent ): void {
2043 $this->mRevisionIsCurrent = $isCurrent;
2044 }
2045
2052 public function isRevisionCurrent(): bool {
2053 return $this->mRevisionId == 0 || (
2054 $this->mRevisionIsCurrent ?? (
2055 $this->mRevisionId == $this->getTitle()->getLatestRevID()
2056 )
2057 );
2058 }
2059
2068 public function getRevisionTimestamp() {
2069 wfDeprecated( __METHOD__, '1.44' );
2070 return $this->metadata->getRevisionTimestamp();
2071 }
2072
2079 public function setFileVersion( $file ) {
2080 $val = null;
2081 if ( $file instanceof File && $file->exists() ) {
2082 $val = [ 'time' => $file->getTimestamp(), 'sha1' => $file->getSha1() ];
2083 }
2084 return wfSetVar( $this->mFileVersion, $val, true );
2085 }
2086
2092 public function getFileVersion() {
2093 return $this->mFileVersion;
2094 }
2095
2102 public function getTemplateIds() {
2103 $result = [];
2104 foreach (
2105 $this->metadata->getLinkList( ParserOutputLinkTypes::TEMPLATE ) as
2106 [ 'link' => $link, 'pageid' => $pageid, 'revid' => $revid ] ) {
2107 $ns = $link->getNamespace();
2108 $dbk = $link->getDBkey();
2109 $result[$ns][$dbk] = $revid;
2110 }
2111 return $result;
2112 }
2113
2120 public function getFileSearchOptions() {
2121 $result = [];
2122 foreach (
2123 $this->metadata->getLinkList( ParserOutputLinkTypes::MEDIA ) as
2124 $linkItem ) {
2125 $link = $linkItem['link'];
2126 unset( $linkItem['link'] );
2127 $result[$link->getDBkey()] = $linkItem + [
2128 'time' => null, 'sha1' => null,
2129 ];
2130 }
2131 return $result;
2132 }
2133
2148 public function addWikiTextAsInterface(
2149 $text, $linestart = true, ?PageReference $title = null
2150 ) {
2151 $title ??= $this->getTitle();
2152 if ( $title === null ) {
2153 throw new RuntimeException( 'No title in ' . __METHOD__ );
2154 }
2155 $this->addWikiTextTitleInternal( $text, $title, $linestart,
2156 $this->internalParserOptions( true ) );
2157 }
2158
2172 public function addWikiTextAsContent(
2173 $text, $linestart = true, ?PageReference $title = null
2174 ) {
2175 $title ??= $this->getTitle();
2176 if ( !$title ) {
2177 throw new RuntimeException( 'No title in ' . __METHOD__ );
2178 }
2179 $this->addWikiTextTitleInternal( $text, $title, $linestart,
2180 $this->internalParserOptions( false ) );
2181 }
2182
2194 private function addWikiTextTitleInternal(
2195 string $text, PageReference $title, bool $linestart, ParserOptions $popts,
2196 ?string $wrapperClass = null
2197 ) {
2198 [ $parserOutput, $parserOptions ] = $this->parseInternal(
2199 $text, $title, $linestart, $popts,
2200 /*allowTOC*/ true, $wrapperClass, /*postprocess*/ false
2201 );
2202
2203 $this->addParserOutput( $parserOutput, $parserOptions, [
2204 ] );
2205 }
2206
2212 public function setTOCData( TOCData $tocData ) {
2213 $this->tocData = $tocData;
2214 }
2215
2221 public function getTOCData(): ?TOCData {
2222 return $this->tocData;
2223 }
2224
2231 public function getOutputFlag( ParserOutputFlags|string $name ): bool {
2232 return $this->metadata->getOutputFlag( $name );
2233 }
2234
2240 public function setContentLangForJS( Bcp47Code $lang ): void {
2241 $this->contentLang = MediaWikiServices::getInstance()->getLanguageFactory()
2242 ->getLanguage( $lang );
2243 }
2244
2259 private function getContentLangForJS(): Language {
2260 if ( !$this->contentLang ) {
2261 // If this is not set, then we're likely not on in a request that renders page content
2262 // (e.g. ViewAction or ApiParse), but rather a different Action or SpecialPage.
2263 // In that case there isn't a main ParserOutput object to represent the page or output.
2264 // But, the skin and frontend code mostly don't make this distinction, and so we still
2265 // need to return something for mw.config.
2266 //
2267 // For historical reasons, the expectation is that:
2268 // * on a SpecialPage, we return the language for the content area just like on a
2269 // page view. SpecialPage content is localised, and so this is the user language.
2270 // * on an Action about a WikiPage, we return the language that content would have
2271 // been shown in, if this were a page view. This is generally the page language
2272 // as stored in the database, except adapted to the current user (e.g. in case of
2273 // translated pages or a language variant preference)
2274 //
2275 // This mess was centralised to here in 2023 (T341244).
2276 $title = $this->getTitle();
2277 if ( $title->isSpecialPage() ) {
2278 // Special pages render in the interface language, based on request context.
2279 // If the user's preference (or request parameter) specifies a variant,
2280 // the content may have been converted to the user's language variant.
2281 $pageLang = $this->getLanguage();
2282 } else {
2283 wfDebug( __METHOD__ . ' has to guess ParserOutput language' );
2284 // Guess what Article::getParserOutput and ParserOptions::optionsHash() would decide
2285 // on a page view:
2286 //
2287 // - Pages may have a custom page_lang set in the database,
2288 // via Title::getPageLanguage/Title::getDbPageLanguage
2289 //
2290 // - Interface messages (NS_MEDIAWIKI) render based on their subpage,
2291 // via Title::getPageLanguage/ContentHandler::getPageLanguage/MessageCache::figureMessage
2292 //
2293 // - Otherwise, pages are assumed to be in the wiki's default content language.
2294 // via Title::getPageLanguage/ContentHandler::getPageLanguage/MediaWikiServices::getContentLanguage
2295 $pageLang = $title->getPageLanguage();
2296 }
2297 if ( $title->getNamespace() !== NS_MEDIAWIKI ) {
2298 $services = MediaWikiServices::getInstance();
2299 $langConv = $services->getLanguageConverterFactory()->getLanguageConverter( $pageLang );
2300 // NOTE: LanguageConverter::getPreferredVariant inspects global RequestContext.
2301 // This usually returns $pageLang unchanged.
2302 $variant = $langConv->getPreferredVariant();
2303 if ( $pageLang->getCode() !== $variant ) {
2304 $pageLang = $services->getLanguageFactory()->getLanguage( $variant );
2305 }
2306 }
2307 $this->contentLang = $pageLang;
2308 }
2309 return $this->contentLang;
2310 }
2311
2320 public function addParserOutputMetadata( ParserOutput $parserOutput ) {
2321 // Merge the metadata of $parserOutput into $this->metadata (T301020).
2322 // This merges the flags, language links, template and media links,
2323 // page properties, extension data, revision timestamp, and limit
2324 // report, among other things.
2325 $parserOutput->collectMetadata( $this->metadata );
2326
2327 // The code below copies the metadata which OutputPage keeps in
2328 // other properties, or which have side effects on OutputPage.
2329
2330 $cats = [];
2331 foreach (
2332 $parserOutput->getLinkList( ParserOutputLinkTypes::CATEGORY )
2333 as [ 'link' => $link, 'sort' => $sort ]
2334 ) {
2335 $cats[$link->getDBkey()] = $sort;
2336 }
2337 $this->addCategoryLinks( $cats );
2338
2339 // Parser-generated indicators get wrapped like other parser output.
2340 $wrapClass = $parserOutput->getWrapperDivClass();
2341 $result = [];
2342 foreach ( $parserOutput->getIndicators() as $name => $html ) {
2343 if ( $html !== '' && $wrapClass !== '' ) {
2344 $html = Html::rawElement( 'div', [ 'class' => $wrapClass ], $html );
2345 }
2346 $result[$name] = $html;
2347 }
2348 $this->setIndicators( $result );
2349
2350 $tocData = $parserOutput->getTOCData();
2351 // Do not override existing TOC data if the new one is empty (T307256#8817705)
2352 // TODO: Invent a way to merge TOCs from multiple outputs (T327429)
2353 if ( $tocData !== null && ( $this->tocData === null || count( $tocData->getSections() ) > 0 ) ) {
2354 $this->setTOCData( $tocData );
2355 }
2356
2357 if ( !$parserOutput->isCacheable() ) {
2358 $this->disableClientCache();
2359 }
2360 $this->addHeadItems( $parserOutput->getHeadItems() );
2361 $this->addModules( $parserOutput->getModules() );
2362 $this->addModuleStyles( $parserOutput->getModuleStyles() );
2363 $this->addJsConfigVars( $parserOutput->getJsConfigVars() );
2364 $scriptSrcs = $parserOutput->getExtraCSPScriptSrcs();
2365 foreach ( $scriptSrcs as $src ) {
2366 $this->getCSP()->addScriptSrc( $src );
2367 }
2368 $defaultSrcs = $parserOutput->getExtraCSPDefaultSrcs();
2369 foreach ( $defaultSrcs as $src ) {
2370 $this->getCSP()->addDefaultSrc( $src );
2371 }
2372 $styleSrcs = $parserOutput->getExtraCSPStyleSrcs();
2373 foreach ( $styleSrcs as $src ) {
2374 $this->getCSP()->addStyleSrc( $src );
2375 }
2376
2377 // If $wgImagePreconnect is true, and if the output contains images, give the user-agent
2378 // a hint about a remote hosts from which images may be served. Launched in T123582.
2379 if ( $this->getConfig()->get( MainConfigNames::ImagePreconnect ) && $parserOutput->hasImages() ) {
2380 $preconnect = [];
2381 // Optimization: Instead of processing each image, assume that wikis either serve both
2382 // foreign and local from the same remote hostname (e.g. public wikis at WMF), or that
2383 // foreign images are common enough to be worth the preconnect (e.g. private wikis).
2384 $repoGroup = MediaWikiServices::getInstance()->getRepoGroup();
2385 $repoGroup->forEachForeignRepo( static function ( $repo ) use ( &$preconnect ) {
2386 $preconnect[] = $repo->getZoneUrl( 'thumb' );
2387 } );
2388 // Consider both foreign and local repos. While LocalRepo by default uses a relative
2389 // path on the same domain, wiki farms may configure it to use a dedicated hostname.
2390 $preconnect[] = $repoGroup->getLocalRepo()->getZoneUrl( 'thumb' );
2391 foreach ( $preconnect as $url ) {
2392 $host = parse_url( $url, PHP_URL_HOST );
2393 // It is expected that file URLs are often path-only, without hostname (T317329).
2394 if ( $host ) {
2395 $this->addLink( [ 'rel' => 'preconnect', 'href' => '//' . $host ] );
2396 break;
2397 }
2398 }
2399 }
2400
2401 // Enable OOUI if requested via ParserOutput
2402 if ( $parserOutput->getEnableOOUI() ) {
2403 $this->enableOOUI();
2404 }
2405
2406 // Link flags are ignored for now, but may in the future be
2407 // used to mark individual language links.
2408 $linkFlags = [];
2409 $languageLinks = $this->getLanguageLinks();
2410 sort( $languageLinks );
2411 // This hook can be used to remove/replace language links
2412 $this->getHookRunner()->onLanguageLinks( $this->getTitle(), $languageLinks, $linkFlags );
2413 $this->metadata->clearLanguageLinks();
2414 foreach ( ( $languageLinks ?? [] ) as $l ) {
2415 $this->metadata->addLanguageLink( $l );
2416 }
2417
2418 // ::collectMetadata() copied the flags already. Extract the flags
2419 // again to find changes that the hook makes.
2420 $flagsBefore = $this->extractParserOutputFlags( $parserOutput );
2421
2422 $this->getHookRunner()->onOutputPageParserOutput( $this, $parserOutput );
2423
2424 // This check must be after 'OutputPageParserOutput' runs in addParserOutputMetadata
2425 // so that extensions may modify ParserOutput to toggle TOC.
2426 // This cannot be moved to addParserOutputText because that is not
2427 // called by EditPage for Preview.
2428
2429 // ParserOutputFlags::SHOW_TOC is used to indicate whether the TOC
2430 // should be shown (or hidden) in the output.
2431 $this->mEnableTOC = $this->mEnableTOC ||
2432 $parserOutput->getOutputFlag( ParserOutputFlags::SHOW_TOC );
2433
2434 // The OutputPageParserOutput hook can change the flags of
2435 // $parserOutput. This is deprecated: emit a deprecation
2436 // warning if they changed.
2437 $flagsAfter = $this->extractParserOutputFlags( $parserOutput );
2438 if ( $flagsBefore !== $flagsAfter ) {
2440 'Changing ParserOutput flags in the OutputPageParserOutput hook ' .
2441 'was deprecated in MediaWiki 1.47. Changed flags: ' .
2442 implode( ', ', array_merge(
2443 array_diff( $flagsBefore, $flagsAfter ),
2444 array_diff( $flagsAfter, $flagsBefore )
2445 ) ),
2446 '1.47'
2447 );
2448 }
2449 // Uniform handling of all boolean flags: they are OR'ed together
2450 // (See ParserOutput::collectMetadata())
2451 foreach ( $flagsAfter as $flag ) {
2452 $this->metadata->setOutputFlag( $flag );
2453 }
2454 }
2455
2463 private function extractParserOutputFlags( ParserOutput $parserOutput ): array {
2464 $names =
2465 array_flip( $parserOutput->getAllFlags() ) +
2466 array_flip( ParserOutputFlags::values() );
2467 $flags = [];
2468 foreach ( $names as $name => $ignore ) {
2469 if ( $parserOutput->getOutputFlag( $name ) ) {
2470 $flags[] = (string)$name;
2471 }
2472 }
2473 sort( $flags );
2474 return $flags;
2475 }
2476
2477 private function getParserOutputText(
2478 ParserOutput $parserOutput,
2479 ParserOptions $parserOptions,
2480 array $poOptions
2481 ): string {
2482 // Add default options from the skin
2483 $skin = $this->getSkin();
2484 $skinOptions = $skin->getOptions();
2485 $oldText = $parserOutput->getContentHolderText();
2486 $poOptions += [
2487 // T371022
2488 'allowClone' => false,
2489 'skin' => $skin,
2490 'injectTOC' => $skinOptions['toc'],
2491 ];
2492 $pipeline = MediaWikiServices::getInstance()->getDefaultOutputPipeline();
2493 // Note: this path absolutely expects the metadata of $parserOutput to be mutated by the pipeline,
2494 // but the raw text should not be, see T353257
2495 // TODO T371008 consider if using the Content framework makes sense instead of creating the pipeline
2496 $text = $pipeline->run(
2497 $parserOutput,
2498 // This should be the same parser options that generated
2499 // $parserOutput
2500 $parserOptions,
2501 $poOptions
2502 )->getContentHolderText();
2503 $parserOutput->setContentHolderText( $oldText );
2504 return $text;
2505 }
2506
2517 public function addParserOutputContent(
2518 ParserOutput $parserOutput,
2519 ParserOptions $parserOptions,
2520 ?array $poOptions = null,
2521 ) {
2522 $poOptions ??= [];
2523 $text = $this->getParserOutputText( $parserOutput, $parserOptions, $poOptions );
2524 $this->addParserOutputText( $text, $poOptions );
2525
2526 $this->addModules( $parserOutput->getModules() );
2527 $this->addModuleStyles( $parserOutput->getModuleStyles() );
2528
2529 $this->addJsConfigVars( $parserOutput->getJsConfigVars() );
2530 }
2531
2539 public function addParserOutputText( string $text, $poOptions = [] ) {
2540 $this->getHookRunner()->onOutputPageBeforeHTML( $this, $text );
2541 $this->addHTML( $text );
2542 }
2543
2551 public function addParserOutput(
2552 ParserOutput $parserOutput,
2553 ParserOptions $parserOptions,
2554 ?array $poOptions = null,
2555 ) {
2556 $poOptions ??= [];
2557
2559 $text = $this->getParserOutputText( $parserOutput, $parserOptions, $poOptions );
2560 $this->addParserOutputMetadata( $parserOutput );
2561 $this->addParserOutputText( $text, $poOptions );
2562 }
2563
2564 public function addPostProcessedParserOutput( ParserOutput $parserOutput ) {
2565 $this->addParserOutputMetadata( $parserOutput );
2566 $this->addParserOutputText( $parserOutput->getContentHolderText() );
2567 }
2568
2574 public function addTemplate( &$template ) {
2575 $this->addHTML( $template->getHTML() );
2576 }
2577
2588 public function parseAsContent( $text, $linestart = true ) {
2589 $title = $this->getTitle();
2590 if ( $title === null ) {
2591 throw new RuntimeException( 'No title in ' . __METHOD__ );
2592 }
2593 [ $po, ] = $this->parseInternal(
2594 $text, $title, $linestart,
2595 $this->internalParserOptions( false ),
2596 /*allowTOC*/ false, /*wrapperDivClass*/ null, /*postprocess*/ true
2597 );
2598 return $po->getContentHolderText();
2599 }
2600
2612 public function parseAsInterface( $text, $linestart = true ) {
2613 $title = $this->getTitle();
2614 if ( $title === null ) {
2615 throw new RuntimeException( 'No title in ' . __METHOD__ );
2616 }
2617 [ $po, ] = $this->parseInternal(
2618 $text, $title, $linestart,
2619 $this->internalParserOptions( true ),
2620 /*allowTOC*/ false, /*wrapperDivClass*/ null, /*postprocess*/ true
2621 );
2622 return $po->getContentHolderText();
2623 }
2624
2638 public function parseInlineAsInterface( $text, $linestart = true ) {
2639 return Parser::stripOuterParagraph(
2640 $this->parseAsInterface( $text, $linestart )
2641 );
2642 }
2643
2656 private function parseInternal(
2657 string $text, PageReference $title,
2658 bool $linestart, ParserOptions $popts, bool $allowTOC, ?string $wrapperClass,
2659 bool $postprocess
2660 ) {
2661 $parserOutput = MediaWikiServices::getInstance()->getParserFactory()->getInstance()
2662 ->parse(
2663 $text, $title, $popts,
2664 $linestart, true, $this->mRevisionId
2665 );
2666
2667 // Don't include default mw-parser-output wrap class, just use our own
2668 $parserOutput->clearWrapperDivClass();
2669 if ( $wrapperClass !== null ) {
2670 $parserOutput->addWrapperDivClass( $wrapperClass );
2671 }
2672
2673 if ( !$allowTOC ) {
2674 $parserOutput->setOutputFlag( ParserOutputFlags::NO_TOC );
2675 $parserOutput->setSections( [] );
2676 }
2677
2678 if ( $postprocess ) {
2679 $pipeline = MediaWikiServices::getInstance()->getDefaultOutputPipeline();
2680 // TODO T371008 consider if using the Content framework makes sense instead of creating the pipeline
2681 $parserOutput = $pipeline->run(
2682 $parserOutput, $popts, [
2683 'userLang' => $this->getContext()->getLanguage(),
2684 ]
2685 );
2686 }
2687
2688 return [ $parserOutput, $popts ];
2689 }
2690
2696 public function setCdnMaxage( $maxage ) {
2697 $this->mCdnMaxage = min( $maxage, $this->mCdnMaxageLimit );
2698 }
2699
2709 public function lowerCdnMaxage( $maxage ) {
2710 $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
2711 $this->setCdnMaxage( $this->mCdnMaxage );
2712 }
2713
2726 public function adaptCdnTTL( $mtime, $minTTL = 0, $maxTTL = 0 ) {
2727 $minTTL = $minTTL ?: 60;
2728 $maxTTL = $maxTTL ?: $this->getConfig()->get( MainConfigNames::CdnMaxAge );
2729
2730 if ( $mtime === null || $mtime === false ) {
2731 // entity does not exist
2732 return;
2733 }
2734
2735 $age = MWTimestamp::time() - (int)wfTimestamp( TS::UNIX, $mtime );
2736 $adaptiveTTL = max( 0.9 * $age, $minTTL );
2737 $adaptiveTTL = min( $adaptiveTTL, $maxTTL );
2738
2739 $this->lowerCdnMaxage( (int)$adaptiveTTL );
2740 }
2741
2745 public function enableClientCache(): void {
2746 $this->mEnableClientCache = true;
2747 }
2748
2753 public function disableClientCache(): void {
2754 $this->mEnableClientCache = false;
2755 }
2756
2763 public function couldBePublicCached() {
2764 if ( !$this->cacheIsFinal ) {
2765 // - The entry point handles its own caching and/or doesn't use OutputPage.
2766 // (such as load.php, or MediaWiki\Rest\EntryPoint).
2767 //
2768 // - Or, we haven't finished processing the main part of the request yet
2769 // (e.g. Action::show, SpecialPage::execute), and the state may still
2770 // change via enableClientCache().
2771 return true;
2772 }
2773 // e.g. various error-type pages disable all client caching
2774 return $this->mEnableClientCache;
2775 }
2776
2786 public function considerCacheSettingsFinal() {
2787 $this->cacheIsFinal = true;
2788 }
2789
2790 private function getSessionManager(): SessionManagerInterface {
2791 return MediaWikiServices::getInstance()->getSessionManager();
2792 }
2793
2799 public function getCacheVaryCookies() {
2800 if ( self::$cacheVaryCookies === null ) {
2801 $config = $this->getConfig();
2802 self::$cacheVaryCookies = array_values( array_unique( array_merge(
2803 $this->getSessionManager()->getVaryCookies(),
2804 [
2805 'forceHTTPS',
2806 ],
2807 $config->get( MainConfigNames::CacheVaryCookies )
2808 ) ) );
2809 $this->getHookRunner()->onGetCacheVaryCookies( $this, self::$cacheVaryCookies );
2810 }
2811 return self::$cacheVaryCookies;
2812 }
2813
2820 public function haveCacheVaryCookies() {
2821 $request = $this->getRequest();
2822 foreach ( $this->getCacheVaryCookies() as $cookieName ) {
2823 if ( $request->getCookie( $cookieName, '', '' ) !== '' ) {
2824 wfDebug( __METHOD__ . ": found $cookieName" );
2825 return true;
2826 }
2827 }
2828 wfDebug( __METHOD__ . ': no cache-varying cookies found' );
2829 return false;
2830 }
2831
2837 public function addVaryHeader( $header ) {
2838 $this->mVaryHeader[$header] ??= null;
2839 }
2840
2847 public function getVaryHeader() {
2848 // If we vary on cookies, let's make sure it's always included here too.
2849 if ( $this->getCacheVaryCookies() ) {
2850 $this->addVaryHeader( 'Cookie' );
2851 }
2852
2853 foreach ( $this->getSessionManager()->getVaryHeaders() as $header => $_ ) {
2854 $this->addVaryHeader( $header );
2855 }
2856 return 'Vary: ' . implode( ', ', array_keys( $this->mVaryHeader ) );
2857 }
2858
2864 public function addLinkHeader( $header ) {
2865 $this->mLinkHeader[] = $header;
2866 }
2867
2873 public function getLinkHeader() {
2874 if ( !$this->mLinkHeader ) {
2875 return false;
2876 }
2877
2878 return 'Link: ' . implode( ',', $this->mLinkHeader );
2879 }
2880
2888 private function addAcceptLanguage() {
2889 $title = $this->getTitle();
2890 if ( !$title instanceof Title ) {
2891 return;
2892 }
2893
2894 $languageConverter = MediaWikiServices::getInstance()->getLanguageConverterFactory()
2895 ->getLanguageConverter( $title->getPageLanguage() );
2896 if ( !$this->getRequest()->getCheck( 'variant' ) && $languageConverter->hasVariants() ) {
2897 $this->addVaryHeader( 'Accept-Language' );
2898 }
2899 }
2900
2920 public function setPreventClickjacking( bool $enable ) {
2921 $this->metadata->setPreventClickjacking( $enable );
2922 }
2923
2931 public function getPreventClickjacking() {
2932 return $this->metadata->getPreventClickjacking();
2933 }
2934
2942 public function getFrameOptions() {
2943 $config = $this->getConfig();
2944 if ( $config->get( MainConfigNames::BreakFrames ) ) {
2945 return 'DENY';
2946 } elseif (
2947 $this->metadata->getPreventClickjacking() &&
2949 ) {
2950 return $config->get( MainConfigNames::EditPageFrameOptions );
2951 }
2952 return false;
2953 }
2954
2956 private function getReportTo() {
2957 $config = $this->getConfig();
2958
2959 $expiry = $config->get( MainConfigNames::ReportToExpiry );
2960
2961 if ( !$expiry ) {
2962 return false;
2963 }
2964
2965 $endpoints = $config->get( MainConfigNames::ReportToEndpoints );
2966
2967 if ( !$endpoints ) {
2968 return false;
2969 }
2970
2971 $output = [ 'max_age' => $expiry, 'endpoints' => [] ];
2972
2973 foreach ( $endpoints as $endpoint ) {
2974 $output['endpoints'][] = [ 'url' => $endpoint ];
2975 }
2976
2977 return json_encode( $output, JSON_UNESCAPED_SLASHES );
2978 }
2979
2980 private function getFeaturePolicyReportOnly(): string {
2981 $config = $this->getConfig();
2982
2983 $features = $config->get( MainConfigNames::FeaturePolicyReportOnly );
2984 return implode( ';', $features );
2985 }
2986
2990 public function sendCacheControl() {
2991 $response = $this->getRequest()->response();
2992 $config = $this->getConfig();
2993
2994 $this->addVaryHeader( 'Cookie' );
2995 $this->addAcceptLanguage();
2996
2997 # don't serve compressed data to clients who can't handle it
2998 # maintain different caches for logged-in users and non-logged in ones
2999 $response->header( $this->getVaryHeader() );
3000
3001 if ( $this->mEnableClientCache ) {
3002 if ( !$config->get( MainConfigNames::UseCdn ) ) {
3003 $privateReason = 'config';
3004 } elseif ( $response->hasCookies() ) {
3005 $privateReason = 'set-cookies';
3006 // The client might use methods other than cookies to appear logged-in.
3007 // E.g. HTTP headers, or query parameter tokens, OAuth, etc.
3008 } elseif ( $this->getRequest()->getSession()->isPersistent() ) {
3009 $privateReason = 'session';
3010 } elseif ( $this->mCdnMaxage == 0 ) {
3011 $privateReason = 'no-maxage';
3012 } elseif ( $this->haveCacheVaryCookies() ) {
3013 $privateReason = 'cache-vary-cookies';
3014 } else {
3015 $privateReason = false;
3016 }
3017
3018 if ( $privateReason === false ) {
3019 # We'll purge the proxy cache for anons explicitly, but require end user agents
3020 # to revalidate against the proxy on each visit.
3021 # IMPORTANT! The CDN needs to replace the Cache-Control header with
3022 # Cache-Control: s-maxage=0, must-revalidate, max-age=0
3023 wfDebug( __METHOD__ .
3024 ": local proxy caching; {$this->mLastModified} **", 'private' );
3025 # start with a shorter timeout for initial testing
3026 # HttpHeader::send( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
3027 $response->header( 'Cache-Control: ' .
3028 "s-maxage={$this->mCdnMaxage}, must-revalidate, max-age=0" );
3029 } else {
3030 # We do want clients to cache if they can, but they *must* check for updates
3031 # on revisiting the page.
3032 wfDebug( __METHOD__ . ": private caching ($privateReason); {$this->mLastModified} **", 'private' );
3033
3034 $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
3035 $response->header( 'Cache-Control: private, must-revalidate, max-age=0' );
3036 }
3037 if ( $this->mLastModified ) {
3038 $response->header( "Last-Modified: {$this->mLastModified}" );
3039 }
3040 } else {
3041 wfDebug( __METHOD__ . ': no caching **', 'private' );
3042
3043 # In general, the absence of a last modified header should be enough to prevent
3044 # the client from using its cache. We send a few other things just to make sure.
3045 $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
3046 $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
3047 }
3048 }
3049
3055 public function loadSkinModules( $sk ) {
3056 foreach ( $sk->getDefaultModules() as $group => $modules ) {
3057 if ( $group === 'styles' ) {
3058 foreach ( $modules as $moduleMembers ) {
3059 $this->addModuleStyles( $moduleMembers );
3060 }
3061 } else {
3062 $this->addModules( $modules );
3063 }
3064 }
3065 }
3066
3074 public function output( $return = false ) {
3075 if ( $this->mDoNothing ) {
3076 return $return ? '' : null;
3077 }
3078
3079 $request = $this->getRequest();
3080 $response = $request->response();
3081 $config = $this->getConfig();
3082
3083 if ( $this->mRedirect != '' ) {
3084 $services = MediaWikiServices::getInstance();
3085 // We do not expand redirect destinations to a full URL, because:
3086 // * Relative URLs are widely supported and valid under the HTTP 1.1 spec (RFC 7131).
3087 // * Expanding a absolute-path URL like "/wiki/Foo" can cause surprising cross-domain
3088 // redirects (T406402).
3089 // * Expanding a relative-path URL like "../Foo" using UrlUtils::expand would corrupt
3090 // the path instead of resolving against the current document location.
3091 // * Expanding a protocol-relative URL like "//example.org/Foo" would compromise
3092 // cacheability of the redirect response.
3093
3094 $redirect = $this->mRedirect;
3095 $code = $this->mRedirectCode;
3096 $content = '';
3097
3098 if ( $this->getHookRunner()->onBeforePageRedirect( $this, $redirect, $code ) ) {
3099 if ( $code == '301' || $code == '303' ) {
3100 if ( !$config->get( MainConfigNames::DebugRedirects ) ) {
3101 $response->statusHeader( (int)$code );
3102 }
3103 $this->mLastModified = wfTimestamp( TS::RFC2822 );
3104 }
3105 if ( $config->get( MainConfigNames::VaryOnXFP ) ) {
3106 $this->addVaryHeader( 'X-Forwarded-Proto' );
3107 }
3108 $this->sendCacheControl();
3109
3110 $response->header( 'Content-Type: text/html; charset=UTF-8' );
3111 if ( $config->get( MainConfigNames::DebugRedirects ) ) {
3112 $url = htmlspecialchars( $redirect );
3113 $content = "<!DOCTYPE html>\n<html>\n<head>\n"
3114 . "<title>Redirect</title>\n</head>\n<body>\n"
3115 . "<p>Location: <a href=\"$url\">$url</a></p>\n"
3116 . "</body>\n</html>\n";
3117
3118 if ( !$return ) {
3119 print $content;
3120 }
3121
3122 } else {
3123 $response->header( 'Location: ' . $redirect );
3124 }
3125 }
3126
3127 return $return ? $content : null;
3128 } elseif ( $this->mStatusCode ) {
3129 $response->statusHeader( $this->mStatusCode );
3130 }
3131
3132 # Buffer output; final headers may depend on later processing
3133 ob_start();
3134
3135 $response->header( 'Content-language: ' .
3136 MediaWikiServices::getInstance()->getContentLanguage()->getHtmlCode() );
3137
3138 $linkHeader = $this->getLinkHeader();
3139 if ( $linkHeader ) {
3140 $response->header( $linkHeader );
3141 }
3142
3143 // Prevent framing, if requested
3144 $frameOptions = $this->getFrameOptions();
3145 if ( $frameOptions ) {
3146 $response->header( "X-Frame-Options: $frameOptions" );
3147 }
3148
3149 // Get the Origin-Trial header values. This is used to enable Chrome Origin
3150 // Trials: https://github.com/GoogleChrome/OriginTrials
3151 $originTrials = $config->get( MainConfigNames::OriginTrials );
3152 foreach ( $originTrials as $originTrial ) {
3153 $response->header( "Origin-Trial: $originTrial", false );
3154 }
3155
3156 $reportTo = $this->getReportTo();
3157 if ( $reportTo ) {
3158 $response->header( "Report-To: $reportTo" );
3159 }
3160
3161 $featurePolicyReportOnly = $this->getFeaturePolicyReportOnly();
3162 if ( $featurePolicyReportOnly ) {
3163 $response->header( "Feature-Policy-Report-Only: $featurePolicyReportOnly" );
3164 }
3165
3166 // DBSC report-only: offer a binding once per session to measure how many
3167 // browsers could establish one. Covers sessions created by a session
3168 // provider, which never pass through AuthManager.
3169 if ( $config->get( MainConfigNames::DeviceBoundSessions )
3171 ) {
3172 MediaWikiServices::getInstance()->getDeviceBoundSessionReporter()
3173 ->offerOnce( $request->getSession(), $request, $response );
3174 }
3175
3176 if ( $this->mArticleBodyOnly ) {
3177 $response->header( 'Content-type: ' . $config->get( MainConfigNames::MimeType ) . '; charset=UTF-8' );
3178 if ( $this->cspOutputMode === self::CSP_HEADERS ) {
3179 $this->CSP->sendHeaders();
3180 }
3181 echo $this->mBodytext;
3182 } else {
3183 // Enable safe mode if requested (T152169)
3184 if ( $this->getRequest()->getBool( 'safemode' ) ) {
3185 $this->disallowUserJs();
3186 }
3187
3188 $sk = $this->getSkin();
3189 $skinOptions = $sk->getOptions();
3190
3191 if ( $skinOptions['format'] === 'json' ) {
3192 $response->header( 'Content-type: application/json; charset=UTF-8' );
3193 return json_encode( [
3194 '@WARNING' => $this->msg( 'skin-json-warning-message' )->escaped()
3195 ] + $sk->getTemplateData() );
3196 }
3197 $response->header( 'Content-type: ' . $config->get( MainConfigNames::MimeType ) . '; charset=UTF-8' );
3198 $this->loadSkinModules( $sk );
3199
3200 MWDebug::addModules( $this );
3201
3202 // Hook that allows last minute changes to the output page, e.g.
3203 // adding of CSS or JavaScript by extensions, adding CSP sources.
3204 $this->getHookRunner()->onBeforePageDisplay( $this, $sk );
3205
3206 if ( $this->cspOutputMode === self::CSP_HEADERS ) {
3207 $this->CSP->sendHeaders();
3208 }
3209
3210 try {
3211 $sk->outputPageFinal( $this );
3212 } catch ( Exception $e ) {
3213 ob_end_clean(); // bug T129657
3214 throw $e;
3215 }
3216 }
3217
3218 try {
3219 // This hook allows last minute changes to final overall output by modifying output buffer
3220 $this->getHookRunner()->onAfterFinalPageOutput( $this );
3221 } catch ( Exception $e ) {
3222 ob_end_clean(); // bug T129657
3223 throw $e;
3224 }
3225
3226 $this->sendCacheControl();
3227
3228 if ( $return ) {
3229 return ob_get_clean();
3230 } else {
3231 ob_end_flush();
3232 return null;
3233 }
3234 }
3235
3242 public function prepareErrorPage() {
3243 $this->setRobotPolicy( 'noindex,nofollow' );
3244 $this->setArticleRelated( false );
3245 $this->disableClientCache();
3246 $this->mRedirect = '';
3247 $this->clearSubtitle();
3248 $this->clearHTML();
3249 }
3250
3267 public function showErrorPage(
3268 $title, $msg, $params = [], $returnto = null, $returntoquery = null
3269 ) {
3270 if ( !$title instanceof Message ) {
3271 $title = $this->msg( $title );
3272 }
3273
3274 $this->prepareErrorPage();
3275 $this->setPageTitleMsg( $title );
3276
3277 if ( $msg instanceof Message ) {
3278 if ( $params !== [] ) {
3279 trigger_error( 'Argument ignored: $params. The message parameters argument '
3280 . 'is discarded when the $msg argument is a Message object instead of '
3281 . 'a string.', E_USER_NOTICE );
3282 }
3283 $this->addHTML( $msg->parseAsBlock() );
3284 } else {
3285 $this->addWikiMsgArray( $msg, $params );
3286 }
3287
3288 $this->addJsConfigVars( 'wgErrorPageMessageKey', is_string( $msg ) ? $msg : $msg->getKey() );
3289
3290 $this->returnToMain( null, $returnto, $returntoquery );
3291 }
3292
3299 public function showPermissionStatus( PermissionStatus $status, $action = null ) {
3300 Assert::precondition( !$status->isGood(), 'Status must have errors' );
3301
3302 $messages = $status->getMessages();
3303
3304 $services = MediaWikiServices::getInstance();
3305 $groupPermissionsLookup = $services->getGroupPermissionsLookup();
3306
3307 // Display a "login to do this action" error if all of the following conditions are met:
3308 // 1. the user is not logged in as a named user, and so cannot be added to groups
3309 // 2. the only error is insufficient permissions (i.e. no block or something else)
3310 // 3. the error can be avoided simply by logging in
3311
3312 if ( $action !== null && !$this->getUser()->isNamed() && count( $messages ) == 1
3313 && ( $messages[0]->getKey() == 'badaccess-groups' || $messages[0]->getKey() == 'badaccess-group0' )
3314 && ( $groupPermissionsLookup->groupHasPermission( 'user', $action )
3315 || $groupPermissionsLookup->groupHasPermission( 'autoconfirmed', $action ) )
3316 ) {
3317 $displayReturnto = null;
3318
3319 # Due to T34276, if a user does not have read permissions,
3320 # $this->getTitle() will just give Special:Badtitle, which is
3321 # not especially useful as a returnto parameter. Use the title
3322 # from the request instead, if there was one.
3323 $request = $this->getRequest();
3324 $returnto = Title::newFromText( $request->getText( 'title' ) );
3325 $extraParams = [];
3326 if ( $action == 'edit' ) {
3327 $msg = 'whitelistedittext';
3328 $displayReturnto = $returnto;
3329 } elseif ( $action == 'createpage' || $action == 'createtalk' ) {
3330 $msg = 'nocreatetext';
3331 } elseif ( $action == 'upload' ) {
3332 $msg = 'uploadnologintext';
3333 } elseif ( $action === 'read' ) {
3334 $msg = 'loginreqpagetext';
3335 $displayReturnto = Title::newMainPage();
3336 } else {
3337 $msg = 'permissionerror-login';
3338 $action_desc = $this->msg( "action-$action" )->plain();
3339 $extraParams = [ $action_desc ];
3340 }
3341
3342 $query = [];
3343
3344 if ( $returnto ) {
3345 $query['returnto'] = $returnto->getPrefixedText();
3346
3347 if ( !$request->wasPosted() ) {
3348 $returntoquery = $request->getQueryValues();
3349 unset( $returntoquery['title'] );
3350 unset( $returntoquery['returnto'] );
3351 unset( $returntoquery['returntoquery'] );
3352 $query['returntoquery'] = wfArrayToCgi( $returntoquery );
3353 }
3354 }
3355
3356 $title = SpecialPage::getTitleFor( 'Userlogin' );
3357 $linkRenderer = $services->getLinkRenderer();
3358 $loginUrl = $title->getLinkURL( $query, false, PROTO_RELATIVE );
3359 $loginLink = $linkRenderer->makeKnownLink(
3360 $title,
3361 $this->msg( 'loginreqlink' )->text(),
3362 [],
3363 $query
3364 );
3365
3366 $this->prepareErrorPage();
3367 $this->setPageTitleMsg( $this->msg( 'loginreqtitle' ) );
3368 $this->addHTML( $this->msg( $msg )
3369 ->rawParams( $loginLink )
3370 ->params( $loginUrl )
3371 ->params( $extraParams )
3372 ->parse()
3373 );
3374
3375 # Don't return to a page the user can't read otherwise
3376 # we'll end up in a pointless loop
3377 if ( $displayReturnto && $this->getAuthority()->probablyCan( 'read', $displayReturnto ) ) {
3378 $this->returnToMain( null, $displayReturnto );
3379 }
3380 } else {
3381 $this->prepareErrorPage();
3382 $this->setPageTitleMsg( $this->msg( 'permissionserrors' ) );
3383 $this->addWikiTextAsInterface( $this->formatPermissionStatus( $status, $action ) );
3384 }
3385 }
3386
3393 public function versionRequired( $version ) {
3394 $this->prepareErrorPage();
3395 $this->setPageTitleMsg(
3396 $this->msg( 'versionrequired' )->plaintextParams( $version )
3397 );
3398
3399 $this->addWikiMsg( 'versionrequiredtext', $version );
3400 $this->returnToMain();
3401 }
3402
3414 public function formatPermissionStatus( PermissionStatus $status, ?string $action = null ): string {
3415 if ( $status->isGood() ) {
3416 return '';
3417 }
3418
3419 if ( !$status->hasMessagesExcept( 'badaccess-group0' ) ) {
3420 // We don't know why you can't do it; admit that rather than saying the circular
3421 // "you don't have permission to do this because you are not allowed to do this"
3422 if ( $action === null ) {
3423 // We don't know what you were trying to do either.
3424 // At least say just "You are not allowed to do that" once rather than twice
3425 $text = $this->msg( 'badaccess-group0' )->plain();
3426 } else {
3427 $action_desc = $this->msg( "action-$action" )->plain();
3428 $text = $this->msg( 'permissionserrorstext-withaction-noreason', $action_desc )->plain();
3429 }
3430 return Html::rawElement( 'div', [ 'class' => 'permissions-errors' ], $text );
3431 }
3432
3433 $messages = array_map( $this->msg( ... ), $status->getMessages() );
3434
3435 if ( $action == null ) {
3436 $text = $this->msg( 'permissionserrorstext', count( $messages ) )->plain() . "\n\n";
3437 } else {
3438 $action_desc = $this->msg( "action-$action" )->plain();
3439 $text = $this->msg(
3440 'permissionserrorstext-withaction',
3441 count( $messages ),
3442 $action_desc
3443 )->plain() . "\n\n";
3444 }
3445
3446 if ( count( $messages ) > 1 ) {
3447 $text .= Html::openElement( 'ul', [ 'class' => 'permissions-errors' ] );
3448 foreach ( $messages as $message ) {
3449 $text .= Html::rawElement(
3450 'li',
3451 [ 'class' => 'mw-permissionerror-' . $message->getKey() ],
3452 $message->plain()
3453 );
3454 }
3455 $text .= Html::closeElement( 'ul' );
3456 } else {
3457 $text .= Html::openElement( 'div', [ 'class' => 'permissions-errors' ] );
3458 $text .= Html::rawElement(
3459 'div',
3460 [ 'class' => 'mw-permissionerror-' . $messages[ 0 ]->getKey() ],
3461 $messages[ 0 ]->plain()
3462 );
3463 $text .= Html::closeElement( 'div' );
3464 }
3465
3466 return $text;
3467 }
3468
3478 public function showLagWarning( $lag ) {
3479 $config = $this->getConfig();
3480 if ( $lag >= $config->get( MainConfigNames::DatabaseReplicaLagWarning ) ) {
3481 // floor to avoid nano seconds to display
3482 $lag = floor( $lag );
3483 $message = $lag < $config->get( MainConfigNames::DatabaseReplicaLagCritical )
3484 ? 'lag-warn-normal'
3485 : 'lag-warn-high';
3486 // For grep: mw-lag-warn-normal, mw-lag-warn-high
3487 $wrap = Html::rawElement( 'div', [ 'class' => "mw-{$message}" ], "\n$1\n" );
3488 $this->wrapWikiMsg( "$wrap\n", [ $message, $this->getLanguage()->formatNum( $lag ) ] );
3489 }
3490 }
3491
3500 public function addReturnTo( $title, array $query = [], $text = null, $options = [] ) {
3501 $linkRenderer = MediaWikiServices::getInstance()
3502 ->getLinkRendererFactory()->createFromLegacyOptions( $options );
3503 $link = $this->msg( 'returnto' )->rawParams(
3504 $linkRenderer->makeLink( $title, $text, [], $query ) )->escaped();
3505 $this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" );
3506 }
3507
3516 public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) {
3517 $returnto ??= $this->getRequest()->getText( 'returnto' );
3518
3519 $returntoquery ??= $this->getRequest()->getText( 'returntoquery' );
3520
3521 if ( $returnto === '' ) {
3522 $returnto = Title::newMainPage();
3523 }
3524
3525 if ( is_object( $returnto ) ) {
3526 $linkTarget = TitleValue::castPageToLinkTarget( $returnto );
3527 } else {
3528 $linkTarget = Title::newFromText( $returnto );
3529 }
3530
3531 // We don't want people to return to external interwiki. That
3532 // might potentially be used as part of a phishing scheme
3533 if ( !$linkTarget || $linkTarget->isExternal() ) {
3534 $linkTarget = Title::newMainPage();
3535 }
3536
3537 $this->addReturnTo( $linkTarget, wfCgiToArray( $returntoquery ) );
3538 }
3539
3558 public function showPendingTakeover(
3559 $fallbackUrl, $msg, ...$params
3560 ) {
3561 if ( $msg instanceof Message ) {
3562 if ( $params !== [] ) {
3563 trigger_error( 'Argument ignored: $params. The message parameters argument '
3564 . 'is discarded when the $msg argument is a Message object instead of '
3565 . 'a string.', E_USER_NOTICE );
3566 }
3567 $this->addHTML( $msg->parseAsBlock() );
3568 } else {
3569 $this->addHTML( $this->msg( $msg, ...$params )->parseAsBlock() );
3570 }
3571
3572 // Redirect if the user has no JS (<noscript>)
3573 $escapedUrl = htmlspecialchars( $fallbackUrl );
3574 $this->addHeadItem(
3575 'mw-noscript-fallback',
3576 // https://html.spec.whatwg.org/#attr-meta-http-equiv-refresh
3577 // means that if $fallbackUrl contains unencoded quotation marks
3578 // then this will behave confusingly, but shouldn't break the page
3579 "<noscript><meta http-equiv=\"refresh\" content=\"0; url=$escapedUrl\"></noscript>"
3580 );
3581 // Redirect if the user has no ResourceLoader
3582 $this->addScript( Html::inlineScript(
3583 '(window.NORLQ=window.NORLQ||[]).push(' .
3584 'function(){' .
3585 'location.href=' . json_encode( $fallbackUrl ) . ';' .
3586 '}' .
3587 ');'
3588 ) );
3589 }
3590
3601 private function inDebugMode() {
3602 if ( $this->debugMode === null ) {
3603 $resourceLoaderDebug = $this->getConfig()->get(
3605 $str = $this->getRequest()->getRawVal( 'debug' ) ??
3606 $this->getRequest()->getCookie( 'resourceLoaderDebug', '', $resourceLoaderDebug ? 'true' : '' );
3607 $this->debugMode = RL\Context::debugFromString( $str );
3608 }
3609 return $this->debugMode;
3610 }
3611
3612 private function getRlClientContext(): RL\Context {
3613 if ( !$this->rlClientContext ) {
3614 $query = ResourceLoader::makeLoaderQuery(
3615 [], // modules; not relevant
3616 $this->getLanguage()->getCode(),
3617 $this->getSkin()->getSkinName(),
3618 $this->getUser()->isRegistered() ? $this->getUser()->getName() : null,
3619 null, // version; not relevant
3620 $this->inDebugMode()
3621 );
3622 $this->rlClientContext = new RL\Context(
3623 $this->getResourceLoader(),
3624 new FauxRequest( $query )
3625 );
3626 if ( $this->contentOverrideCallbacks ) {
3627 $this->rlClientContext = new RL\DerivativeContext( $this->rlClientContext );
3628 $this->rlClientContext->setContentOverrideCallback( function ( $page ) {
3629 foreach ( $this->contentOverrideCallbacks as $callback ) {
3630 $content = $callback( $page );
3631 if ( $content !== null ) {
3632 $text = ( $content instanceof TextContent ) ? $content->getText() : '';
3633 if ( preg_match( '/<\/?script/i', $text ) ) {
3634 // Proactively replace this so that we can display a message
3635 // to the user, instead of letting it go to Html::inlineScript(),
3636 // where it would be considered a server-side issue.
3637 $content = new JavaScriptContent(
3638 Html::encodeJsCall( 'mw.log.error', [
3639 "Cannot preview $page due to suspecting script tag inside (T200506)."
3640 ] )
3641 );
3642 }
3643 return $content;
3644 }
3645 }
3646 return null;
3647 } );
3648 }
3649 }
3650 return $this->rlClientContext;
3651 }
3652
3664 public function getRlClient() {
3665 if ( !$this->rlClient ) {
3666 $context = $this->getRlClientContext();
3667 $rl = $this->getResourceLoader();
3668 $this->addModules( [
3669 'user',
3670 'user.options',
3671 ] );
3672 $this->addModuleStyles( [
3673 'site.styles',
3674 'noscript',
3675 'user.styles',
3676 ] );
3677 $generalModules = $this->getModules( /*filter*/ true );
3678 $moduleStyles = $this->getModuleStyles( /*filter*/ true );
3679
3680 // Preload getTitleInfo for:
3681 // * $moduleStyles:
3682 // For isKnownEmpty() calls below when computing $exemptGroups,
3683 // and for isKnownEmpty() calls in RL\ClientHtml when creating stylesheet links.
3684 // * any WikiModule in $generalModules:
3685 // For isKnownEmpty() calls in RL\ClientHtml skipping empty user/embedded JS modules.
3686 $preloadBatch = $moduleStyles;
3687 foreach ( $generalModules as $name ) {
3688 if ( $rl->getModule( $name ) instanceof RL\WikiModule ) {
3689 $preloadBatch[] = $name;
3690 }
3691 }
3692 RL\WikiModule::preloadTitleInfo( $context, $preloadBatch );
3693
3694 // Filter out style modules that buildExemptModules() should handle
3695 // instead of RL\ClientHtml
3696 $exemptGroups = [
3697 RL\Module::GROUP_SITE => [],
3698 RL\Module::GROUP_NOSCRIPT => [],
3699 RL\Module::GROUP_PRIVATE => [],
3700 RL\Module::GROUP_USER => []
3701 ];
3702 $exemptStates = [];
3703 $moduleStyles = array_filter( $moduleStyles,
3704 static function ( $name ) use ( $rl, $context, &$exemptGroups, &$exemptStates ) {
3705 $module = $rl->getModule( $name );
3706 if ( $module ) {
3707 $group = $module->getGroup();
3708 if ( $group !== null && isset( $exemptGroups[$group] ) ) {
3709 // The `noscript` module is excluded from the client
3710 // side registry, no need to set its state either.
3711 // But we still output it. See T291735
3712 if ( $group !== RL\Module::GROUP_NOSCRIPT ) {
3713 $exemptStates[$name] = 'ready';
3714 }
3715 if ( !$module->isKnownEmpty( $context ) ) {
3716 // E.g. Don't output empty <styles>
3717 $exemptGroups[$group][] = $name;
3718 }
3719 return false;
3720 }
3721 }
3722 return true;
3723 }
3724 );
3725 $this->rlExemptStyleModules = $exemptGroups;
3726
3727 $config = $this->getConfig();
3728 // Client preferences are controlled by the skin and specific to unregistered
3729 // users. See mw.user.clientPrefs for details on how this works and how to
3730 // handle registered users.
3731 $clientPrefEnabled = (
3732 $this->getSkin()->getOptions()['clientPrefEnabled'] &&
3733 !$this->getUser()->isNamed()
3734 );
3735 $clientPrefCookiePrefix = $config->get( MainConfigNames::CookiePrefix );
3736
3737 $rlClient = new RL\ClientHtml( $context, [
3738 // When 'safemode', disallowUserJs(), or reduceAllowedModules() is used
3739 // to only restrict modules to ORIGIN_CORE (ie. disallow ORIGIN_USER), the list of
3740 // modules enqueued for loading on this page is filtered to just those.
3741 // However, to make sure we also apply the restriction to dynamic dependencies and
3742 // lazy-loaded modules at run-time on the client-side, pass 'safemode' down to the
3743 // StartupModule so that the client-side registry will not contain any restricted
3744 // modules either. (T152169, T185303)
3745 'safemode' => ( $this->getAllowedModules( RL\Module::TYPE_COMBINED )
3746 <= RL\Module::ORIGIN_CORE_INDIVIDUAL
3747 ) ? '1' : null,
3748 'clientPrefEnabled' => $clientPrefEnabled,
3749 'clientPrefCookiePrefix' => $clientPrefCookiePrefix,
3750 ] );
3751 $rlClient->setConfig( $this->getJSVars( self::JS_VAR_EARLY ) );
3752 $rlClient->setModules( $generalModules );
3753 $rlClient->setModuleStyles( $moduleStyles );
3754 $rlClient->setExemptStates( $exemptStates );
3755 $this->rlClient = $rlClient;
3756 }
3757 return $this->rlClient;
3758 }
3759
3768 final public function getBodyAttributes( Skin $sk ): array {
3769 $services = MediaWikiServices::getInstance();
3770 $lookupService = $services->getUserOptionsLookup();
3771 $user = $this->getUser();
3772 $skinOptions = $sk->getOptions();
3773
3774 $bodyClasses = [
3775 'mediawiki',
3776
3777 // Classes for LTR/RTL directionality support
3778 // * ltr
3779 // * rtl
3780 // * sitedir-ltr
3781 // * sitedir-rtl
3782 $this->getLanguage()->getDir(),
3783 'sitedir-' . $services->getContentLanguage()->getDir(),
3784
3785 // Parser feature migration class
3786 // The idea is that this will eventually be removed, after the wikitext
3787 // which requires it is cleaned up.
3788 'mw-hide-empty-elt',
3789
3790 'action-' . Sanitizer::escapeClass( $this->getContext()->getActionName() ),
3791
3792 // This adds mw-article-diff via Article:showDiffPage
3793 ...$this->mAdditionalBodyClasses,
3794
3795 'skin-' . Sanitizer::escapeClass( $sk->getSkinName() ),
3796 // FIXME: This still varies by user (T439272)
3797 $sk->getPageClasses( $this->getTitle() ),
3798
3799 ...$skinOptions['bodyClasses'],
3800 ];
3801
3802 if ( $sk->isResponsive() ) {
3803 $bodyClasses[] = 'skin--responsive';
3804 }
3805
3806 $bodyAttrs = [
3807 // While Html::element allows class to be an array, we convert it to a string
3808 // for compatibility with the hook
3809 'class' => Html::expandClassList( $bodyClasses ),
3810 ];
3811 $this->getHookRunner()->onOutputPageBodyAttributes( $this, $sk, $bodyAttrs );
3812 return $bodyAttrs;
3813 }
3814
3820 public function headElement( Skin $sk, $includeStyle = true ) {
3821 $services = MediaWikiServices::getInstance();
3822 $config = $this->getConfig();
3823 $user = $this->getUser();
3824 $lookupService = $services->getUserOptionsLookup();
3825
3826 $rlHtmlAtribs = $this->getRlClient()->getDocumentAttributes();
3827 $skinHtmlAttribs = $sk->getHtmlElementAttributes();
3828
3829 $thumbnailIndex = $lookupService->getOption( $user, 'thumbsize' );
3830 $thumbnailSize = $config->get( MainConfigNames::ThumbLimits )[$thumbnailIndex] ?? 250;
3831 $thumbValue = $thumbnailSize === 250 ? 'standard' : (
3832 $thumbnailSize < 250 ? 'small' : 'large'
3833 );
3834
3835 $underlineClass = match ( $lookupService->getIntOption( $user, 'underline', 2 ) ) {
3836 0 => 'skin-underline-clientpref-never',
3837 1 => 'skin-underline-clientpref-always',
3838 default => 'skin-underline-clientpref-browser',
3839 };
3840
3841 // The HTML classes MUST NOT vary by page, due to ESI constraints (T439272).
3842 $htmlClass = Html::expandClassList( [
3843 Html::expandClassList( $rlHtmlAtribs['class'] ?? [] ),
3844 Html::expandClassList( $skinHtmlAttribs['class'] ?? [] ),
3845 Html::expandClassList( $this->mAdditionalHtmlClasses ),
3846 // This uses `-clientpref-` for now to support future customization for anonymous users.
3847 'skin-thumbsize-clientpref-' . $thumbValue,
3848 $underlineClass,
3849 ] );
3850 $htmlAttribs = array_merge( $rlHtmlAtribs, $skinHtmlAttribs, [ 'class' => $htmlClass ] );
3851
3852 $pieces = [];
3853 $pieces[] = Html::htmlHeader( $htmlAttribs );
3854 $pieces[] = Html::openElement( 'head' );
3855
3856 if ( $this->getHTMLTitle() == '' ) {
3857 $this->setHTMLTitle( $this->msg( 'pagetitle', $this->getPageTitle() )->inContentLanguage() );
3858 }
3859
3860 if ( !Html::isXmlMimeType( $config->get( MainConfigNames::MimeType ) ) ) {
3861 // Add <meta charset="UTF-8">
3862 // This should be before <title> since it defines the charset used by
3863 // text including the text inside <title>.
3864 // The spec recommends defining XHTML5's charset using the XML declaration
3865 // instead of meta.
3866 // Our XML declaration is output by Html::htmlHeader.
3867 // https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-content-type
3868 // https://html.spec.whatwg.org/multipage/semantics.html#charset
3869 $pieces[] = Html::element( 'meta', [ 'charset' => 'UTF-8' ] );
3870 }
3871
3872 $pieces[] = Html::element( 'title', [], $this->getHTMLTitle() );
3873 $pieces[] = $this->getRlClient()->getHeadHtml( $htmlClass );
3874 $pieces[] = $this->buildExemptModules();
3875 $pieces = array_merge( $pieces, array_values( $this->getHeadLinksArray() ) );
3876 $pieces = array_merge( $pieces, array_values( $this->mHeadItems ) );
3877
3878 $pieces[] = Html::closeElement( 'head' );
3879 $pieces[] = Html::openElement( 'body', $this->getBodyAttributes( $sk ) );
3880
3881 // Add dedicated ARIA live region container for notifications to assistive technology users.
3882 // Note that `aria-atomic="false"` and `aria-relevant="additions text"` are the default
3883 // values and therefore not duplicated below.
3884 $pieces[] = Html::rawElement( 'div', [
3885 'id' => 'mw-aria-live-region',
3886 'class' => 'mw-aria-live-region',
3887 'aria-live' => 'polite',
3888 ], '' );
3889
3890 return self::combineWrappedStrings( $pieces );
3891 }
3892
3898 public function getResourceLoader() {
3899 if ( $this->mResourceLoader === null ) {
3900 // Lazy-initialise as needed
3901 $this->mResourceLoader = MediaWikiServices::getInstance()->getResourceLoader();
3902 }
3903 return $this->mResourceLoader;
3904 }
3905
3914 public function makeResourceLoaderLink( $modules, $only, array $extraQuery = [] ) {
3915 // Apply 'origin' filters
3916 $modules = $this->filterModules( (array)$modules, null, $only );
3917
3918 return RL\ClientHtml::makeLoad(
3919 $this->getRlClientContext(),
3920 $modules,
3921 $only,
3922 $extraQuery
3923 );
3924 }
3925
3932 protected static function combineWrappedStrings( array $chunks ) {
3933 // Filter out empty values
3934 $chunks = array_filter( $chunks, static fn ( $str ) => (string)$str !== '' );
3935 return WrappedString::join( "\n", $chunks );
3936 }
3937
3944 public function getBottomScripts() {
3945 // Keep the hook appendage separate to preserve WrappedString objects.
3946 // This enables to merge them where possible.
3947 $extraHtml = '';
3948 $this->getHookRunner()->onSkinAfterBottomScripts( $this->getSkin(), $extraHtml );
3949
3950 $chunks = [];
3951 $chunks[] = $this->getRlClient()->getBodyHtml();
3952
3953 // Legacy non-ResourceLoader scripts
3954 $chunks[] = $this->mScripts;
3955
3956 // Keep hostname and backend time as the first variables for quick view-source access.
3957 // These other variables will form a very long inline blob.
3958 $vars = [];
3959 if ( $this->getConfig()->get( MainConfigNames::ShowHostnames ) ) {
3960 $vars['wgHostname'] = wfHostname();
3961 }
3962 $elapsed = $this->getRequest()->getElapsedTime();
3963 // seconds to milliseconds
3964 $vars['wgBackendResponseTime'] = round( $elapsed * 1000 );
3965
3966 $vars += $this->getJSVars( self::JS_VAR_LATE );
3967 $limitReportJSData = $this->metadata->getLimitReportJSData();
3968 if ( $limitReportJSData ) {
3969 $vars['wgPageParseReport'] = $limitReportJSData;
3970 }
3971
3972 $rlContext = $this->getRlClientContext();
3973 $chunks[] = ResourceLoader::makeInlineScript(
3974 'mw.config.set(' . $rlContext->encodeJson( $vars ) . ');'
3975 );
3976
3977 $chunks = [ self::combineWrappedStrings( $chunks ) ];
3978 if ( $extraHtml !== '' ) {
3979 $chunks[] = $extraHtml;
3980 }
3981
3982 return WrappedString::join( "\n", $chunks );
3983 }
3984
3991 public function getJsConfigVars() {
3992 return $this->mJsConfigVars;
3993 }
3994
4001 public function addJsConfigVars( $keys, $value = null ) {
4002 if ( is_array( $keys ) ) {
4003 foreach ( $keys as $key => $value ) {
4004 $this->mJsConfigVars[$key] = $value;
4005 }
4006 return;
4007 }
4008
4009 $this->mJsConfigVars[$keys] = $value;
4010 }
4011
4030 public function getJSVars( ?int $flag = null ) {
4031 $curRevisionId = 0;
4032 $articleId = 0;
4033 // T23115
4034 $canonicalSpecialPageName = false;
4035 $services = MediaWikiServices::getInstance();
4036
4037 $title = $this->getTitle();
4038 $ns = $title->getNamespace();
4039 $nsInfo = $services->getNamespaceInfo();
4040 $canonicalNamespace = $nsInfo->exists( $ns )
4041 ? $nsInfo->getCanonicalName( $ns )
4042 : $title->getNsText();
4043
4044 $sk = $this->getSkin();
4045 // Get the relevant title so that AJAX features can use the correct page name
4046 // when making API requests from certain special pages (T36972).
4047 $relevantTitle = $sk->getRelevantTitle();
4048
4049 if ( $ns === NS_SPECIAL ) {
4050 [ $canonicalSpecialPageName, ] =
4051 $services->getSpecialPageFactory()->
4052 resolveAlias( $title->getDBkey() );
4053 } elseif ( $this->canUseWikiPage() ) {
4054 $wikiPage = $this->getWikiPage();
4055 // If we already know that the latest revision ID is the same as the revision ID being viewed,
4056 // avoid fetching it again, as it may give inconsistent results (T339164).
4057 if ( $this->isRevisionCurrent() && $this->getRevisionId() ) {
4058 $curRevisionId = $this->getRevisionId();
4059 } else {
4060 $curRevisionId = $wikiPage->getLatest();
4061 }
4062 $articleId = $wikiPage->getId();
4063 }
4064
4065 // ParserOutput informs HTML/CSS via lang/dir attributes.
4066 // We inform JavaScript via mw.config from here.
4067 $lang = $this->getContentLangForJS();
4068
4069 // Pre-process information
4070 $separatorTransTable = $lang->separatorTransformTable();
4071 $separatorTransTable = $separatorTransTable ?: [];
4072 $compactSeparatorTransTable = [
4073 implode( "\t", array_keys( $separatorTransTable ) ),
4074 implode( "\t", $separatorTransTable ),
4075 ];
4076 $digitTransTable = $lang->digitTransformTable();
4077 $digitTransTable = $digitTransTable ?: [];
4078 $compactDigitTransTable = [
4079 implode( "\t", array_keys( $digitTransTable ) ),
4080 implode( "\t", $digitTransTable ),
4081 ];
4082
4083 $user = $this->getUser();
4084
4085 // Internal variables for MediaWiki core
4086 $vars = [
4087 // @internal For mediawiki.page.ready
4088 'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
4089
4090 // @internal For jquery.tablesorter
4091 'wgSeparatorTransformTable' => $compactSeparatorTransTable,
4092 'wgDigitTransformTable' => $compactDigitTransTable,
4093 'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
4094 'wgMonthNames' => $lang->getMonthNamesArray(),
4095
4096 // @internal For debugging purposes
4097 'wgRequestId' => WebRequest::getRequestId(),
4098 ];
4099
4100 // Start of supported and stable config vars (for use by extensions/gadgets).
4101 $vars += [
4102 'wgCanonicalNamespace' => $canonicalNamespace,
4103 'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
4104 'wgNamespaceNumber' => $title->getNamespace(),
4105 'wgPageName' => $title->getPrefixedDBkey(),
4106 'wgTitle' => $title->getText(),
4107 'wgCurRevisionId' => $curRevisionId,
4108 'wgRevisionId' => (int)$this->getRevisionId(),
4109 'wgArticleId' => $articleId,
4110 'wgIsArticle' => $this->isArticle(),
4111 'wgIsRedirect' => $title->isRedirect(),
4112 'wgAction' => $this->getContext()->getActionName(),
4113 'wgUserName' => $user->isAnon() ? null : $user->getName(),
4114 'wgUserGroups' => $services->getUserGroupManager()->getUserEffectiveGroups( $user ),
4115 'wgCategories' => $this->getCategories(),
4116 'wgPageViewLanguage' => $lang->getCode(),
4117 'wgPageContentLanguage' => $lang->getCode(),
4118 'wgPageContentModel' => $title->getContentModel(),
4119 'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
4120 'wgRelevantArticleId' => $relevantTitle->getArticleID(),
4121 ];
4122 if ( $user->isRegistered() ) {
4123 $vars['wgUserId'] = $user->getId();
4124 $vars['wgUserIsTemp'] = $user->isTemp();
4125 $vars['wgUserEditCount'] = $user->getEditCount();
4126 $userReg = $user->getRegistration();
4127 $vars['wgUserRegistration'] = $userReg ? (int)wfTimestamp( TS::UNIX, $userReg ) * 1000 : null;
4128 $userFirstReg = $services->getUserRegistrationLookup()->getFirstRegistration( $user );
4129 $vars['wgUserFirstRegistration'] = $userFirstReg ?
4130 (int)wfTimestamp( TS::UNIX, $userFirstReg ) * 1000 : null;
4131 // Get the revision ID of the oldest new message on the user's talk
4132 // page. This can be used for constructing new message alerts on
4133 // the client side.
4134 $userNewMsgRevId = $this->getLastSeenUserTalkRevId();
4135 // Only occupy precious space in the <head> when it is non-null (T53640)
4136 // mw.config.get returns null by default.
4137 if ( $userNewMsgRevId ) {
4138 $vars['wgUserNewMsgRevisionId'] = $userNewMsgRevId;
4139 }
4140 } else {
4141 $tempUserCreator = $services->getTempUserCreator();
4142 if ( $tempUserCreator->isEnabled() ) {
4143 // For logged-out users only (without a temporary account): get the user name that will
4144 // be used for their temporary account, if it has already been acquired.
4145 // This may be used in previews.
4146 $session = $this->getRequest()->getSession();
4147 $vars['wgTempUserName'] = $tempUserCreator->getStashedName( $session );
4148 }
4149 }
4150 $languageConverter = $services->getLanguageConverterFactory()
4151 ->getLanguageConverter( $title->getPageLanguage() );
4152 if ( $languageConverter->hasVariants() ) {
4153 $vars['wgUserVariant'] = $languageConverter->getPreferredVariant();
4154 }
4155 // Same test as SkinTemplate
4156 $vars['wgIsProbablyEditable'] = $this->getAuthority()->probablyCan( 'edit', $title );
4157 $vars['wgRelevantPageIsProbablyEditable'] = $relevantTitle &&
4158 $this->getAuthority()->probablyCan( 'edit', $relevantTitle );
4159 $restrictionStore = $services->getRestrictionStore();
4160 foreach ( $restrictionStore->listApplicableRestrictionTypes( $title ) as $type ) {
4161 // Following keys are set in $vars:
4162 // wgRestrictionCreate, wgRestrictionEdit, wgRestrictionMove, wgRestrictionUpload
4163 $vars['wgRestriction' . ucfirst( $type )] = $restrictionStore->getRestrictions( $title, $type );
4164 }
4165 if ( $title->isMainPage() ) {
4166 $vars['wgIsMainPage'] = true;
4167 }
4168
4169 $relevantUser = $sk->getRelevantUser();
4170 if ( $relevantUser ) {
4171 $vars['wgRelevantUserName'] = $relevantUser->getName();
4172 }
4173 // End of stable config vars
4174
4175 $titleFormatter = $services->getTitleFormatter();
4176
4177 if ( $this->mRedirectedFrom ) {
4178 // @internal For skin JS
4179 $vars['wgRedirectedFrom'] = $titleFormatter->getPrefixedDBkey( $this->mRedirectedFrom );
4180 }
4181
4182 // Allow extensions to add their custom variables to the mw.config map.
4183 // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not
4184 // page-dependent but site-wide (without state).
4185 // Alternatively, you may want to use OutputPage->addJsConfigVars() instead.
4186 $this->getHookRunner()->onMakeGlobalVariablesScript( $vars, $this );
4187
4188 // Merge in variables from addJsConfigVars last
4189 $vars = array_merge( $vars, $this->getJsConfigVars() );
4190
4191 // Return only early or late vars if requested
4192 if ( $flag !== null ) {
4193 $lateVarNames =
4194 array_fill_keys( self::CORE_LATE_JS_CONFIG_VAR_NAMES, true ) +
4195 array_fill_keys( ExtensionRegistry::getInstance()->getAttribute( 'LateJSConfigVarNames' ), true );
4196 foreach ( $vars as $name => $_ ) {
4197 // If the variable's late flag doesn't match the requested late flag, unset it
4198 if ( isset( $lateVarNames[ $name ] ) !== ( $flag === self::JS_VAR_LATE ) ) {
4199 unset( $vars[ $name ] );
4200 }
4201 }
4202 }
4203
4204 return $vars;
4205 }
4206
4212 private function getLastSeenUserTalkRevId() {
4213 $services = MediaWikiServices::getInstance();
4214 $user = $this->getUser();
4215 $userHasNewMessages = $services
4216 ->getTalkPageNotificationManager()
4217 ->userHasNewMessages( $user );
4218 if ( !$userHasNewMessages ) {
4219 return null;
4220 }
4221
4222 $timestamp = $services
4223 ->getTalkPageNotificationManager()
4224 ->getLatestSeenMessageTimestamp( $user );
4225 if ( !$timestamp ) {
4226 return null;
4227 }
4228
4229 $revRecord = $services->getRevisionLookup()->getRevisionByTimestamp(
4230 $user->getTalkPage(),
4231 $timestamp
4232 );
4233 return $revRecord ? $revRecord->getId() : null;
4234 }
4235
4245 public function userCanPreview() {
4246 $request = $this->getRequest();
4247 if (
4248 $request->getRawVal( 'action' ) !== 'submit' ||
4249 !$request->wasPosted()
4250 ) {
4251 return false;
4252 }
4253
4254 $user = $this->getUser();
4255
4256 if ( !$user->isRegistered() ) {
4257 // Anons have predictable edit tokens
4258 return false;
4259 }
4260 if ( !$user->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) {
4261 return false;
4262 }
4263
4264 $title = $this->getTitle();
4265 if ( !$this->getAuthority()->probablyCan( 'edit', $title ) ) {
4266 return false;
4267 }
4268
4269 return true;
4270 }
4271
4275 public function getHeadLinksArray() {
4276 $tags = [];
4277 $config = $this->getConfig();
4278
4279 if ( $this->cspOutputMode === self::CSP_META ) {
4280 foreach ( $this->CSP->getDirectives() as $header => $directive ) {
4281 $tags["meta-csp-$header"] = Html::element( 'meta', [
4282 'http-equiv' => $header,
4283 'content' => $directive,
4284 ] );
4285 }
4286 }
4287
4288 $tags['meta-generator'] = Html::element( 'meta', [
4289 'name' => 'generator',
4290 'content' => 'MediaWiki ' . MW_VERSION,
4291 ] );
4292
4293 if ( $config->get( MainConfigNames::ReferrerPolicy ) !== false ) {
4294 // Per https://w3c.github.io/webappsec-referrer-policy/#unknown-policy-values
4295 // fallbacks should come before the primary value so we need to reverse the array.
4296 foreach ( array_reverse( (array)$config->get( MainConfigNames::ReferrerPolicy ) ) as $i => $policy ) {
4297 $tags["meta-referrer-$i"] = Html::element( 'meta', [
4298 'name' => 'referrer',
4299 'content' => $policy,
4300 ] );
4301 }
4302 }
4303
4304 $p = $this->getRobotsContent();
4305 if ( $p ) {
4306 // http://www.robotstxt.org/wc/meta-user.html
4307 // Only show if it's different from the default robots policy
4308 $tags['meta-robots'] = Html::element( 'meta', [
4309 'name' => 'robots',
4310 'content' => $p,
4311 ] );
4312 }
4313
4314 # Browser based phone number detection
4315 if ( $config->get( MainConfigNames::BrowserFormatDetection ) !== false ) {
4316 $tags['meta-format-detection'] = Html::element( 'meta', [
4317 'name' => 'format-detection',
4318 'content' => $config->get( MainConfigNames::BrowserFormatDetection ),
4319 ] );
4320 }
4321
4322 foreach ( $this->mMetatags as [ $name, $val ] ) {
4323 $attrs = [];
4324 if ( strncasecmp( $name, 'http:', 5 ) === 0 ) {
4325 $name = substr( $name, 5 );
4326 $attrs['http-equiv'] = $name;
4327 } elseif ( strncasecmp( $name, 'og:', 3 ) === 0 ) {
4328 $attrs['property'] = $name;
4329 } else {
4330 $attrs['name'] = $name;
4331 }
4332 $attrs['content'] = $val;
4333 $tagName = "meta-$name";
4334 if ( isset( $tags[$tagName] ) ) {
4335 $tagName .= $val;
4336 }
4337 $tags[$tagName] = Html::element( 'meta', $attrs );
4338 }
4339
4340 foreach ( $this->mLinktags as $tag ) {
4341 $tags[] = Html::element( 'link', $tag );
4342 }
4343
4344 if ( $config->get( MainConfigNames::UniversalEditButton ) && $this->isArticleRelated() ) {
4345 if ( $this->getAuthority()->probablyCan( 'edit', $this->getTitle() ) ) {
4346 $msg = $this->msg( 'edit' )->text();
4347 // Use mime type per https://phabricator.wikimedia.org/T21165#6946526
4348 $tags['universal-edit-button'] = Html::element( 'link', [
4349 'rel' => 'alternate',
4350 'type' => 'application/x-wiki',
4351 'title' => $msg,
4352 'href' => $this->getTitle()->getEditURL(),
4353 ] );
4354 }
4355 }
4356
4357 # Generally, the order of the favicon and apple-touch-icon links
4358 # should not matter, but Konqueror (3.5.9 at least) incorrectly
4359 # uses whichever one appears later in the HTML source. Make sure
4360 # apple-touch-icon is specified first to avoid this.
4361 $appleTouchIconHref = $config->get( MainConfigNames::AppleTouchIcon );
4362 # Browser look for those by default, unnecessary to set a link tag
4363 if (
4364 $appleTouchIconHref !== false &&
4365 $appleTouchIconHref !== '/apple-touch-icon.png' &&
4366 $appleTouchIconHref !== '/apple-touch-icon-precomposed.png'
4367 ) {
4368 $tags['apple-touch-icon'] = Html::element( 'link', [
4369 'rel' => 'apple-touch-icon',
4370 'href' => $appleTouchIconHref
4371 ] );
4372 }
4373
4374 $faviconHref = $config->get( MainConfigNames::Favicon );
4375 # Browser look for those by default, unnecessary to set a link tag
4376 if ( $faviconHref !== false && $faviconHref !== '/favicon.ico' ) {
4377 $tags['favicon'] = Html::element( 'link', [
4378 'rel' => 'icon',
4379 'href' => $faviconHref
4380 ] );
4381 }
4382
4383 # OpenSearch description link
4384 $tags['opensearch'] = Html::element( 'link', [
4385 'rel' => 'search',
4386 'type' => 'application/opensearchdescription+xml',
4387 'href' => wfScript( 'rest' ) . '/v1/search',
4388 'title' => $this->msg( 'opensearch-desc' )->inContentLanguage()->text(),
4389 ] );
4390
4391 $services = MediaWikiServices::getInstance();
4392
4393 # Real Simple Discovery link, provides auto-discovery information
4394 # for the MediaWiki API (and potentially additional custom API
4395 # support such as WordPress or Twitter-compatible APIs for a
4396 # blogging extension, etc)
4397 $tags['rsd'] = Html::element( 'link', [
4398 'rel' => 'EditURI',
4399 'type' => 'application/rsd+xml',
4400 // Output a protocol-relative URL here if $wgServer is protocol-relative.
4401 // Whether RSD accepts relative or protocol-relative URLs is completely
4402 // undocumented, though.
4403 'href' => (string)$services->getUrlUtils()->expand( wfAppendQuery(
4404 wfScript( 'api' ),
4405 [ 'action' => 'rsd' ] ),
4407 ),
4408 ] );
4409
4410 $tags = array_merge(
4411 $tags,
4412 $this->getHeadLinksCanonicalURLArray( $config ),
4413 $this->getHeadLinksAlternateURLsArray(),
4414 $this->getHeadLinksCopyrightArray( $config ),
4415 $this->getHeadLinksSyndicationArray( $config ),
4416 );
4417
4418 // Allow extensions to add, remove and/or otherwise manipulate these links
4419 // If you want only to *add* <head> links, please use the addHeadItem()
4420 // (or addHeadItems() for multiple items) method instead.
4421 // This hook is provided as a last resort for extensions to modify these
4422 // links before the output is sent to client.
4423 $this->getHookRunner()->onOutputPageAfterGetHeadLinksArray( $tags, $this );
4424
4425 return $tags;
4426 }
4427
4440
4447 private function getHeadLinksCanonicalURLArray( Config $config ) {
4448 $tags = [];
4449 $canonicalUrl = $this->mCanonicalUrl;
4450
4452 $query = [];
4453 $action = $this->getContext()->getActionName();
4454 $isCanonicalUrlAction = in_array( $action, [ 'history', 'info' ] );
4455 $services = MediaWikiServices::getInstance();
4456 $languageConverterFactory = $services->getLanguageConverterFactory();
4457 $isLangConversionDisabled = $languageConverterFactory->isConversionDisabled();
4458 $pageLang = $this->getTitle()->getPageLanguage();
4459 $pageLanguageConverter = $languageConverterFactory->getLanguageConverter( $pageLang );
4460 $urlVariant = $pageLanguageConverter->getURLVariant();
4461
4462 if ( $canonicalUrl !== false ) {
4463 $canonicalUrl = (string)$services->getUrlUtils()->expand( $canonicalUrl, PROTO_CANONICAL );
4464 } elseif ( $this->isArticleRelated() ) {
4465 if ( $isCanonicalUrlAction ) {
4466 $query['action'] = $action;
4467 } elseif ( !$isLangConversionDisabled && $urlVariant ) {
4468 # T54429, T108443: Making canonical URL language-variant-aware.
4469 $query['variant'] = $urlVariant;
4470 }
4471 $canonicalUrl = $this->getTitle()->getCanonicalURL( $query );
4472 } else {
4473 $reqUrl = $this->getRequest()->getRequestURL();
4474 $canonicalUrl = (string)$services->getUrlUtils()->expand( $reqUrl, PROTO_CANONICAL );
4475 }
4476 }
4477
4478 if ( $canonicalUrl !== false ) {
4479 $tags['link-canonical'] = Html::element( 'link', [
4480 'rel' => 'canonical',
4481 'href' => $canonicalUrl
4482 ] );
4483 }
4484
4485 return $tags;
4486 }
4487
4496 private function getHeadLinksAlternateURLsArray() {
4497 $tags = [];
4498 $languageUrls = [];
4499 $action = $this->getContext()->getActionName();
4500 $isCanonicalUrlAction = in_array( $action, [ 'history', 'info' ] );
4501 $services = MediaWikiServices::getInstance();
4502 $languageConverterFactory = $services->getLanguageConverterFactory();
4503 $isLangConversionDisabled = $languageConverterFactory->isConversionDisabled();
4504 $pageLang = $this->getTitle()->getPageLanguage();
4505 $pageLanguageConverter = $languageConverterFactory->getLanguageConverter( $pageLang );
4506
4507 # Language variants
4508 if (
4509 $this->isArticleRelated() &&
4510 !$isCanonicalUrlAction &&
4511 $pageLanguageConverter->hasVariants() &&
4512 !$isLangConversionDisabled
4513 ) {
4514 $variants = $pageLanguageConverter->getVariants();
4515 foreach ( $variants as $variant ) {
4516 $bcp47 = LanguageCode::bcp47( $variant );
4517 $languageUrls[$bcp47] = $this->getTitle()
4518 ->getFullURL( [ 'variant' => $variant ], false, PROTO_CURRENT );
4519 }
4520 }
4521
4522 # Alternate URLs for interlanguage links would be handled in HTML body tag instead of
4523 # head tag, see T326829.
4524
4525 if ( $languageUrls ) {
4526 # Force the alternate URL of page language code to be self.
4527 # T123901, T305540, T108443: Override mixed-variant variant link in language variant links.
4528 $currentUrl = $this->getTitle()->getFullURL( [], false, PROTO_CURRENT );
4529 $pageLangCodeBcp47 = LanguageCode::bcp47( $pageLang->getCode() );
4530 $languageUrls[$pageLangCodeBcp47] = $currentUrl;
4531
4532 ksort( $languageUrls );
4533
4534 # Also add x-default link per https://support.google.com/webmasters/answer/189077?hl=en
4535 $languageUrls['x-default'] = $currentUrl;
4536
4537 # Process all of language variants and interlanguage links
4538 foreach ( $languageUrls as $bcp47 => $languageUrl ) {
4539 $bcp47lowercase = strtolower( $bcp47 );
4540 $tags['link-alternate-language-' . $bcp47lowercase] = Html::element( 'link', [
4541 'rel' => 'alternate',
4542 'hreflang' => $bcp47,
4543 'href' => $languageUrl,
4544 ] );
4545 }
4546 }
4547
4548 return $tags;
4549 }
4550
4557 private function getHeadLinksCopyrightArray( Config $config ) {
4558 $tags = [];
4559
4560 if ( $this->copyrightUrl !== null ) {
4561 $copyright = $this->copyrightUrl;
4562 } else {
4563 $copyright = '';
4564 if ( $config->get( MainConfigNames::RightsPage ) ) {
4565 $copy = Title::newFromText( $config->get( MainConfigNames::RightsPage ) );
4566
4567 if ( $copy ) {
4568 $copyright = $copy->getLocalURL();
4569 }
4570 }
4571
4572 if ( !$copyright && $config->get( MainConfigNames::RightsUrl ) ) {
4573 $copyright = $config->get( MainConfigNames::RightsUrl );
4574 }
4575 }
4576
4577 if ( $copyright ) {
4578 $tags['copyright'] = Html::element( 'link', [
4579 'rel' => 'license',
4580 'href' => $copyright
4581 ] );
4582 }
4583
4584 return $tags;
4585 }
4586
4593 private function getHeadLinksSyndicationArray( Config $config ) {
4594 if ( !$config->get( MainConfigNames::Feed ) ) {
4595 return [];
4596 }
4597
4598 $tags = [];
4599 $feedLinks = [];
4600
4601 foreach ( $this->getSyndicationLinks() as $format => $link ) {
4602 # Use the page name for the title. In principle, this could
4603 # lead to issues with having the same name for different feeds
4604 # corresponding to the same page, but we can't avoid that at
4605 # this low a level.
4606
4607 $feedLinks[] = $this->feedLink(
4608 $format,
4609 $link,
4610 # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
4611 $this->msg(
4612 "page-{$format}-feed", $this->getTitle()->getPrefixedText()
4613 )->text()
4614 );
4615 }
4616
4617 # Recent changes feed should appear on every page (except recentchanges,
4618 # that would be redundant). Put it after the per-page feed to avoid
4619 # changing existing behavior. It's still available, probably via a
4620 # menu in your browser. Some sites might have a different feed they'd
4621 # like to promote instead of the RC feed (maybe like a "Recent New Articles"
4622 # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
4623 # If so, use it instead.
4624 $sitename = $config->get( MainConfigNames::Sitename );
4625 $overrideSiteFeed = $config->get( MainConfigNames::OverrideSiteFeed );
4626 if ( $overrideSiteFeed ) {
4627 foreach ( $overrideSiteFeed as $type => $feedUrl ) {
4628 // Note, this->feedLink escapes the url.
4629 $feedLinks[] = $this->feedLink(
4630 $type,
4631 $feedUrl,
4632 $this->msg( "site-{$type}-feed", $sitename )->text()
4633 );
4634 }
4635 } elseif ( !$this->getTitle()->isSpecial( 'Recentchanges' ) ) {
4636 $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
4637 foreach ( $this->getAdvertisedFeedTypes() as $format ) {
4638 $feedLinks[] = $this->feedLink(
4639 $format,
4640 $rctitle->getLocalURL( [ 'feed' => $format ] ),
4641 # For grep: 'site-rss-feed', 'site-atom-feed'
4642 $this->msg( "site-{$format}-feed", $sitename )->text()
4643 );
4644 }
4645 }
4646
4647 # Allow extensions to change the list pf feeds. This hook is primarily for changing,
4648 # manipulating or removing existing feed tags. If you want to add new feeds, you should
4649 # use OutputPage::addFeedLink() instead.
4650 $this->getHookRunner()->onAfterBuildFeedLinks( $feedLinks );
4651
4652 $tags += $feedLinks;
4653
4654 return $tags;
4655 }
4656
4665 private function feedLink( $type, $url, $text ) {
4666 return Html::element( 'link', [
4667 'rel' => 'alternate',
4668 'type' => "application/$type+xml",
4669 'title' => $text,
4670 'href' => $url ]
4671 );
4672 }
4673
4683 public function addStyle( $style, $media = '', $condition = '', $dir = '' ) {
4684 $options = [];
4685 if ( $media ) {
4686 $options['media'] = $media;
4687 }
4688 if ( $condition ) {
4689 $options['condition'] = $condition;
4690 }
4691 if ( $dir ) {
4692 $options['dir'] = $dir;
4693 }
4694 $this->styles[$style] = $options;
4695 }
4696
4705 public function addInlineStyle( $style_css, $flip = 'noflip' ) {
4706 if ( $flip === 'flip' && $this->getLanguage()->isRTL() ) {
4707 # If wanted, and the interface is right-to-left, flip the CSS
4708 $style_css = CSSJanus::transform( $style_css, true, false );
4709 }
4710 $this->mInlineStyles .= Html::inlineStyle( $style_css );
4711 }
4712
4718 protected function buildExemptModules() {
4719 $chunks = [];
4720
4721 // Requirements:
4722 // - Within modules provided by the software (core, skin, extensions),
4723 // styles from skin stylesheets should be overridden by styles
4724 // from modules dynamically loaded with JavaScript.
4725 // - Styles from site-specific, private, and user modules should override
4726 // both of the above.
4727 //
4728 // The effective order for stylesheets must thus be:
4729 // 1. Page style modules, formatted server-side by RL\ClientHtml.
4730 // 2. Dynamically-loaded styles, inserted client-side by mw.loader.
4731 // 3. Styles that are site-specific, private or from the user, formatted
4732 // server-side by this function.
4733 //
4734 // The 'ResourceLoaderDynamicStyles' marker helps JavaScript know where
4735 // point #2 is.
4736
4737 // Add legacy styles added through addStyle()/addInlineStyle() here
4738 $chunks[] = implode( '', $this->buildCssLinksArray() ) . $this->mInlineStyles;
4739
4740 // Things that go after the ResourceLoaderDynamicStyles marker
4741 $append = [];
4742 $separateReq = [ 'site.styles', 'user.styles' ];
4743 foreach ( $this->rlExemptStyleModules as $moduleNames ) {
4744 if ( $moduleNames ) {
4745 $append[] = $this->makeResourceLoaderLink(
4746 array_diff( $moduleNames, $separateReq ),
4747 RL\Module::TYPE_STYLES
4748 );
4749
4750 foreach ( array_intersect( $moduleNames, $separateReq ) as $name ) {
4751 // These require their own dedicated request in order to support "@import"
4752 // syntax, which is incompatible with concatenation. (T147667, T37562)
4753 $append[] = $this->makeResourceLoaderLink( $name,
4754 RL\Module::TYPE_STYLES
4755 );
4756 }
4757 }
4758 }
4759 if ( $append ) {
4760 $chunks[] = Html::element(
4761 'meta',
4762 [ 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ]
4763 );
4764 $chunks = array_merge( $chunks, $append );
4765 }
4766
4767 return self::combineWrappedStrings( $chunks );
4768 }
4769
4773 public function buildCssLinksArray() {
4774 $links = [];
4775
4776 foreach ( $this->styles as $file => $options ) {
4777 $link = $this->styleLink( $file, $options );
4778 if ( $link ) {
4779 $links[$file] = $link;
4780 }
4781 }
4782 return $links;
4783 }
4784
4792 protected function styleLink( $style, array $options ) {
4793 if ( isset( $options['dir'] ) && $this->getLanguage()->getDir() != $options['dir'] ) {
4794 return '';
4795 }
4796
4797 if ( isset( $options['media'] ) ) {
4798 $media = self::transformCssMedia( $options['media'], $this->getRequest() );
4799 if ( $media === null ) {
4800 return '';
4801 }
4802 } else {
4803 $media = 'all';
4804 }
4805
4806 if ( str_starts_with( $style, '/' ) ||
4807 str_starts_with( $style, 'http:' ) ||
4808 str_starts_with( $style, 'https:' )
4809 ) {
4810 $url = $style;
4811 } else {
4812 $config = $this->getConfig();
4813 // Append file hash as query parameter
4814 $url = self::transformResourcePath(
4815 $config,
4816 $config->get( MainConfigNames::StylePath ) . '/' . $style
4817 );
4818 }
4819
4820 $link = Html::linkedStyle( $url, $media );
4821
4822 if ( isset( $options['condition'] ) ) {
4823 $condition = htmlspecialchars( $options['condition'] );
4824 $link = "<!--[if $condition]>$link<![endif]-->";
4825 }
4826 return $link;
4827 }
4828
4850 public static function transformResourcePath( Config $config, $path ) {
4851 $localDir = MW_INSTALL_PATH;
4852 $remotePathPrefix = $config->get( MainConfigNames::ResourceBasePath );
4853 if ( $remotePathPrefix === '' ) {
4854 // The configured base path is required to be empty string for
4855 // wikis in the domain root
4856 $remotePath = '/';
4857 } else {
4858 $remotePath = $remotePathPrefix;
4859 }
4860 if ( !str_starts_with( $path, $remotePath ) || str_starts_with( $path, '//' ) ) {
4861 // - Path is outside wgResourceBasePath, ignore.
4862 // - Path is protocol-relative. Fixes T155310. Not supported by RelPath lib.
4863 return $path;
4864 }
4865 // For files in resources, extensions/ or skins/, ResourceBasePath is preferred here.
4866 // For other misc files in $IP, we'll fallback to that as well. There is, however, a fourth
4867 // supported dir/path pair in the configuration (wgUploadDirectory, wgUploadPath)
4868 // which is not expected to be in wgResourceBasePath on CDNs. (T155146)
4869 $uploadPath = $config->get( MainConfigNames::UploadPath );
4870 if ( str_starts_with( $path, $uploadPath ) ) {
4871 $localDir = $config->get( MainConfigNames::UploadDirectory );
4872 $remotePathPrefix = $remotePath = $uploadPath;
4873 }
4874
4875 $path = RelPath::getRelativePath( $path, $remotePath );
4876 return self::transformFilePath( $remotePathPrefix, $localDir, $path );
4877 }
4878
4890 public static function transformFilePath( $remotePathPrefix, $localPath, $file ) {
4891 // This MUST match the equivalent logic in CSSMin::remapOne()
4892 $localFile = "$localPath/$file";
4893 $url = "$remotePathPrefix/$file";
4894 if ( is_file( $localFile ) ) {
4895 $hash = md5_file( $localFile );
4896 if ( $hash === false ) {
4897 wfLogWarning( __METHOD__ . ": Failed to hash $localFile" );
4898 $hash = '';
4899 }
4900 $url .= '?' . substr( $hash, 0, 5 );
4901 }
4902 return $url;
4903 }
4904
4911 public static function transformCssMedia( $media, $request = null ) {
4912 wfDeprecated( __METHOD__, '1.47' );
4913 return $media;
4914 }
4915
4924 public function addWikiMsg( $name, ...$args ) {
4925 $this->addWikiMsgArray( $name, $args );
4926 }
4927
4937 public function addWikiMsgArray( $name, $args ) {
4938 $this->addHTML( $this->msg( $name, $args )->parseAsBlock() );
4939 }
4940
4967 public function wrapWikiMsg( $wrap, ...$msgSpecs ) {
4968 $s = $wrap;
4969 foreach ( $msgSpecs as $n => $spec ) {
4970 if ( is_array( $spec ) ) {
4971 $args = $spec;
4972 $name = array_shift( $args );
4973 } else {
4974 $args = [];
4975 $name = $spec;
4976 }
4977 $s = str_replace( '$' . ( $n + 1 ), $this->msg( $name, $args )->plain(), $s );
4978 }
4979
4980 $title = $this->getTitle();
4981 if ( $title === null ) {
4982 throw new RuntimeException( 'No title in ' . __METHOD__ );
4983 }
4984 $popts = $this->internalParserOptions( true );
4985 // We are *mostly* parsing a message. Other code wants to rely on that. (T395196)
4986 // It would be cleaner if the wrappers were added outside of wikitext parsing, so we could
4987 // really just parse the message, but it seems scary to change that now.
4988 $popts->setIsMessage( true );
4989 $this->addWikiTextTitleInternal( $s, $title, /*linestart*/ true, $popts );
4990 }
4991
4998 public function isTOCEnabled() {
4999 return $this->mEnableTOC;
5000 }
5001
5012 public function addTOCPlaceholder( TOCData $tocData, ?string $marker = null ): void {
5013 $pout = new ParserOutput;
5014 $pout->setTOCData( $tocData );
5015 $pout->setOutputFlag( ParserOutputFlags::SHOW_TOC );
5016 $pout->setContentHolderText( Parser::TOC_PLACEHOLDER );
5017 if ( $marker !== null ) {
5018 $text = $this->getParserOutputText( $pout, $this->internalParserOptions( false ), [] );
5019 $this->addParserOutputMetadata( $pout );
5020 $pos = strpos( $this->mBodytext, $marker );
5021 if ( $pos === false ) {
5022 $this->prependHTML( $text );
5023 } else {
5024 $this->mBodytext = substr_replace( $this->mBodytext, $text, $pos, strlen( $marker ) );
5025 }
5026 } else {
5027 $this->addParserOutput( $pout, $this->internalParserOptions( false ) );
5028 }
5029 }
5030
5038 public static function setupOOUI( $skinName = null, $dir = null ) {
5039 if ( !self::$oouiSetupDone ) {
5040 self::$oouiSetupDone = true;
5041 $context = RequestContext::getMain();
5042 $skinName = $context->getSkinName();
5043 $dir = $context->getLanguage()->getDir();
5044 $themes = RL\OOUIFileModule::getSkinThemeMap();
5045 $theme = $themes[$skinName] ?? $themes['default'];
5046 // For example, 'OOUI\WikimediaUITheme'.
5047 $themeClass = "OOUI\\{$theme}Theme";
5048 Theme::setSingleton( new $themeClass() );
5049 Element::setDefaultDir( $dir );
5050 }
5051 }
5052
5058 public static function resetOOUI() {
5059 if ( self::$oouiSetupDone ) {
5060 self::$oouiSetupDone = false;
5061 self::setupOOUI();
5062 }
5063 }
5064
5071 public function enableOOUI() {
5072 self::setupOOUI();
5073 $this->addModuleStyles( [
5074 'oojs-ui-core.styles',
5075 'oojs-ui.styles.indicators',
5076 'mediawiki.widgets.styles',
5077 'oojs-ui-core.icons',
5078 ] );
5079 }
5080
5087 public function getCSP() {
5088 return $this->CSP;
5089 }
5090
5104 public function setCspOutputMode( string $mode ): void {
5105 $this->cspOutputMode = $mode;
5106 }
5107
5117 public function tailElement( $skin ) {
5118 $tail = [
5119 MWDebug::getDebugHTML( $skin ),
5120 $this->getBottomScripts(),
5121 MWDebug::getHTMLDebugLog(),
5122 Html::closeElement( 'body' ),
5123 Html::closeElement( 'html' ),
5124 ];
5125
5126 return WrappedStringList::join( "\n", $tail );
5127 }
5128}
5129
5131class_alias( OutputPage::class, 'OutputPage' );
const PROTO_CANONICAL
Definition Defines.php:223
const PROTO_CURRENT
Definition Defines.php:222
const MW_VERSION
The running version of MediaWiki.
Definition Defines.php:23
const NS_MEDIAWIKI
Definition Defines.php:59
const NS_SPECIAL
Definition Defines.php:40
const PROTO_RELATIVE
Definition Defines.php:219
const NS_CATEGORY
Definition Defines.php:65
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.
wfHostname()
Get host name of the current machine, for use in error reporting.
wfSetVar(&$dest, $source, $force=false)
Sets dest to source and returns the original value of dest If source is NULL, it just returns the val...
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
wfTimestamp( $outputtype=TS::UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
wfScript( $script='index')
Get the URL path to a MediaWiki entry point.
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
wfResetOutputBuffers( $resetGzipEncoding=true)
Clear away any user-level output buffers, discarding contents.
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:72
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
getActionName()
Get the action name for the current web request.
getWikiPage()
Get the WikiPage object.
setContext(IContextSource $context)
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage().
getContext()
Get the base IContextSource object.
Implements some public methods and some protected utility functions which are required by multiple ch...
Definition File.php:80
exists()
Returns true if file exists in the repository.
Definition File.php:1069
Base class for language-specific code.
Definition Language.php:65
const OriginTrials
Name constant for the OriginTrials setting, for use with Config\get().
const SortedCategories
Name constant for the SortedCategories setting, for use with Config\get().
const UploadDirectory
Name constant for the UploadDirectory setting, for use with Config\get().
const DeviceBoundSessionsReportOnly
Name constant for the DeviceBoundSessionsReportOnly setting, for use with Config\get().
const UseCdn
Name constant for the UseCdn setting, for use with Config\get().
const StylePath
Name constant for the StylePath setting, for use with Config\get().
const CdnMaxAge
Name constant for the CdnMaxAge setting, for use with Config\get().
const UploadPath
Name constant for the UploadPath setting, for use with Config\get().
const UniversalEditButton
Name constant for the UniversalEditButton setting, for use with Config\get().
const CachePages
Name constant for the CachePages setting, for use with Config\get().
const ReportToExpiry
Name constant for the ReportToExpiry setting, for use with Config\get().
const DeviceBoundSessions
Name constant for the DeviceBoundSessions setting, for use with Config\get().
const Feed
Name constant for the Feed setting, for use with Config\get().
const ReferrerPolicy
Name constant for the ReferrerPolicy setting, for use with Config\get().
const ResourceBasePath
Name constant for the ResourceBasePath setting, for use with Config\get().
const CacheVaryCookies
Name constant for the CacheVaryCookies setting, for use with Config\get().
const VaryOnXFP
Name constant for the VaryOnXFP setting, for use with Config\get().
const MimeType
Name constant for the MimeType setting, for use with Config\get().
const Favicon
Name constant for the Favicon setting, for use with Config\get().
const CacheEpoch
Name constant for the CacheEpoch setting, for use with Config\get().
const EditPageFrameOptions
Name constant for the EditPageFrameOptions setting, for use with Config\get().
const AllowSiteCSSOnRestrictedPages
Name constant for the AllowSiteCSSOnRestrictedPages setting, for use with Config\get().
const DatabaseReplicaLagCritical
Name constant for the DatabaseReplicaLagCritical setting, for use with Config\get().
const DebugRedirects
Name constant for the DebugRedirects setting, for use with Config\get().
const ResourceLoaderDebug
Name constant for the ResourceLoaderDebug setting, for use with Config\get().
const ThumbLimits
Name constant for the ThumbLimits setting, for use with Config\get().
const AppleTouchIcon
Name constant for the AppleTouchIcon setting, for use with Config\get().
const CookiePrefix
Name constant for the CookiePrefix setting, for use with Config\get().
const ImagePreconnect
Name constant for the ImagePreconnect setting, for use with Config\get().
const ReportToEndpoints
Name constant for the ReportToEndpoints setting, for use with Config\get().
const EnableCanonicalServerLink
Name constant for the EnableCanonicalServerLink setting, for use with Config\get().
const BrowserFormatDetection
Name constant for the BrowserFormatDetection setting, for use with Config\get().
const DatabaseReplicaLagWarning
Name constant for the DatabaseReplicaLagWarning setting, for use with Config\get().
const BreakFrames
Name constant for the BreakFrames setting, for use with Config\get().
const ShowHostnames
Name constant for the ShowHostnames setting, for use with Config\get().
const AdvertisedFeedTypes
Name constant for the AdvertisedFeedTypes setting, for use with Config\get().
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition Message.php:144
This is one of the Core classes and should be read at least once by any new developers.
getResourceLoader()
Get a ResourceLoader object associated with this OutputPage.
parseAsContent( $text, $linestart=true)
Parse wikitext in the page content language and return the HTML.
getCSP()
Get the ContentSecurityPolicy object.
getCacheVaryCookies()
Get the list of cookie names that will influence the cache.
showLagWarning( $lag)
Show a warning about replica DB lag.
addVaryHeader( $header)
Add an HTTP header that will have an influence on the cache.
getOutputFlag(ParserOutputFlags|string $name)
getUnprefixedDisplayTitle()
Returns page display title without the namespace prefix if possible.
addParserOutputContent(ParserOutput $parserOutput, ParserOptions $parserOptions, ?array $poOptions=null,)
Add the HTML and enhancements for it (like ResourceLoader modules) associated with a ParserOutput obj...
setDisplayTitle( $html)
Same as page title but only contains the name of the page, not any other text.
addWikiMsg( $name,... $args)
Add a wikitext-formatted message to the output.
disableClientCache()
Force the page to send nocache headers.
getIndicators()
Get the indicators associated with this page.
setSubtitle( $str)
Replace the subtitle with $str.
string $mInlineStyles
Inline CSS styles.
setCopyrightUrl( $url)
Set the copyright URL to send with the output.
addJsConfigVars( $keys, $value=null)
Add one or more variables to be set in mw.config in JavaScript.
setCspOutputMode(string $mode)
Sets the output mechanism for content security policies (HTTP headers or meta tags).
tailElement( $skin)
The final bits that go to the bottom of a page HTML document including the closing tags.
showErrorPage( $title, $msg, $params=[], $returnto=null, $returntoquery=null)
Output a standard error page.
getMetaTags()
Returns the current <meta> tags.
wrapWikiMsg( $wrap,... $msgSpecs)
This function takes a number of message/argument specifications, wraps them in some overall structure...
setIndexPolicy( $policy)
Set the index policy for the page, but leave the follow policy un- touched.
static resetOOUI()
Notify of a change in global skin or language which would necessitate reinitialization of OOUI global...
getLinkHeader()
Return a Link: header.
addHeadItems( $values)
Add one or more head items to the output.
static setupOOUI( $skinName=null, $dir=null)
Helper function to setup the PHP implementation of OOUI to use in this request.
getProperty( $name)
Get an additional output property.
addPostProcessedParserOutput(ParserOutput $parserOutput)
bool $mDoNothing
Whether output is disabled.
setPreventClickjacking(bool $enable)
Set the prevent-clickjacking flag.
addStyle( $style, $media='', $condition='', $dir='')
Add a local or specified stylesheet, with the given media options.
hasHeadItem( $name)
Check if the header item $name is already set.
getJSVars(?int $flag=null)
Get an array containing the variables to be set in mw.config in JavaScript.
formatPermissionStatus(PermissionStatus $status, ?string $action=null)
Format permission $status obtained from Authority for display.
getLinkTags()
Returns the current <link> tags.
getLanguageLinks()
Get the list of language links.
disable()
Disable output completely, i.e.
showsCopyright()
Return whether the standard copyright should be shown for the current page.
getRlClient()
Call this to freeze the module queue and JS config and create a formatter.
filterModules(array $modules, $position=null, $type=RL\Module::TYPE_COMBINED)
Filter an array of modules to remove members not considered to be trustworthy, and modules which are ...
disallowUserJs()
Do not allow scripts which can be modified by wiki users to load on this page; only allow scripts bun...
makeResourceLoaderLink( $modules, $only, array $extraQuery=[])
Explicitly load or embed modules on a page.
setSyndicated( $show=true)
Add or remove feed links in the page header This is mainly kept for backward compatibility,...
getRevisionTimestamp()
Get the timestamp of displayed revision.
setRedirectedFrom(PageReference $t)
Set $mRedirectedFrom, the page which redirected us to the current page.
getHTMLTitle()
Return the "HTML title", i.e.
getFeedAppendQuery()
Will currently always return null.
adaptCdnTTL( $mtime, $minTTL=0, $maxTTL=0)
Get TTL in [$minTTL,$maxTTL] and pass it to lowerCdnMaxage().
getModuleStyles( $filter=false)
Get the list of style-only modules to load on this page.
addBodyClasses( $classes)
Add a class to the <body> element.
lowerCdnMaxage( $maxage)
Set the value of the "s-maxage" part of the "Cache-control" HTTP header to $maxage if that is lower t...
addParserOutputText(string $text, $poOptions=[])
Add the HTML associated with a ParserOutput object, without any metadata.
setTitle(PageReference $t)
Set the Title object to use.
setContentLangForJS(Bcp47Code $lang)
setCdnMaxage( $maxage)
Set the value of the "s-maxage" part of the "Cache-control" HTTP header.
getAllowedModules( $type)
Show what level of JavaScript / CSS untrustworthiness is allowed on this page.
string $mBodytext
Contains all of the "<body>" content.
headElement(Skin $sk, $includeStyle=true)
setIndicators(array $indicators)
Add an array of indicators, with their identifiers as array keys and HTML contents as values.
setFeedAppendQuery( $val)
Add default feeds to the page header This is mainly kept for backward compatibility,...
isArticle()
Return whether the content displayed page is related to the source of the corresponding article on th...
addLanguageLinks(array $newLinkArray)
Add new language links.
setLastModified( $timestamp)
Override the last modified timestamp.
getFrameOptions()
Get the X-Frame-Options header value (without the name part), or false if there isn't one.
getJsConfigVars()
Get the javascript config vars to include on this page.
isDisabled()
Return whether the output will be completely disabled.
addTemplate(&$template)
Add the output of a QuickTemplate to the output buffer.
setRevisionIsCurrent(bool $isCurrent)
Set whether the revision displayed (as set in setRevisionId()) is the latest revision of the page.
getCategories( $type='all')
Get the list of category names this page belongs to.
addWikiTextAsContent( $text, $linestart=true, ?PageReference $title=null)
Convert wikitext in the page content language to HTML and add it to the buffer.
addParserOutput(ParserOutput $parserOutput, ParserOptions $parserOptions, ?array $poOptions=null,)
Add everything from a ParserOutput object.
getBottomScripts()
JS stuff to put at the bottom of the <body>.
setRobotsOptions(array $options=[])
Set the robots policy with options for the page.
const CSP_META
Output CSP policies as meta tags.
getArticleBodyOnly()
Return whether the output will contain only the body of the article.
versionRequired( $version)
Display an error page indicating that a given version of MediaWiki is required to use it.
setFollowPolicy( $policy)
Set the follow policy for the page, but leave the index policy un- touched.
ResourceLoader $mResourceLoader
addParserOutputMetadata(ParserOutput $parserOutput)
Add all metadata associated with a ParserOutput object, but without the actual HTML.
getSyndicationLinks()
Return URLs for each supported syndication format for this page.
addContentOverrideCallback(callable $callback)
Add a callback for mapping from a Title to a Content object, for things like page preview.
array $mAdditionalHtmlClasses
Additional <html> classes; This should be rarely modified; prefer mAdditionalBodyClasses.
isSyndicated()
Should we output feed links for this page?
buildExemptModules()
Build exempt modules and legacy non-ResourceLoader styles.
string $mLastModified
Used for sending cache control.
clearHTML()
Clear the body HTML.
setPageTitle( $name)
"Page title" means the contents of <h1>.
setCopyright( $hasCopyright)
Set whether the standard copyright should be shown for the current page.
static transformCssMedia( $media, $request=null)
getRedirect()
Get the URL to redirect to, or an empty string if not redirect URL set.
setPageTitleMsg(Message $msg)
"Page title" means the contents of <h1>.
userCanPreview()
To make it harder for someone to slip a user a fake JavaScript or CSS preview, a random token is asso...
addFeedLink( $format, $href)
Add a feed link to the page header.
addModules( $modules)
Load one or more ResourceLoader modules on this page.
static transformResourcePath(Config $config, $path)
Transform path to web-accessible static resource.
getBodyAttributes(Skin $sk)
Return an array of attributes for the body tag.
getCanonicalUrl()
Returns the URL to be used for the <link rel=canonical>> if one is set.
static combineWrappedStrings(array $chunks)
Combine WrappedString chunks and filter out empty ones.
isTOCEnabled()
Whether the output has a table of contents when the ToC is rendered inline.
redirect( $url, $responsecode='302')
Redirect to $url rather than displaying the normal page.
setProperty( $name, $value)
Set an additional output property.
addTOCPlaceholder(TOCData $tocData, ?string $marker=null)
Helper function to add a Table of Contents to the output.
setHTMLTitle( $name)
"HTML title" means the contents of "<title>".
haveCacheVaryCookies()
Check if the request has a cache-varying cookie header If it does, it's very important that we don't ...
loadSkinModules( $sk)
Transfer styles and JavaScript modules from skin.
addHtmlClasses( $classes)
Add a user-specific class to the <html> element.
returnToMain( $unused=null, $returnto=null, $returntoquery=null)
Add a "return to" link pointing to a specified title, or the title indicated in the request,...
getModules( $filter=false)
Get the list of modules to include on this page.
__construct(IContextSource $context)
Constructor for OutputPage.
enableOOUI()
Add ResourceLoader module styles for OOUI and set up the PHP implementation of it for use with MediaW...
getVaryHeader()
Return a Vary: header on which to vary caches.
addElement( $element, array $attribs=[], $contents='')
Shortcut for adding an Html\element via addHTML.
array $mAdditionalBodyClasses
Additional <body> classes; there are also <body> classes from other sources.
array $styles
An array of stylesheet filenames (relative from skins path), with options for CSS media,...
getHTML()
Get the body HTML.
parseAsInterface( $text, $linestart=true)
Parse wikitext in the user interface language and return the HTML.
int $mCdnMaxageLimit
Upper limit on mCdnMaxage.
couldBePublicCached()
Whether the output might become publicly cached.
output( $return=false)
Finally, all the text has been munged and accumulated into the object, let's actually output it:
addBacklinkSubtitle(PageReference $title, $query=[])
Add a subtitle containing a backlink to a page.
setArticleRelated( $newVal)
Set whether this page is related an article on the wiki Setting false will cause the change of "artic...
prependHTML( $text)
Prepend $text to the body HTML.
showPermissionStatus(PermissionStatus $status, $action=null)
Output a standard permission error page.
enableClientCache()
Do not send nocache headers.
const CSP_HEADERS
Output CSP policies as headers.
addCategoryLinksToLBAndGetResult(array $categories)
reduceAllowedModules( $type, $level)
Limit the highest level of CSS/JS untrustworthiness allowed.
prepareErrorPage()
Prepare this object to display an error page; disable caching and indexing, clear the current text an...
considerCacheSettingsFinal()
Set the expectation that cache control will not change after this point.
parseInlineAsInterface( $text, $linestart=true)
Parse wikitext in the user interface language, strip paragraph wrapper, and return the HTML.
addScriptFile( $file, $unused=null)
Add a JavaScript file to be loaded as <script> on this page.
getDisplayTitleParts()
Returns the page display title, split into its localized namespace, separator, and main title parts,...
setRobotPolicy( $policy)
Set the robot policy for the page: http://www.robotstxt.org/meta.html.
array $mAllowedModules
What level of 'untrustworthiness' is allowed in CSS/JS modules loaded on this page?
setCanonicalUrl( $url)
Set the URL to be used for the <link rel=canonical>>.
showPendingTakeover( $fallbackUrl, $msg,... $params)
Output a standard "wait for takeover" warning.
addLinkHeader( $header)
Add an HTTP Link: header.
addMeta( $name, $val)
Add a new "<meta>" tag To add an http-equiv meta tag, precede the name with "http:".
getPageTitle()
Return the "page title", i.e.
addHTML( $text)
Append $text to the body HTML.
string[][] $mMetatags
Should be private.
getDisplayTitle()
Returns page display title.
getRevisionId()
Get the displayed revision ID.
getRobotPolicy()
Get the current robot policy for the page as a string in the form <index policy>,<follow policy>.
addWikiTextAsInterface( $text, $linestart=true, ?PageReference $title=null)
Convert wikitext in the user interface language to HTML and add it to the buffer.
addInlineStyle( $style_css, $flip='noflip')
Adds inline CSS styles Internal use only.
addLink(array $linkarr)
Add a new <link> tag to the page header.
styleLink( $style, array $options)
Generate <link> tags for stylesheets.
getFollowPolicy()
Get the current follow policy for the page as a string.
static buildBacklinkSubtitle(PageReference $page, $query=[])
Build message object for a subtitle containing a backlink to a page.
getIndexPolicy()
Get the current index policy for the page as a string.
getFileSearchOptions()
Get the files used on this page.
addContentOverride( $target, Content $content)
Force the given Content object for the given page, for things like page preview.
isArticleRelated()
Return whether this page is related an article on the wiki.
setRevisionId( $revid)
Set the revision ID which will be seen by the wiki text parser for things such as embedded {{REVISION...
clearSubtitle()
Clear the subtitles.
addSubtitle( $str)
Add $str to the subtitle.
isRevisionCurrent()
Whether the revision displayed is the latest revision of the page.
sendCacheControl()
Send cache control HTTP headers.
static transformFilePath( $remotePathPrefix, $localPath, $file)
Utility method for transformResourceFilePath().
addCategoryLinks(array $categories)
Add an array of categories, with names in the keys.
getCategoryLinks()
Get the list of category links, in a 2-D array with the following format: $arr[$type][] = $link,...
getTemplateIds()
Get the templates used on this page.
getFileVersion()
Get the displayed file version.
addModuleStyles( $modules)
Load the styles of one or more style-only ResourceLoader modules on this page.
getPreventClickjacking()
Get the prevent-clickjacking flag.
addScript( $script)
Add raw HTML to the list of scripts (including <script> tag, etc.) Internal use only.
setStatusCode( $statusCode)
Set the HTTP status code to send with the output.
setTOCData(TOCData $tocData)
Adds Table of Contents data to OutputPage from ParserOutput.
addHelpLink( $to, $overrideBaseUrl=false)
Adds a help link with an icon via page indicators.
int $mCdnMaxage
Cache stuff.
getAdvertisedFeedTypes()
Return effective list of advertised feed types.
getMetadata()
Return a ParserOutput that can be used to set metadata properties for the current page.
setArticleBodyOnly( $only)
Set whether the output should only contain the body of the article, without any skin,...
addHeadItem( $name, $value)
Add or replace a head item to the output.
setDisplayTitleParts(string|HtmlArmor $nsText, string|HtmlArmor $nsSeparator, string|HtmlArmor $mainText, string|HtmlArmor|null $combinedText=null)
Set the page display title, and the page title, from the separate localized namespace,...
addReturnTo( $title, array $query=[], $text=null, $options=[])
Add a "return to" link pointing to a specified title.
addWikiMsgArray( $name, $args)
Add a wikitext-formatted message to the output.
addInlineScript( $script)
Add a self-contained script tag with the given contents Internal use only.
setFileVersion( $file)
Set the displayed file version.
checkLastModified( $timestamp)
checkLastModified tells the client to use the client-cached page if possible.
setArticleFlag( $newVal)
Set whether the displayed content is related to the source of the corresponding article on the wiki S...
Set options of the Parser.
setIsMessage( $x)
Set whether we are parsing a message.
ParserOutput is a rendering of a Content object or a message.
getExtraCSPDefaultSrcs()
Get extra Content-Security-Policy 'default-src' directives.
getJsConfigVars(bool $showStrategyKeys=false)
getContentHolderText()
Returns the body fragment text of the ParserOutput.
getOutputFlag(ParserOutputFlags|string $flag)
Provides a uniform interface to various boolean flags stored in the ParserOutput.
getExtraCSPStyleSrcs()
Get extra Content-Security-Policy 'style-src' directives.
getWrapperDivClass()
Returns the class (or classes) to be used with the wrapper div for this output.
getLinkList(string|ParserOutputLinkTypes $linkType, ?int $onlyNamespace=null)
Get a list of links of the given type.
hasImages()
Return true if there are image dependencies registered for this ParserOutput.
getExtraCSPScriptSrcs()
Get extra Content-Security-Policy 'script-src' directives.
collectMetadata(ContentMetadataCollector $metadata)
Adds the metadata collected in this ParserOutput to the supplied ContentMetadataCollector.
HTML sanitizer for MediaWiki.
Definition Sanitizer.php:34
A StatusValue for permission errors.
Handle sending Content-Security-Policy headers.
ResourceLoader is a loading system for JavaScript and CSS resources.
The base class for all skins.
Definition Skin.php:54
getRelevantTitle()
Return the "relevant" title.
Definition Skin.php:621
getDefaultModules()
Defines the ResourceLoader modules that should be added to the skin It is recommended that skins wish...
Definition Skin.php:441
getPageClasses( $title)
TODO: document.
Definition Skin.php:709
outputPageFinal(OutputPage $out)
Outputs the HTML for the page.
Definition Skin.php:680
getOptions()
Get current skin's options.
Definition Skin.php:2461
getHtmlElementAttributes()
Return values for <html> element.
Definition Skin.php:751
isResponsive()
Indicates if this skin is responsive.
Definition Skin.php:372
getRelevantUser()
Return the "relevant" user.
Definition Skin.php:642
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Represents a title within MediaWiki.
Definition Title.php:69
getMessages(?string $type=null)
Returns a list of error messages, optionally only those of the given type.
isGood()
Returns whether the operation completed and didn't have any error or warnings.
Marks HTML that shouldn't be escaped.
Definition HtmlArmor.php:18
return[ 'config-schema-inverse'=>['default'=>['ConfigRegistry'=>['main'=> 'MediaWiki\\Config\\GlobalVarConfig::newInstance',], 'Sitename'=> 'MediaWiki', 'Server'=> false, 'CanonicalServer'=> false, 'ServerName'=> false, 'AssumeProxiesUseDefaultProtocolPorts'=> true, 'HttpsPort'=> 443, 'ForceHTTPS'=> false, 'ScriptPath'=> '/wiki', 'UsePathInfo'=> null, 'Script'=> false, 'LoadScript'=> false, 'RestPath'=> false, 'StylePath'=> false, 'LocalStylePath'=> false, 'ExtensionAssetsPath'=> false, 'ExtensionDirectory'=> null, 'StyleDirectory'=> null, 'ArticlePath'=> false, 'UploadPath'=> false, 'ImgAuthPath'=> false, 'ThumbPath'=> false, 'UploadDirectory'=> false, 'FileCacheDirectory'=> false, 'Logo'=> false, 'Logos'=> false, 'Favicon'=> '/favicon.ico', 'AppleTouchIcon'=> false, 'ReferrerPolicy'=> false, 'TmpDirectory'=> false, 'UploadBaseUrl'=> '', 'UploadStashScalerBaseUrl'=> false, 'ActionPaths'=>[], 'MainPageIsDomainRoot'=> false, 'EnableUploads'=> false, 'UploadStashMaxAge'=> 21600, 'EnableAsyncUploads'=> false, 'EnableAsyncUploadsByURL'=> false, 'EnableChunkedUploads'=> false, 'UploadMaintenance'=> false, 'IllegalFileChars'=> ':\\/\\\\', 'DeletedDirectory'=> false, 'ImgAuthDetails'=> false, 'ImgAuthUrlPathMap'=>[], 'LocalFileRepo'=>['class'=> 'MediaWiki\\FileRepo\\LocalRepo', 'name'=> 'local', 'directory'=> null, 'scriptDirUrl'=> null, 'favicon'=> null, 'url'=> null, 'hashLevels'=> null, 'thumbScriptUrl'=> null, 'transformVia404'=> null, 'deletedDir'=> null, 'deletedHashLevels'=> null, 'updateCompatibleMetadata'=> null, 'reserializeMetadata'=> null,], 'ForeignFileRepos'=>[], 'UseInstantCommons'=> false, 'UseSharedUploads'=> false, 'SharedUploadDirectory'=> null, 'SharedUploadPath'=> null, 'HashedSharedUploadDirectory'=> true, 'RepositoryBaseUrl'=> 'https:'FetchCommonsDescriptions'=> false, 'SharedUploadDBname'=> false, 'SharedUploadDBprefix'=> '', 'SharedUploadDBschema'=> null, 'CacheSharedUploads'=> true, 'ForeignUploadTargets'=>['local',], 'UploadDialog'=>['fields'=>['description'=> true, 'date'=> false, 'categories'=> false,], 'licensemessages'=>['local'=> 'generic-local', 'foreign'=> 'generic-foreign',], 'comment'=>['local'=> '', 'foreign'=> '',], 'format'=>['filepage'=> ' $DESCRIPTION', 'description'=> ' $TEXT', 'ownwork'=> '', 'license'=> '', 'uncategorized'=> '',],], 'FileBackends'=>[], 'LockManagers'=>[], 'DefaultLockManager'=> null, 'ShowEXIF'=> null, 'UpdateCompatibleMetadata'=> false, 'AllowCopyUploads'=> false, 'CopyUploadsDomains'=>[], 'CopyUploadsFromSpecialUpload'=> false, 'CopyUploadProxy'=> false, 'CopyUploadTimeout'=> false, 'CopyUploadAllowOnWikiDomainConfig'=> false, 'MaxUploadSize'=> 104857600, 'MinUploadChunkSize'=> 1024, 'UploadNavigationUrl'=> false, 'UploadMissingFileUrl'=> false, 'ThumbnailScriptPath'=> false, 'SharedThumbnailScriptPath'=> false, 'HashedUploadDirectory'=> true, 'CSPUploadEntryPoint'=> true, 'FileExtensions'=>['png', 'gif', 'jpg', 'jpeg', 'webp',], 'ProhibitedFileExtensions'=>['html', 'htm', 'js', 'jsb', 'mhtml', 'mht', 'xhtml', 'xht', 'php', 'phtml', 'php3', 'php4', 'php5', 'phps', 'phar', 'shtml', 'jhtml', 'pl', 'py', 'cgi', 'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl', 'xml',], 'MimeTypeExclusions'=>['text/html', 'application/javascript', 'text/javascript', 'text/x-javascript', 'application/x-shellscript', 'application/x-php', 'text/x-php', 'text/x-python', 'text/x-perl', 'text/x-bash', 'text/x-sh', 'text/x-csh', 'text/scriptlet', 'application/x-msdownload', 'application/x-msmetafile', 'application/java', 'application/xml', 'text/xml',], 'CheckFileExtensions'=> true, 'StrictFileExtensions'=> true, 'DisableUploadScriptChecks'=> false, 'UploadSizeWarning'=> false, 'TrustedMediaFormats'=>['BITMAP', 'AUDIO', 'VIDEO', 'image/svg+xml', 'application/pdf',], 'MediaHandlers'=>[], 'NativeImageLazyLoading'=> true, 'ParserTestMediaHandlers'=>['image/jpeg'=> 'MockBitmapHandler', 'image/png'=> 'MockBitmapHandler', 'image/gif'=> 'MockBitmapHandler', 'image/tiff'=> 'MockBitmapHandler', 'image/webp'=> 'MockBitmapHandler', 'image/x-ms-bmp'=> 'MockBitmapHandler', 'image/x-bmp'=> 'MockBitmapHandler', 'image/x-xcf'=> 'MockBitmapHandler', 'image/svg+xml'=> 'MockSvgHandler', 'image/vnd.djvu'=> 'MockDjVuHandler',], 'UseImageResize'=> true, 'UseImageMagick'=> false, 'ImageMagickConvertCommand'=> '/usr/bin/convert', 'MaxInterlacingAreas'=>[], 'SharpenParameter'=> '0x0.4', 'SharpenReductionThreshold'=> 0.85, 'ImageMagickTempDir'=> false, 'CustomConvertCommand'=> false, 'JpegTran'=> '/usr/bin/jpegtran', 'JpegPixelFormat'=> 'yuv420', 'JpegQuality'=> 80, 'Exiv2Command'=> '/usr/bin/exiv2', 'Exiftool'=> '/usr/bin/exiftool', 'SVGConverters'=>['ImageMagick'=> ' $path/convert -background "#ffffff00" -thumbnail $widthx$height\\! $input PNG:$output', 'inkscape'=> ' $path/inkscape -w $width -o $output $input', 'batik'=> 'java -Djava.awt.headless=true -jar $path/batik-rasterizer.jar -w $width -d $output $input', 'rsvg'=> ' $path/rsvg-convert -w $width -h $height -l $lang -o $output $input', 'ImagickExt'=>['SvgHandler::rasterizeImagickExt',],], 'SVGConverter'=> 'ImageMagick', 'SVGConverterPath'=> '', 'SVGMaxSize'=> 5120, 'SVGMetadataCutoff'=> 5242880, 'SVGNativeRendering'=> true, 'SVGNativeRenderingSizeLimit'=> 51200, 'MediaInTargetLanguage'=> true, 'MaxImageArea'=> 12500000, 'MaxAnimatedGifArea'=> 12500000, 'MaxAnimatedWebPArea'=> 12500000, 'TiffThumbnailType'=>[], 'ThumbnailEpoch'=> '20030516000000', 'AttemptFailureEpoch'=> 1, 'IgnoreImageErrors'=> false, 'GenerateThumbnailOnParse'=> true, 'ShowArchiveThumbnails'=> true, 'EnableAutoRotation'=> null, 'Antivirus'=> null, 'AntivirusSetup'=>['clamav'=>['command'=> 'clamscan --no-summary ', 'codemap'=>[0=> 0, 1=> 1, 52=> -1, ' *'=> false,], 'messagepattern'=> '/.*?:(.*)/sim',],], 'AntivirusRequired'=> true, 'VerifyMimeType'=> true, 'MimeTypeFile'=> 'internal', 'MimeInfoFile'=> 'internal', 'MimeDetectorCommand'=> null, 'TrivialMimeDetection'=> false, 'XMLMimeTypes'=>['http:'svg'=> 'image/svg+xml', 'http:'http:'html'=> 'text/html',], 'ImageLimits'=>[[320, 240,], [640, 480,], [800, 600,], [1024, 768,], [1280, 1024,], [2560, 2048,],], 'ThumbLimits'=>[120, 150, 180, 200, 220, 250, 300, 400,], 'ThumbnailNamespaces'=>[6,], 'ThumbnailSteps'=> null, 'ThumbnailBuckets'=> null, 'ThumbnailMinimumBucketDistance'=> 50, 'UploadThumbnailRenderMap'=>[], 'UploadThumbnailRenderMethod'=> 'jobqueue', 'UploadThumbnailRenderHttpCustomHost'=> false, 'UploadThumbnailRenderHttpCustomDomain'=> false, 'UseTinyRGBForJPGThumbnails'=> false, 'GalleryOptions'=>[], 'ThumbUpright'=> 0.75, 'DirectoryMode'=> 511, 'ResponsiveImages'=> true, 'ImagePreconnect'=> false, 'TrackMediaRequestProvenance'=> false, 'DjvuUseBoxedCommand'=> false, 'DjvuDump'=> null, 'DjvuRenderer'=> null, 'DjvuTxt'=> null, 'DjvuPostProcessor'=> 'pnmtojpeg', 'DjvuOutputExtension'=> 'jpg', 'EmergencyContact'=> false, 'PasswordSender'=> false, 'NoReplyAddress'=> false, 'EnableEmail'=> true, 'EnableUserEmail'=> true, 'UserEmailUseReplyTo'=> true, 'PasswordReminderResendTime'=> 24, 'NewPasswordExpiry'=> 604800, 'UserEmailConfirmationTokenExpiry'=> 604800, 'PasswordExpirationDays'=> false, 'PasswordExpireGrace'=> 604800, 'SMTP'=> false, 'AdditionalMailParams'=> null, 'AllowHTMLEmail'=> false, 'EnotifFromEditor'=> false, 'EmailAuthentication'=> true, 'EmailConfirmationBanner'=> false, 'EnotifWatchlist'=> false, 'EnotifUserTalk'=> false, 'EnotifRevealEditorAddress'=> false, 'EnotifMinorEdits'=> true, 'EnotifUseRealName'=> false, 'UsersNotifiedOnAllChanges'=>[], 'DBname'=> 'my_wiki', 'DBmwschema'=> null, 'DBprefix'=> '', 'DBserver'=> 'localhost', 'DBport'=> 5432, 'DBuser'=> 'wikiuser', 'DBpassword'=> '', 'DBtype'=> 'mysql', 'DBssl'=> false, 'DBcompress'=> false, 'DBStrictWarnings'=> false, 'DBadminuser'=> null, 'DBadminpassword'=> null, 'SearchType'=> null, 'SearchTypeAlternatives'=> null, 'DBTableOptions'=> 'ENGINE=InnoDB, DEFAULT CHARSET=binary', 'SQLMode'=> '', 'SQLiteDataDir'=> '', 'SharedDB'=> null, 'SharedPrefix'=> false, 'SharedTables'=>['user', 'user_properties', 'user_autocreate_serial',], 'SharedSchema'=> false, 'DBservers'=> false, 'LBFactoryConf'=>['class'=> 'Wikimedia\\Rdbms\\LBFactorySimple',], 'DataCenterUpdateStickTTL'=> 10, 'DBerrorLog'=> false, 'DBerrorLogTZ'=> false, 'LocalDatabases'=>[], 'DatabaseReplicaLagWarning'=> 10, 'DatabaseReplicaLagCritical'=> 30, 'MaxExecutionTimeForExpensiveQueries'=> 0, 'VirtualDomainsMapping'=>[], 'RemoteVirtualDomainsMapping'=>[], 'FileSchemaMigrationStage'=> 3, 'ExternalLinksDomainGaps'=>[], 'ContentHandlers'=>['wikitext'=>['class'=> 'MediaWiki\\Content\\WikitextContentHandler', 'services'=>['TitleFactory', 'ParserFactory', 'GlobalIdGenerator', 'LanguageNameUtils', 'LinkRenderer', 'MagicWordFactory', 'ParsoidParserFactory',],], 'javascript'=>['class'=> 'MediaWiki\\Content\\JavaScriptContentHandler', 'services'=>['MainConfig', 'ParserFactory', 'UserOptionsLookup', 'CodeHighlighter',],], 'json'=>['class'=> 'MediaWiki\\Content\\JsonContentHandler', 'services'=>['ParsoidParserFactory', 'TitleFactory',],], 'css'=>['class'=> 'MediaWiki\\Content\\CssContentHandler', 'services'=>['MainConfig', 'ParserFactory', 'UserOptionsLookup', 'CodeHighlighter',],], 'vue'=>['class'=> 'MediaWiki\\Content\\VueContentHandler', 'services'=>['MainConfig', 'ParserFactory', 'CodeHighlighter',],], 'text'=> 'MediaWiki\\Content\\TextContentHandler', 'unknown'=> 'MediaWiki\\Content\\FallbackContentHandler',], 'NamespaceContentModels'=>[], 'TextModelsToParse'=>['wikitext', 'javascript', 'css',], 'CompressRevisions'=> false, 'ExternalStores'=>[], 'ExternalServers'=>[], 'DefaultExternalStore'=> false, 'RevisionCacheExpiry'=> 604800, 'PageLanguageUseDB'=> false, 'DiffEngine'=> null, 'ExternalDiffEngine'=> false, 'Wikidiff2Options'=>[], 'RequestTimeLimit'=> null, 'TransactionalTimeLimit'=> 120, 'CriticalSectionTimeLimit'=> 180.0, 'MiserMode'=> false, 'DisableQueryPages'=> false, 'QueryCacheLimit'=> 1000, 'WantedPagesThreshold'=> 1, 'AllowSlowParserFunctions'=> false, 'AllowSchemaUpdates'=> true, 'MaxArticleSize'=> 2048, 'MemoryLimit'=> '50M', 'PoolCounterConf'=> null, 'PoolCountClientConf'=>['servers'=>['127.0.0.1',], 'timeout'=> 0.1,], 'MaxUserDBWriteDuration'=> false, 'MaxJobDBWriteDuration'=> false, 'LinkHolderBatchSize'=> 1000, 'MaximumMovedPages'=> 100, 'ForceDeferredUpdatesPreSend'=> false, 'MultiShardSiteStats'=> false, 'CacheDirectory'=> false, 'MainCacheType'=> 0, 'MessageCacheType'=> -1, 'ParserCacheType'=> -1, 'SessionCacheType'=> -1, 'AnonSessionCacheType'=> false, 'LanguageConverterCacheType'=> -1, 'ObjectCaches'=>[0=>['class'=> 'Wikimedia\\ObjectCache\\EmptyBagOStuff', 'reportDupes'=> false,], 1=>['class'=> 'MediaWiki\\ObjectCache\\SqlBagOStuff', 'loggroup'=> 'SQLBagOStuff',], 'memcached-php'=>['class'=> 'Wikimedia\\ObjectCache\\MemcachedPhpBagOStuff', 'loggroup'=> 'memcached',], 'memcached-pecl'=>['class'=> 'Wikimedia\\ObjectCache\\MemcachedPeclBagOStuff', 'loggroup'=> 'memcached',], 'hash'=>['class'=> 'Wikimedia\\ObjectCache\\HashBagOStuff', 'reportDupes'=> false,], 'apc'=>['class'=> 'Wikimedia\\ObjectCache\\APCUBagOStuff', 'reportDupes'=> false,], 'apcu'=>['class'=> 'Wikimedia\\ObjectCache\\APCUBagOStuff', 'reportDupes'=> false,],], 'WANObjectCache'=>[], 'MicroStashType'=> -1, 'MainStash'=> 1, 'ParsoidCacheConfig'=>['StashType'=> null, 'StashDuration'=> 86400,], 'ParsoidSelectiveUpdateSampleRate'=> 0, 'SplitParsoidParserCache'=> false, 'ParserCacheFilterConfig'=>['pcache'=>['default'=>['minCpuTime'=> 0,],], 'postproc-pcache'=>['default'=>['minCpuTime'=> 9223372036854775807,],], 'parsoid-pcache'=>['default'=>['minCpuTime'=> 0,],], 'postproc-parsoid-pcache'=>['default'=>['minCpuTime'=> 0,],],], 'ChronologyProtectorSecret'=> '', 'ParserCacheExpireTime'=> 86400, 'ParserCacheAsyncExpireTime'=> 60, 'ParserCacheAsyncRefreshJobs'=> true, 'OldRevisionParserCacheExpireTime'=> 3600, 'ObjectCacheSessionExpiry'=> 3600, 'SuspiciousIpExpiry'=> false, 'SessionPbkdf2Iterations'=> 10001, 'UseSessionCookieJwt'=> false, 'JwtSessionCookieIssuer'=> null, 'MemCachedServers'=>['127.0.0.1:11211',], 'MemCachedPersistent'=> false, 'MemCachedTimeout'=> 500000, 'UseLocalMessageCache'=> false, 'AdaptiveMessageCache'=> false, 'LocalisationCacheConf'=>['class'=> 'MediaWiki\\Language\\LocalisationCache', 'store'=> 'detect', 'storeClass'=> false, 'storeDirectory'=> false, 'storeServer'=>[], 'forceRecache'=> false, 'manualRecache'=> false,], 'CachePages'=> true, 'CacheEpoch'=> '20030516000000', 'GitInfoCacheDirectory'=> false, 'UseFileCache'=> false, 'FileCacheDepth'=> 2, 'RenderHashAppend'=> '', 'EnableSidebarCache'=> false, 'SidebarCacheExpiry'=> 86400, 'UseGzip'=> false, 'InvalidateCacheOnLocalSettingsChange'=> true, 'ExtensionInfoMTime'=> false, 'EnableRemoteBagOStuffTests'=> false, 'UseCdn'=> false, 'VaryOnXFP'=> false, 'InternalServer'=> false, 'CdnMaxAge'=> 18000, 'CdnMaxageLagged'=> 30, 'CdnMaxageStale'=> 10, 'CdnReboundPurgeDelay'=> 0, 'CdnMaxageSubstitute'=> 60, 'CdnServers'=>[], 'CdnServersNoPurge'=>[], 'HTCPRouting'=>[], 'HTCPMulticastTTL'=> 1, 'UsePrivateIPs'=> false, 'CdnMatchParameterOrder'=> true, 'LanguageCode'=> 'en', 'GrammarForms'=>[], 'InterwikiMagic'=> true, 'HideInterlanguageLinks'=> false, 'ExtraInterlanguageLinkPrefixes'=>[], 'InterlanguageLinkCodeMap'=>[], 'ExtraLanguageNames'=>[], 'ExtraLanguageCodes'=>['bh'=> 'bho', 'no'=> 'nb', 'simple'=> 'en',], 'DummyLanguageCodes'=>[], 'AllUnicodeFixes'=> false, 'LegacyEncoding'=> false, 'AmericanDates'=> false, 'TranslateNumerals'=> true, 'UseDatabaseMessages'=> true, 'MaxMsgCacheEntrySize'=> 10000, 'DisableLangConversion'=> false, 'DisableTitleConversion'=> false, 'DefaultLanguageVariant'=> false, 'UsePigLatinVariant'=> false, 'DisabledVariants'=>[], 'VariantArticlePath'=> false, 'UseXssLanguage'=> false, 'LoginLanguageSelector'=> false, 'ForceUIMsgAsContentMsg'=>[], 'RawHtmlMessages'=>[], 'Localtimezone'=> null, 'LocalTZoffset'=> null, 'OverrideUcfirstCharacters'=>[], 'MimeType'=> 'text/html', 'Html5Version'=> null, 'EditSubmitButtonLabelPublish'=> false, 'XhtmlNamespaces'=>[], 'SiteNotice'=> '', 'BrowserFormatDetection'=> 'telephone=no', 'SkinMetaTags'=>[], 'DefaultSkin'=> 'vector-2022', 'FallbackSkin'=> 'fallback', 'SkipSkins'=>[], 'DisableOutputCompression'=> false, 'FragmentMode'=>['html5', 'legacy',], 'ExternalInterwikiFragmentMode'=> 'legacy', 'FooterIcons'=>['copyright'=>['copyright'=>[],], 'poweredby'=>['mediawiki'=>['src'=> null, 'url'=> 'https:'alt'=> 'Powered by MediaWiki', 'lang'=> 'en',],],], 'EnableSectionShare'=> false, 'PageShareSkinsEnabled'=>[], 'UseCombinedLoginLink'=> false, 'Edititis'=> false, 'Send404Code'=> true, 'ShowRollbackEditCount'=> 10, 'EnableCanonicalServerLink'=> false, 'InterwikiLogoOverride'=>[], 'ResourceModules'=>[], 'ResourceModuleSkinStyles'=>[], 'ResourceLoaderSources'=>[], 'ResourceBasePath'=> null, 'ResourceLoaderMaxage'=>[], 'ResourceLoaderDebug'=> false, 'ResourceLoaderMaxQueryLength'=> false, 'ResourceLoaderValidateJS'=> true, 'ResourceLoaderEnableJSProfiler'=> false, 'ResourceLoaderStorageEnabled'=> true, 'ResourceLoaderStorageVersion'=> 1, 'ResourceLoaderEnableSourceMapLinks'=> true, 'AllowSiteCSSOnRestrictedPages'=> false, 'VueDevelopmentMode'=> false, 'CodexDevelopmentDir'=> null, 'MetaNamespace'=> false, 'MetaNamespaceTalk'=> false, 'CanonicalNamespaceNames'=>[-2=> 'Media', -1=> 'Special', 0=> '', 1=> 'Talk', 2=> 'User', 3=> 'User_talk', 4=> 'Project', 5=> 'Project_talk', 6=> 'File', 7=> 'File_talk', 8=> 'MediaWiki', 9=> 'MediaWiki_talk', 10=> 'Template', 11=> 'Template_talk', 12=> 'Help', 13=> 'Help_talk', 14=> 'Category', 15=> 'Category_talk',], 'ExtraNamespaces'=>[], 'ExtraGenderNamespaces'=>[], 'NamespaceAliases'=>[], 'LegalTitleChars'=> ' %!"$&\'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+', 'CapitalLinks' => true, 'CapitalLinkOverrides' => [ ], 'NamespacesWithSubpages' => [ 1 => true, 2 => true, 3 => true, 4 => true, 5 => true, 7 => true, 8 => true, 9 => true, 10 => true, 11 => true, 12 => true, 13 => true, 15 => true, ], 'NamespacesWithoutAutoSummaries' => [ ], 'ContentNamespaces' => [ 0, ], 'ShortPagesNamespaceExclusions' => [ ], 'ExtraSignatureNamespaces' => [ ], 'InvalidRedirectTargets' => [ 'Filepath', 'Mypage', 'Mytalk', 'Redirect', 'Mylog', ], 'DisableHardRedirects' => false, 'FixDoubleRedirects' => false, 'LocalInterwikis' => [ ], 'InterwikiExpiry' => 10800, 'InterwikiCache' => false, 'InterwikiScopes' => 3, 'InterwikiFallbackSite' => 'wiki', 'RedirectSources' => false, 'SiteTypes' => [ 'mediawiki' => 'MediaWiki\\Site\\MediaWikiSite', ], 'MaxTocLevel' => 999, 'MaxPPNodeCount' => 1000000, 'MaxTemplateDepth' => 100, 'MaxPPExpandDepth' => 100, 'UrlProtocols' => [ 'bitcoin:', 'ftp: 'ftps: 'geo:', 'git: 'gopher: 'http: 'https: 'irc: 'ircs: 'magnet:', 'mailto:', 'matrix:', 'mms: 'news:', 'nntp: 'redis: 'sftp: 'sip:', 'sips:', 'sms:', 'ssh: 'svn: 'tel:', 'telnet: 'urn:', 'wikipedia: 'worldwind: 'xmpp:', ' ], 'CleanSignatures' => true, 'AllowExternalImages' => false, 'AllowExternalImagesFrom' => '', 'EnableImageWhitelist' => false, 'TidyConfig' => [ ], 'ParsoidSettings' => [ 'useSelser' => true, ], 'ParsoidExperimentalParserFunctionOutput' => false, 'RawHtml' => false, 'ExternalLinkTarget' => false, 'NoFollowLinks' => true, 'NoFollowNsExceptions' => [ ], 'NoFollowDomainExceptions' => [ 'mediawiki.org', ], 'RegisterInternalExternals' => false, 'ExternalLinksIgnoreDomains' => [ ], 'AllowDisplayTitle' => true, 'RestrictDisplayTitle' => true, 'ExpensiveParserFunctionLimit' => 100, 'PreprocessorCacheThreshold' => 1000, 'EnableScaryTranscluding' => false, 'TranscludeCacheExpiry' => 3600, 'EnableMagicLinks' => [ 'ISBN' => false, 'PMID' => false, 'RFC' => false, ], 'ParserEnableUserLanguage' => false, 'ArticleCountMethod' => 'link', 'ActiveUserDays' => 30, 'LearnerEdits' => 10, 'LearnerMemberSince' => 4, 'ExperiencedUserEdits' => 500, 'ExperiencedUserMemberSince' => 30, 'ManualRevertSearchRadius' => 15, 'RevertedTagMaxDepth' => 15, 'CentralIdLookupProviders' => [ 'local' => [ 'class' => 'MediaWiki\\User\\CentralId\\LocalIdLookup', 'services' => [ 'MainConfig', 'DBLoadBalancerFactory', 'HideUserUtils', ], ], ], 'CentralIdLookupProvider' => 'local', 'UserRegistrationProviders' => [ 'local' => [ 'class' => 'MediaWiki\\User\\Registration\\LocalUserRegistrationProvider', 'services' => [ 'ConnectionProvider', ], ], ], 'PasswordPolicy' => [ 'policies' => [ 'bureaucrat' => [ 'MinimalPasswordLength' => 10, 'MinimumPasswordLengthToLogin' => 1, ], 'sysop' => [ 'MinimalPasswordLength' => 10, 'MinimumPasswordLengthToLogin' => 1, ], 'interface-admin' => [ 'MinimalPasswordLength' => 10, 'MinimumPasswordLengthToLogin' => 1, ], 'bot' => [ 'MinimalPasswordLength' => 10, 'MinimumPasswordLengthToLogin' => 1, ], 'default' => [ 'MinimalPasswordLength' => [ 'value' => 8, 'suggestChangeOnLogin' => true, ], 'PasswordCannotBeSubstringInUsername' => [ 'value' => true, 'suggestChangeOnLogin' => true, ], 'PasswordCannotMatchDefaults' => [ 'value' => true, 'suggestChangeOnLogin' => true, ], 'MaximalPasswordLength' => [ 'value' => 4096, 'suggestChangeOnLogin' => true, ], 'PasswordNotInCommonList' => [ 'value' => true, 'suggestChangeOnLogin' => true, ], ], ], 'checks' => [ 'MinimalPasswordLength' => [ 'MediaWiki\\Password\\PasswordPolicyChecks', 'checkMinimalPasswordLength', ], 'MinimumPasswordLengthToLogin' => [ 'MediaWiki\\Password\\PasswordPolicyChecks', 'checkMinimumPasswordLengthToLogin', ], 'PasswordCannotBeSubstringInUsername' => [ 'MediaWiki\\Password\\PasswordPolicyChecks', 'checkPasswordCannotBeSubstringInUsername', ], 'PasswordCannotMatchDefaults' => [ 'MediaWiki\\Password\\PasswordPolicyChecks', 'checkPasswordCannotMatchDefaults', ], 'MaximalPasswordLength' => [ 'MediaWiki\\Password\\PasswordPolicyChecks', 'checkMaximalPasswordLength', ], 'PasswordNotInCommonList' => [ 'MediaWiki\\Password\\PasswordPolicyChecks', 'checkPasswordNotInCommonList', ], ], ], 'AuthManagerConfig' => null, 'AuthManagerAutoConfig' => [ 'preauth' => [ 'MediaWiki\\Auth\\ThrottlePreAuthenticationProvider' => [ 'class' => 'MediaWiki\\Auth\\ThrottlePreAuthenticationProvider', 'sort' => 0, ], 'MediaWiki\\Auth\\PreviouslyRenamedAccountPreAuthenticationProvider' => [ 'class' => 'MediaWiki\\Auth\\PreviouslyRenamedAccountPreAuthenticationProvider', 'services' => [ 'ConnectionProvider', 'UserFactory', ], 'sort' => 0, ], ], 'primaryauth' => [ 'MediaWiki\\Auth\\TemporaryPasswordPrimaryAuthenticationProvider' => [ 'class' => 'MediaWiki\\Auth\\TemporaryPasswordPrimaryAuthenticationProvider', 'services' => [ 'DBLoadBalancerFactory', 'UserOptionsLookup', ], 'args' => [ [ 'authoritative' => false, ], ], 'sort' => 0, ], 'MediaWiki\\Auth\\LocalPasswordPrimaryAuthenticationProvider' => [ 'class' => 'MediaWiki\\Auth\\LocalPasswordPrimaryAuthenticationProvider', 'services' => [ 'DBLoadBalancerFactory', ], 'args' => [ [ 'authoritative' => true, ], ], 'sort' => 100, ], ], 'secondaryauth' => [ 'MediaWiki\\Auth\\CheckBlocksSecondaryAuthenticationProvider' => [ 'class' => 'MediaWiki\\Auth\\CheckBlocksSecondaryAuthenticationProvider', 'sort' => 0, ], 'MediaWiki\\Auth\\ResetPasswordSecondaryAuthenticationProvider' => [ 'class' => 'MediaWiki\\Auth\\ResetPasswordSecondaryAuthenticationProvider', 'sort' => 100, ], 'MediaWiki\\Auth\\EmailNotificationSecondaryAuthenticationProvider' => [ 'class' => 'MediaWiki\\Auth\\EmailNotificationSecondaryAuthenticationProvider', 'services' => [ 'DBLoadBalancerFactory', ], 'sort' => 200, ], ], ], 'RememberMe' => 'choose', 'ReauthenticateTime' => [ 'default' => 3600, ], 'ChangeCredentialsBlacklist' => [ 'MediaWiki\\Auth\\TemporaryPasswordAuthenticationRequest', ], 'RemoveCredentialsBlacklist' => [ 'MediaWiki\\Auth\\PasswordAuthenticationRequest', ], 'InvalidPasswordReset' => true, 'PasswordDefault' => 'pbkdf2', 'PasswordConfig' => [ 'A' => [ 'class' => 'MediaWiki\\Password\\MWOldPassword', ], 'B' => [ 'class' => 'MediaWiki\\Password\\MWSaltedPassword', ], 'pbkdf2-legacyA' => [ 'class' => 'MediaWiki\\Password\\LayeredParameterizedPassword', 'types' => [ 'A', 'pbkdf2', ], ], 'pbkdf2-legacyB' => [ 'class' => 'MediaWiki\\Password\\LayeredParameterizedPassword', 'types' => [ 'B', 'pbkdf2', ], ], 'bcrypt' => [ 'class' => 'MediaWiki\\Password\\BcryptPassword', 'cost' => 9, ], 'pbkdf2' => [ 'class' => 'MediaWiki\\Password\\Pbkdf2PasswordUsingOpenSSL', 'algo' => 'sha512', 'cost' => '30000', 'length' => '64', ], 'argon2' => [ 'class' => 'MediaWiki\\Password\\Argon2Password', 'algo' => 'auto', ], ], 'PasswordResetRoutes' => [ 'username' => true, 'email' => true, ], 'MaxSigChars' => 255, 'SignatureValidation' => 'warning', 'SignatureAllowedLintErrors' => [ 'obsolete-tag', ], 'MaxNameChars' => 255, 'ReservedUsernames' => [ 'MediaWiki default', 'Conversion script', 'Maintenance script', 'Template namespace initialisation script', 'ScriptImporter', 'Delete page script', 'Move page script', 'Command line script', 'Unknown user', 'msg:double-redirect-fixer', 'msg:usermessage-editor', 'msg:proxyblocker', 'msg:sorbs', 'msg:spambot_username', 'msg:autochange-username', ], 'DefaultUserOptions' => [ 'ccmeonemails' => 0, 'date' => 'default', 'diffonly' => 0, 'diff-type' => 'table', 'disablemail' => 0, 'editfont' => 'monospace', 'editondblclick' => 0, 'editrecovery' => 0, 'editsectiononrightclick' => 0, 'email-allow-new-users' => 1, 'enotifminoredits' => 0, 'enotifrevealaddr' => 0, 'enotifusertalkpages' => 1, 'enotifwatchlistpages' => 1, 'extendwatchlist' => 1, 'fancysig' => 0, 'forceeditsummary' => 0, 'forcesafemode' => 0, 'gender' => 'unknown', 'hidecategorization' => 1, 'hideminor' => 0, 'hidepatrolled' => 0, 'imagesize' => 2, 'minordefault' => 0, 'newpageshidepatrolled' => 0, 'nickname' => '', 'norollbackdiff' => 0, 'prefershttps' => 1, 'previewonfirst' => 0, 'previewontop' => 1, 'pst-cssjs' => 1, 'rcdays' => 7, 'rcenhancedfilters-disable' => 0, 'rclimit' => 50, 'requireemail' => 0, 'search-match-redirect' => true, 'search-special-page' => 'Search', 'search-thumbnail-extra-namespaces' => true, 'searchlimit' => 20, 'showhiddencats' => 0, 'shownumberswatching' => 1, 'showrollbackconfirmation' => 0, 'skin' => false, 'skin-responsive' => 1, 'thumbsize' => 5, 'underline' => 2, 'useeditwarning' => 1, 'uselivepreview' => 0, 'usenewrc' => 1, 'watchcreations' => 1, 'watchcreations-expiry' => 'infinite', 'watchdefault' => 1, 'watchdefault-expiry' => 'infinite', 'watchdeletion' => 0, 'watchlistdays' => 7, 'watchlisthideanons' => 0, 'watchlisthidebots' => 0, 'watchlisthidecategorization' => 1, 'watchlisthideliu' => 0, 'watchlisthideminor' => 0, 'watchlisthideown' => 0, 'watchlisthidepatrolled' => 0, 'watchlistreloadautomatically' => 0, 'watchlistunwatchlinks' => 0, 'watchmoves' => 0, 'watchrollback' => 0, 'watchuploads' => 1, 'watchrollback-expiry' => 'infinite', 'watchstar-expiry' => 'infinite', 'wlenhancedfilters-disable' => 0, 'wllimit' => 250, ], 'ConditionalUserOptions' => [ ], 'HiddenPrefs' => [ ], 'UserJsPrefLimit' => 100, 'InvalidUsernameCharacters' => '@:>=', 'UserrightsInterwikiDelimiter' => '@', 'SecureLogin' => false, 'AuthenticationTokenVersion' => null, 'SessionProviders' => [ 'MediaWiki\\Session\\CookieSessionProvider' => [ 'class' => 'MediaWiki\\Session\\CookieSessionProvider', 'args' => [ [ 'priority' => 30, ], ], 'services' => [ 'JwtCodec', 'UrlUtils', ], ], 'MediaWiki\\Session\\BotPasswordSessionProvider' => [ 'class' => 'MediaWiki\\Session\\BotPasswordSessionProvider', 'args' => [ [ 'priority' => 75, ], ], 'services' => [ 'GrantsInfo', ], ], ], 'AutoCreateTempUser' => [ 'known' => false, 'enabled' => false, 'actions' => [ 'edit', ], 'genPattern' => '~$1', 'matchPattern' => null, 'reservedPattern' => '~$1', 'serialProvider' => [ 'type' => 'local', 'useYear' => true, ], 'serialMapping' => [ 'type' => 'readable-numeric', ], 'expireAfterDays' => 90, 'notifyBeforeExpirationDays' => 10, ], 'AutoblockExemptions' => [ ], 'AutoblockExpiry' => 86400, 'BlockAllowsUTEdit' => true, 'BlockCIDRLimit' => [ 'IPv4' => 16, 'IPv6' => 19, ], 'BlockDisablesLogin' => false, 'EnableMultiBlocks' => false, 'WhitelistRead' => false, 'WhitelistReadRegexp' => false, 'EmailConfirmToEdit' => false, 'HideIdentifiableRedirects' => true, 'GroupPermissions' => [ '*' => [ 'createaccount' => true, 'autocreateaccount' => true, 'read' => true, 'edit' => true, 'createpage' => true, 'createtalk' => true, 'viewmyprivateinfo' => true, 'editmyprivateinfo' => true, 'editmyoptions' => true, ], 'user' => [ 'move' => true, 'move-subpages' => true, 'move-rootuserpages' => true, 'move-categorypages' => true, 'movefile' => true, 'read' => true, 'edit' => true, 'createpage' => true, 'createtalk' => true, 'upload' => true, 'reupload' => true, 'reupload-shared' => true, 'minoredit' => true, 'editmyusercss' => true, 'editmyuserjson' => true, 'editmyuserjs' => true, 'editmyuserjsredirect' => true, 'sendemail' => true, 'applychangetags' => true, 'changetags' => true, 'viewmywatchlist' => true, 'editmywatchlist' => true, 'createwithcontentmodel' => true, 'logout' => true, ], 'autoconfirmed' => [ 'autoconfirmed' => true, 'editsemiprotected' => true, ], 'bot' => [ 'bot' => true, 'autoconfirmed' => true, 'editsemiprotected' => true, 'nominornewtalk' => true, 'autopatrol' => true, 'suppressredirect' => true, 'apihighlimits' => true, ], 'sysop' => [ 'block' => true, 'createaccount' => true, 'createpreviouslyrenamedaccount' => true, 'delete' => true, 'bigdelete' => true, 'deletedhistory' => true, 'deletedtext' => true, 'undelete' => true, 'editcontentmodel' => true, 'editinterface' => true, 'editsitejson' => true, 'edituserjson' => true, 'import' => true, 'importupload' => true, 'move' => true, 'move-subpages' => true, 'move-rootuserpages' => true, 'move-categorypages' => true, 'patrol' => true, 'autopatrol' => true, 'protect' => true, 'editprotected' => true, 'rollback' => true, 'upload' => true, 'reupload' => true, 'reupload-shared' => true, 'unwatchedpages' => true, 'autoconfirmed' => true, 'editsemiprotected' => true, 'ipblock-exempt' => true, 'blockemail' => true, 'markbotedits' => true, 'apihighlimits' => true, 'browsearchive' => true, 'noratelimit' => true, 'movefile' => true, 'unblockself' => true, 'suppressredirect' => true, 'mergehistory' => true, 'managechangetags' => true, 'deletechangetags' => true, ], 'interface-admin' => [ 'editinterface' => true, 'editsitecss' => true, 'editsitejson' => true, 'editsitejs' => true, 'editusercss' => true, 'edituserjson' => true, 'edituserjs' => true, ], 'bureaucrat' => [ 'userrights' => true, 'noratelimit' => true, 'renameuser' => true, ], 'suppress' => [ 'hideuser' => true, 'suppressrevision' => true, 'viewsuppressed' => true, 'suppressionlog' => true, 'deleterevision' => true, 'deletelogentry' => true, ], ], 'PrivilegedGroups' => [ 'bureaucrat', 'interface-admin', 'suppress', 'sysop', ], 'RevokePermissions' => [ ], 'GroupInheritsPermissions' => [ ], 'ImplicitGroups' => [ '*', 'user', 'autoconfirmed', ], 'GroupsAddToSelf' => [ ], 'GroupsRemoveFromSelf' => [ ], 'RestrictedGroups' => [ ], 'UserRequirementsPrivateConditions' => [ ], 'RestrictionTypes' => [ 'create', 'edit', 'move', 'upload', ], 'RestrictionLevels' => [ '', 'autoconfirmed', 'sysop', ], 'CascadingRestrictionLevels' => [ 'sysop', ], 'SemiprotectedRestrictionLevels' => [ 'autoconfirmed', ], 'NamespaceProtection' => [ ], 'RestrictUserPageEditing' => false, 'NonincludableNamespaces' => [ ], 'AutoConfirmAge' => 0, 'AutoConfirmCount' => 0, 'Autopromote' => [ 'autoconfirmed' => [ '&', [ 1, null, ], [ 2, null, ], ], ], 'AutopromoteOnce' => [ 'onEdit' => [ ], ], 'AutopromoteOnceLogInRC' => true, 'AutopromoteOnceRCExcludedGroups' => [ ], 'AddGroups' => [ ], 'RemoveGroups' => [ ], 'AvailableRights' => [ ], 'ImplicitRights' => [ ], 'DeleteRevisionsLimit' => 0, 'DeleteRevisionsBatchSize' => 1000, 'HideUserContribLimit' => 1000, 'AccountCreationThrottle' => [ [ 'count' => 0, 'seconds' => 86400, ], ], 'TempAccountCreationThrottle' => [ [ 'count' => 1, 'seconds' => 600, ], [ 'count' => 6, 'seconds' => 86400, ], ], 'TempAccountNameAcquisitionThrottle' => [ [ 'count' => 60, 'seconds' => 86400, ], ], 'SpamRegex' => [ ], 'SummarySpamRegex' => [ ], 'EnableDnsBlacklist' => false, 'DnsBlacklistUrls' => [ ], 'ProxyList' => [ ], 'ProxyWhitelist' => [ ], 'SoftBlockRanges' => [ ], 'ApplyIpBlocksToXff' => false, 'RateLimits' => [ 'edit' => [ 'ip' => [ 8, 60, ], 'newbie' => [ 8, 60, ], 'user' => [ 90, 60, ], ], 'move' => [ 'newbie' => [ 2, 120, ], 'user' => [ 8, 60, ], ], 'upload' => [ 'ip' => [ 8, 60, ], 'newbie' => [ 8, 60, ], ], 'rollback' => [ 'user' => [ 10, 60, ], 'newbie' => [ 5, 120, ], ], 'mailpassword' => [ 'ip' => [ 5, 3600, ], ], 'sendemail' => [ 'ip' => [ 5, 86400, ], 'newbie' => [ 5, 86400, ], 'user' => [ 20, 86400, ], ], 'changeemail' => [ 'ip-all' => [ 10, 3600, ], 'user' => [ 4, 86400, ], ], 'confirmemail' => [ 'ip-all' => [ 10, 3600, ], 'user' => [ 4, 86400, ], ], 'purge' => [ 'ip' => [ 30, 60, ], 'user' => [ 30, 60, ], ], 'linkpurge' => [ 'ip' => [ 30, 60, ], 'user' => [ 30, 60, ], ], 'renderfile' => [ 'ip' => [ 700, 30, ], 'user' => [ 700, 30, ], ], 'renderfile-nonstandard' => [ 'ip' => [ 70, 30, ], 'user' => [ 70, 30, ], ], 'stashedit' => [ 'ip' => [ 30, 60, ], 'newbie' => [ 30, 60, ], ], 'stashbasehtml' => [ 'ip' => [ 5, 60, ], 'newbie' => [ 5, 60, ], ], 'changetags' => [ 'ip' => [ 8, 60, ], 'newbie' => [ 8, 60, ], ], 'editcontentmodel' => [ 'newbie' => [ 2, 120, ], 'user' => [ 8, 60, ], ], ], 'RateLimitsExcludedIPs' => [ ], 'PutIPinRC' => true, 'QueryPageDefaultLimit' => 50, 'ExternalQuerySources' => [ ], 'PasswordAttemptThrottle' => [ [ 'count' => 5, 'seconds' => 300, ], [ 'count' => 150, 'seconds' => 172800, ], ], 'GrantPermissions' => [ 'basic' => [ 'autocreateaccount' => true, 'autoconfirmed' => true, 'autopatrol' => true, 'editsemiprotected' => true, 'ipblock-exempt' => true, 'nominornewtalk' => true, 'patrolmarks' => true, 'read' => true, 'unwatchedpages' => true, ], 'highvolume' => [ 'bot' => true, 'apihighlimits' => true, 'noratelimit' => true, 'markbotedits' => true, ], 'import' => [ 'import' => true, 'importupload' => true, ], 'editpage' => [ 'edit' => true, 'minoredit' => true, 'applychangetags' => true, 'changetags' => true, 'editcontentmodel' => true, 'createwithcontentmodel' => true, 'pagelang' => true, ], 'editprotected' => [ 'edit' => true, 'minoredit' => true, 'applychangetags' => true, 'changetags' => true, 'editcontentmodel' => true, 'createwithcontentmodel' => true, 'editprotected' => true, ], 'editmycssjs' => [ 'edit' => true, 'minoredit' => true, 'applychangetags' => true, 'changetags' => true, 'editcontentmodel' => true, 'createwithcontentmodel' => true, 'editmyusercss' => true, 'editmyuserjson' => true, 'editmyuserjs' => true, ], 'editmyoptions' => [ 'editmyoptions' => true, 'editmyuserjson' => true, ], 'editinterface' => [ 'edit' => true, 'minoredit' => true, 'applychangetags' => true, 'changetags' => true, 'editcontentmodel' => true, 'createwithcontentmodel' => true, 'editinterface' => true, 'edituserjson' => true, 'editsitejson' => true, ], 'editsiteconfig' => [ 'edit' => true, 'minoredit' => true, 'applychangetags' => true, 'changetags' => true, 'editcontentmodel' => true, 'createwithcontentmodel' => true, 'editinterface' => true, 'edituserjson' => true, 'editsitejson' => true, 'editusercss' => true, 'edituserjs' => true, 'editsitecss' => true, 'editsitejs' => true, ], 'createeditmovepage' => [ 'edit' => true, 'minoredit' => true, 'applychangetags' => true, 'changetags' => true, 'editcontentmodel' => true, 'createwithcontentmodel' => true, 'createpage' => true, 'createtalk' => true, 'delete-redirect' => true, 'move' => true, 'move-rootuserpages' => true, 'move-subpages' => true, 'move-categorypages' => true, 'suppressredirect' => true, ], 'uploadfile' => [ 'upload' => true, 'reupload-own' => true, ], 'uploadeditmovefile' => [ 'upload' => true, 'reupload-own' => true, 'reupload' => true, 'reupload-shared' => true, 'upload_by_url' => true, 'movefile' => true, 'suppressredirect' => true, ], 'patrol' => [ 'patrol' => true, ], 'rollback' => [ 'rollback' => true, ], 'blockusers' => [ 'block' => true, 'blockemail' => true, 'deferredblock' => true, ], 'viewdeleted' => [ 'browsearchive' => true, 'deletedhistory' => true, 'deletedtext' => true, ], 'viewrestrictedlogs' => [ 'suppressionlog' => true, 'deferredblock' => true, ], 'delete' => [ 'edit' => true, 'minoredit' => true, 'applychangetags' => true, 'changetags' => true, 'editcontentmodel' => true, 'createwithcontentmodel' => true, 'browsearchive' => true, 'deletedhistory' => true, 'deletedtext' => true, 'delete' => true, 'bigdelete' => true, 'deletelogentry' => true, 'deleterevision' => true, 'undelete' => true, ], 'oversight' => [ 'suppressrevision' => true, 'viewsuppressed' => true, ], 'protect' => [ 'edit' => true, 'minoredit' => true, 'applychangetags' => true, 'changetags' => true, 'editcontentmodel' => true, 'createwithcontentmodel' => true, 'editprotected' => true, 'protect' => true, ], 'viewmywatchlist' => [ 'viewmywatchlist' => true, ], 'editmywatchlist' => [ 'editmywatchlist' => true, ], 'sendemail' => [ 'sendemail' => true, ], 'createaccount' => [ 'createaccount' => true, ], 'privateinfo' => [ 'viewmyprivateinfo' => true, ], 'mergehistory' => [ 'mergehistory' => true, ], 'managesessions' => [ 'logout' => true, ], ], 'GrantPermissionGroups' => [ 'basic' => 'hidden', 'editpage' => 'page-interaction', 'createeditmovepage' => 'page-interaction', 'editprotected' => 'page-interaction', 'patrol' => 'page-interaction', 'uploadfile' => 'file-interaction', 'uploadeditmovefile' => 'file-interaction', 'sendemail' => 'email', 'viewmywatchlist' => 'watchlist-interaction', 'editmywatchlist' => 'watchlist-interaction', 'editmycssjs' => 'customization', 'editmyoptions' => 'customization', 'editinterface' => 'administration', 'editsiteconfig' => 'administration', 'rollback' => 'administration', 'blockusers' => 'administration', 'delete' => 'administration', 'viewdeleted' => 'administration', 'viewrestrictedlogs' => 'administration', 'protect' => 'administration', 'oversight' => 'administration', 'createaccount' => 'administration', 'mergehistory' => 'administration', 'import' => 'administration', 'highvolume' => 'high-volume', 'privateinfo' => 'private-information', 'managesessions' => 'private-information', ], 'GrantRiskGroups' => [ 'basic' => 'low', 'editpage' => 'low', 'createeditmovepage' => 'low', 'editprotected' => 'vandalism', 'patrol' => 'low', 'uploadfile' => 'low', 'uploadeditmovefile' => 'low', 'sendemail' => 'security', 'viewmywatchlist' => 'low', 'editmywatchlist' => 'low', 'editmycssjs' => 'security', 'editmyoptions' => 'security', 'editinterface' => 'vandalism', 'editsiteconfig' => 'security', 'rollback' => 'low', 'blockusers' => 'vandalism', 'delete' => 'vandalism', 'viewdeleted' => 'vandalism', 'viewrestrictedlogs' => 'security', 'protect' => 'vandalism', 'oversight' => 'security', 'createaccount' => 'low', 'mergehistory' => 'vandalism', 'import' => 'security', 'highvolume' => 'low', 'privateinfo' => 'low', 'managesessions' => 'low', ], 'EnableBotPasswords' => true, 'BotPasswordsCluster' => false, 'BotPasswordsDatabase' => false, 'BotPasswordsLimit' => 100, 'SecretKey' => false, 'JwtPrivateKey' => false, 'JwtPublicKey' => false, 'AllowUserJs' => false, 'ReauthenticateForActions' => [ 'edituserjs' => 'edituserjscss', 'editusercss' => 'edituserjscss', 'editsitejs' => 'editsitejscss', 'editsitecss' => 'editsitejscss', ], 'AllowUserCss' => false, 'AllowUserCssPrefs' => true, 'UseSiteJs' => true, 'UseSiteCss' => true, 'BreakFrames' => false, 'EditPageFrameOptions' => 'DENY', 'ApiFrameOptions' => 'DENY', 'CSPHeader' => false, 'CSPReportOnlyHeader' => false, 'CSPUseReportURIDirective' => false, 'CSPFalsePositiveUrls' => [ 'https: 'https: 'https: 'https: 'https: 'https: 'https: 'https: 'https: 'https: 'https: 'https: 'https: 'https: 'chrome-extension' => true, ], 'AllowCrossOrigin' => false, 'RestAllowCrossOriginCookieAuth' => false, 'SessionSecret' => false, 'CookieExpiration' => 2592000, 'ExtendedLoginCookieExpiration' => 15552000, 'SessionCookieJwtExpiration' => 14400, 'CookieDomain' => '', 'CookiePath' => '/', 'CookieSecure' => 'detect', 'CookiePrefix' => false, 'CookieHttpOnly' => true, 'CookieSameSite' => null, 'CacheVaryCookies' => [ ], 'SessionName' => false, 'CookieSetOnAutoblock' => true, 'CookieSetOnIpBlock' => true, 'DeviceBoundSessions' => false, 'DeviceBoundSessionsReportOnly' => true, 'DeviceBoundSessionCookieName' => '__Host-dbsc', 'DeviceBoundSessionCredentialTTL' => 600, 'DeviceBoundSessionChallengeTTL' => 900, 'DeviceBoundSessionBindingTTL' => 2592000, 'DeviceBoundSessionScopeExcludes' => [ ], 'DebugLogFile' => '', 'DebugLogPrefix' => '', 'DebugRedirects' => false, 'DebugRawPage' => false, 'DebugComments' => false, 'DebugDumpSql' => false, 'TrxProfilerLimits' => [ 'GET' => [ 'masterConns' => 0, 'writes' => 0, 'readQueryTime' => 5, 'readQueryRows' => 10000, ], 'POST' => [ 'readQueryTime' => 5, 'writeQueryTime' => 1, 'readQueryRows' => 100000, 'maxAffected' => 1000, ], 'POST-nonwrite' => [ 'writes' => 0, 'readQueryTime' => 5, 'readQueryRows' => 10000, ], 'PostSend-GET' => [ 'readQueryTime' => 5, 'writeQueryTime' => 1, 'readQueryRows' => 10000, 'maxAffected' => 1000, 'masterConns' => 0, 'writes' => 0, ], 'PostSend-POST' => [ 'readQueryTime' => 5, 'writeQueryTime' => 1, 'readQueryRows' => 100000, 'maxAffected' => 1000, ], 'JobRunner' => [ 'readQueryTime' => 30, 'writeQueryTime' => 5, 'readQueryRows' => 100000, 'maxAffected' => 500, ], 'Maintenance' => [ 'writeQueryTime' => 5, 'maxAffected' => 1000, ], ], 'DebugLogGroups' => [ ], 'MWLoggerDefaultSpi' => [ 'class' => 'MediaWiki\\Logger\\LegacySpi', ], 'ShowDebug' => false, 'SpecialVersionShowHooks' => false, 'ShowExceptionDetails' => false, 'LogExceptionBacktrace' => true, 'PropagateErrors' => true, 'ShowHostnames' => false, 'OverrideHostname' => false, 'DevelopmentWarnings' => false, 'DeprecationReleaseLimit' => false, 'Profiler' => [ ], 'StatsTarget' => null, 'StatsFormat' => null, 'StatsPrefix' => 'mediawiki', 'OpenTelemetryConfig' => null, 'PageInfoTransclusionLimit' => 50, 'EnableJavaScriptTest' => false, 'DebugToolbar' => false, 'ApiClientErrorSampleRate' => 1.0, 'DisableTextSearch' => false, 'AdvancedSearchHighlighting' => false, 'SearchHighlightBoundaries' => '[\\p{Z}\\p{P}\\p{C}]', 'OpenSearchTemplates' => [ 'application/x-suggestions+json' => false, 'application/x-suggestions+xml' => false, ], 'OpenSearchDefaultLimit' => 10, 'OpenSearchDescriptionLength' => 100, 'SearchSuggestCacheExpiry' => 1200, 'DisableSearchUpdate' => false, 'NamespacesToBeSearchedDefault' => [ true, ], 'DisableInternalSearch' => false, 'SearchForwardUrl' => null, 'SitemapNamespaces' => false, 'SitemapNamespacesPriorities' => false, 'SitemapApiConfig' => [ ], 'SpecialSearchFormOptions' => [ ], 'SearchMatchRedirectPreference' => false, 'SearchRunSuggestedQuery' => true, 'Diff3' => '/usr/bin/diff3', 'Diff' => '/usr/bin/diff', 'PreviewOnOpenNamespaces' => [ 14 => true, ], 'UniversalEditButton' => true, 'UseAutomaticEditSummaries' => true, 'CommandLineDarkBg' => false, 'ReadOnly' => null, 'ReadOnlyWatchedItemStore' => false, 'ReadOnlyFile' => false, 'UpgradeKey' => false, 'GitBin' => '/usr/bin/git', 'GitRepositoryViewers' => [ 'https: 'ssh: 'https: 'git@github\\.com:(.*?)(\\.git)?' => 'https: ], 'InstallerInitialPages' => [ [ 'titlemsg' => 'mainpage', 'text' => '{{subst:int:mainpagetext}}{{subst:int:mainpagedocfooter}}', ], ], 'RCMaxAge' => 7776000, 'WatchersMaxAge' => 15552000, 'UnwatchedPageSecret' => 1, 'RCFilterByAge' => false, 'RCLinkLimits' => [ 50, 100, 250, 500, ], 'RCLinkDays' => [ 1, 3, 7, 14, 30, ], 'RCFeeds' => [ ], 'RCWatchCategoryMembership' => false, 'UseRCPatrol' => true, 'StructuredChangeFiltersLiveUpdatePollingRate' => 3, 'UseNPPatrol' => true, 'UseFilePatrol' => true, 'Feed' => true, 'FeedLimit' => 50, 'FeedCacheTimeout' => 60, 'FeedDiffCutoff' => 32768, 'OverrideSiteFeed' => [ ], 'FeedClasses' => [ 'rss' => 'MediaWiki\\Feed\\RSSFeed', 'atom' => 'MediaWiki\\Feed\\AtomFeed', ], 'AdvertisedFeedTypes' => [ 'atom', ], 'RCShowWatchingUsers' => false, 'RCShowChangedSize' => true, 'RCChangedSizeThreshold' => 500, 'ShowUpdatedMarker' => true, 'DisableAnonTalk' => false, 'UseTagFilter' => true, 'SoftwareTags' => [ 'mw-contentmodelchange' => true, 'mw-new-redirect' => true, 'mw-removed-redirect' => true, 'mw-changed-redirect-target' => true, 'mw-blank' => true, 'mw-replace' => true, 'mw-recreated' => true, 'mw-rollback' => true, 'mw-undo' => true, 'mw-manual-revert' => true, 'mw-reverted' => true, 'mw-server-side-upload' => true, 'mw-ipblock-appeal' => true, 'mw-edited-other-users-js' => true, 'mw-edited-other-users-css' => true, ], 'RestrictedTagViewRights' => [ ], 'UnwatchedPageThreshold' => false, 'RecentChangesFlags' => [ 'newpage' => [ 'letter' => 'newpageletter', 'title' => 'recentchanges-label-newpage', 'legend' => 'recentchanges-legend-newpage', 'grouping' => 'any', ], 'minor' => [ 'letter' => 'minoreditletter', 'title' => 'recentchanges-label-minor', 'legend' => 'recentchanges-legend-minor', 'class' => 'minoredit', 'grouping' => 'all', ], 'bot' => [ 'letter' => 'boteditletter', 'title' => 'recentchanges-label-bot', 'legend' => 'recentchanges-legend-bot', 'class' => 'botedit', 'grouping' => 'all', ], 'unpatrolled' => [ 'letter' => 'unpatrolledletter', 'title' => 'recentchanges-label-unpatrolled', 'legend' => 'recentchanges-legend-unpatrolled', 'grouping' => 'any', ], ], 'WatchlistExpiry' => false, 'EnableWatchstarPopover' => false, 'EnableWatchlistLabels' => false, 'WatchlistLabelsMaxPerUser' => 100, 'WatchlistPurgeRate' => 0.1, 'WatchlistExpiryMaxDuration' => '1 year', 'EnableChangesListQueryPartitioning' => false, 'RightsPage' => null, 'RightsUrl' => null, 'RightsText' => null, 'RightsIcon' => null, 'UseCopyrightUpload' => false, 'MaxCredits' => 0, 'ShowCreditsIfMax' => true, 'ImportSources' => [ ], 'ImportTargetNamespace' => null, 'ExportAllowHistory' => true, 'ExportMaxHistory' => 0, 'ExportAllowListContributors' => false, 'ExportMaxLinkDepth' => 0, 'ExportFromNamespaces' => false, 'ExportAllowAll' => false, 'ExportPagelistLimit' => 5000, 'XmlDumpSchemaVersion' => '0.11', 'WikiFarmSettingsDirectory' => null, 'WikiFarmSettingsExtension' => 'yaml', 'ExtensionFunctions' => [ ], 'ExtensionMessagesFiles' => [ ], 'MessagesDirs' => [ ], 'TranslationAliasesDirs' => [ ], 'ExtensionEntryPointListFiles' => [ ], 'EnableParserLimitReporting' => true, 'ValidSkinNames' => [ ], 'SpecialPages' => [ ], 'ExtensionCredits' => [ ], 'Hooks' => [ ], 'ServiceWiringFiles' => [ ], 'JobClasses' => [ 'deletePage' => 'MediaWiki\\Page\\DeletePageJob', 'refreshLinks' => 'MediaWiki\\JobQueue\\Jobs\\RefreshLinksJob', 'deleteLinks' => 'MediaWiki\\Page\\DeleteLinksJob', 'htmlCacheUpdate' => 'MediaWiki\\JobQueue\\Jobs\\HTMLCacheUpdateJob', 'sendMail' => [ 'class' => 'MediaWiki\\Mail\\EmaillingJob', 'services' => [ 'Emailer', ], ], 'enotifNotify' => [ 'class' => 'MediaWiki\\RecentChanges\\RecentChangeNotifyJob', 'services' => [ 'RecentChangeLookup', ], ], 'fixDoubleRedirect' => [ 'class' => 'MediaWiki\\JobQueue\\Jobs\\DoubleRedirectJob', 'services' => [ 'RevisionLookup', 'MagicWordFactory', 'WikiPageFactory', ], 'needsPage' => true, ], 'AssembleUploadChunks' => 'MediaWiki\\JobQueue\\Jobs\\AssembleUploadChunksJob', 'PublishStashedFile' => 'MediaWiki\\JobQueue\\Jobs\\PublishStashedFileJob', 'ThumbnailRender' => 'MediaWiki\\JobQueue\\Jobs\\ThumbnailRenderJob', 'UploadFromUrl' => 'MediaWiki\\JobQueue\\Jobs\\UploadFromUrlJob', 'recentChangesUpdate' => 'MediaWiki\\RecentChanges\\RecentChangesUpdateJob', 'refreshLinksPrioritized' => 'MediaWiki\\JobQueue\\Jobs\\RefreshLinksJob', 'refreshLinksDynamic' => 'MediaWiki\\JobQueue\\Jobs\\RefreshLinksJob', 'activityUpdateJob' => 'MediaWiki\\Watchlist\\ActivityUpdateJob', 'categoryMembershipChange' => [ 'class' => 'MediaWiki\\RecentChanges\\CategoryMembershipChangeJob', 'services' => [ 'RecentChangeFactory', ], ], 'CategoryCountUpdateJob' => [ 'class' => 'MediaWiki\\JobQueue\\Jobs\\CategoryCountUpdateJob', 'services' => [ 'ConnectionProvider', 'NamespaceInfo', ], ], 'clearUserWatchlist' => 'MediaWiki\\Watchlist\\ClearUserWatchlistJob', 'watchlistExpiry' => [ 'class' => 'MediaWiki\\Watchlist\\WatchlistExpiryJob', 'needsPage' => false, ], 'cdnPurge' => 'MediaWiki\\JobQueue\\Jobs\\CdnPurgeJob', 'userGroupExpiry' => 'MediaWiki\\User\\UserGroupExpiryJob', 'clearWatchlistNotifications' => 'MediaWiki\\Watchlist\\ClearWatchlistNotificationsJob', 'userOptionsUpdate' => 'MediaWiki\\User\\Options\\UserOptionsUpdateJob', 'revertedTagUpdate' => 'MediaWiki\\JobQueue\\Jobs\\RevertedTagUpdateJob', 'null' => 'MediaWiki\\JobQueue\\Jobs\\NullJob', 'userEditCountInit' => 'MediaWiki\\User\\UserEditCountInitJob', 'renameUserTable' => [ 'class' => 'MediaWiki\\RenameUser\\Job\\RenameUserTableJob', 'services' => [ 'MainConfig', 'DBLoadBalancerFactory', ], ], 'renameUserDerived' => [ 'class' => 'MediaWiki\\RenameUser\\Job\\RenameUserDerivedJob', 'services' => [ 'RenameUserFactory', 'UserFactory', ], ], 'renameUser' => [ 'class' => 'MediaWiki\\RenameUser\\Job\\RenameUserTableJob', 'services' => [ 'MainConfig', 'DBLoadBalancerFactory', ], ], ], 'JobTypesExcludedFromDefaultQueue' => [ 'AssembleUploadChunks', 'PublishStashedFile', 'UploadFromUrl', ], 'JobBackoffThrottling' => [ ], 'JobTypeConf' => [ 'default' => [ 'class' => 'MediaWiki\\JobQueue\\JobQueueDB', 'order' => 'random', 'claimTTL' => 3600, ], ], 'JobQueueIncludeInMaxLagFactor' => false, 'SpecialPageCacheUpdates' => [ 'Statistics' => [ 'MediaWiki\\Deferred\\SiteStatsUpdate', 'cacheUpdate', ], ], 'PagePropLinkInvalidations' => [ 'hiddencat' => 'categorylinks', ], 'CategoryMagicGallery' => true, 'CategoryPagingLimit' => 200, 'CategoryCollation' => 'uppercase', 'TempCategoryCollations' => [ ], 'SortedCategories' => false, 'TrackingCategories' => [ ], 'LogTypes' => [ '', 'block', 'deferredblock', 'protect', 'rights', 'delete', 'upload', 'move', 'import', 'interwiki', 'patrol', 'merge', 'suppress', 'tag', 'managetags', 'contentmodel', 'renameuser', ], 'LogRestrictions' => [ 'suppress' => 'suppressionlog', 'deferredblock' => 'deferredblock', ], 'FilterLogTypes' => [ 'patrol' => true, 'tag' => true, 'newusers' => false, ], 'LogNames' => [ '' => 'all-logs-page', 'block' => 'blocklogpage', 'protect' => 'protectlogpage', 'rights' => 'rightslog', 'delete' => 'dellogpage', 'upload' => 'uploadlogpage', 'move' => 'movelogpage', 'import' => 'importlogpage', 'patrol' => 'patrol-log-page', 'merge' => 'mergelog', 'suppress' => 'suppressionlog', ], 'LogHeaders' => [ '' => 'alllogstext', 'block' => 'blocklogtext', 'delete' => 'dellogpagetext', 'import' => 'importlogpagetext', 'merge' => 'mergelogpagetext', 'move' => 'movelogpagetext', 'patrol' => 'patrol-log-header', 'protect' => 'protectlogtext', 'rights' => 'rightslogtext', 'suppress' => 'suppressionlogtext', 'upload' => 'uploadlogpagetext', ], 'LogActions' => [ ], 'LogActionsHandlers' => [ 'block/block' => [ 'class' => 'MediaWiki\\Logging\\BlockLogFormatter', 'services' => [ 'TitleParser', 'NamespaceInfo', ], ], 'block/reblock' => [ 'class' => 'MediaWiki\\Logging\\BlockLogFormatter', 'services' => [ 'TitleParser', 'NamespaceInfo', ], ], 'block/unblock' => [ 'class' => 'MediaWiki\\Logging\\BlockLogFormatter', 'services' => [ 'TitleParser', 'NamespaceInfo', ], ], 'contentmodel/change' => 'MediaWiki\\Logging\\ContentModelLogFormatter', 'contentmodel/new' => 'MediaWiki\\Logging\\ContentModelLogFormatter', 'deferredblock/block' => [ 'class' => 'MediaWiki\\Logging\\BlockLogFormatter', 'services' => [ 'TitleParser', 'NamespaceInfo', ], ], 'deferredblock/reblock' => [ 'class' => 'MediaWiki\\Logging\\BlockLogFormatter', 'services' => [ 'TitleParser', 'NamespaceInfo', ], ], 'deferredblock/unblock' => [ 'class' => 'MediaWiki\\Logging\\BlockLogFormatter', 'services' => [ 'TitleParser', 'NamespaceInfo', ], ], 'delete/delete' => 'MediaWiki\\Logging\\DeleteLogFormatter', 'delete/delete_redir' => 'MediaWiki\\Logging\\DeleteLogFormatter', 'delete/delete_redir2' => 'MediaWiki\\Logging\\DeleteLogFormatter', 'delete/event' => 'MediaWiki\\Logging\\DeleteLogFormatter', 'delete/restore' => 'MediaWiki\\Logging\\DeleteLogFormatter', 'delete/revision' => 'MediaWiki\\Logging\\DeleteLogFormatter', 'import/interwiki' => 'MediaWiki\\Logging\\ImportLogFormatter', 'import/upload' => 'MediaWiki\\Logging\\ImportLogFormatter', 'interwiki/iw_add' => 'MediaWiki\\Logging\\InterwikiLogFormatter', 'interwiki/iw_delete' => 'MediaWiki\\Logging\\InterwikiLogFormatter', 'interwiki/iw_edit' => 'MediaWiki\\Logging\\InterwikiLogFormatter', 'managetags/activate' => 'MediaWiki\\Logging\\LogFormatter', 'managetags/create' => 'MediaWiki\\Logging\\LogFormatter', 'managetags/deactivate' => 'MediaWiki\\Logging\\LogFormatter', 'managetags/delete' => 'MediaWiki\\Logging\\LogFormatter', 'merge/merge' => [ 'class' => 'MediaWiki\\Logging\\MergeLogFormatter', 'services' => [ 'TitleParser', ], ], 'merge/merge-into' => [ 'class' => 'MediaWiki\\Logging\\MergeLogFormatter', 'services' => [ 'TitleParser', ], ], 'move/move' => [ 'class' => 'MediaWiki\\Logging\\MoveLogFormatter', 'services' => [ 'TitleParser', ], ], 'move/move_redir' => [ 'class' => 'MediaWiki\\Logging\\MoveLogFormatter', 'services' => [ 'TitleParser', ], ], 'patrol/patrol' => 'MediaWiki\\Logging\\PatrolLogFormatter', 'patrol/autopatrol' => 'MediaWiki\\Logging\\PatrolLogFormatter', 'protect/modify' => [ 'class' => 'MediaWiki\\Logging\\ProtectLogFormatter', 'services' => [ 'TitleParser', ], ], 'protect/move_prot' => [ 'class' => 'MediaWiki\\Logging\\ProtectLogFormatter', 'services' => [ 'TitleParser', ], ], 'protect/protect' => [ 'class' => 'MediaWiki\\Logging\\ProtectLogFormatter', 'services' => [ 'TitleParser', ], ], 'protect/unprotect' => [ 'class' => 'MediaWiki\\Logging\\ProtectLogFormatter', 'services' => [ 'TitleParser', ], ], 'renameuser/renameuser' => [ 'class' => 'MediaWiki\\Logging\\RenameuserLogFormatter', 'services' => [ 'TitleParser', ], ], 'rights/autopromote' => 'MediaWiki\\Logging\\RightsLogFormatter', 'rights/rights' => 'MediaWiki\\Logging\\RightsLogFormatter', 'suppress/block' => [ 'class' => 'MediaWiki\\Logging\\BlockLogFormatter', 'services' => [ 'TitleParser', 'NamespaceInfo', ], ], 'suppress/delete' => 'MediaWiki\\Logging\\DeleteLogFormatter', 'suppress/event' => 'MediaWiki\\Logging\\DeleteLogFormatter', 'suppress/reblock' => [ 'class' => 'MediaWiki\\Logging\\BlockLogFormatter', 'services' => [ 'TitleParser', 'NamespaceInfo', ], ], 'suppress/revision' => 'MediaWiki\\Logging\\DeleteLogFormatter', 'suppress/unblock' => [ 'class' => 'MediaWiki\\Logging\\BlockLogFormatter', 'services' => [ 'TitleParser', 'NamespaceInfo', ], ], 'tag/update' => 'MediaWiki\\Logging\\TagLogFormatter', 'upload/overwrite' => 'MediaWiki\\Logging\\UploadLogFormatter', 'upload/revert' => 'MediaWiki\\Logging\\UploadLogFormatter', 'upload/upload' => 'MediaWiki\\Logging\\UploadLogFormatter', ], 'ActionFilteredLogs' => [ 'block' => [ 'block' => [ 'block', ], 'reblock' => [ 'reblock', ], 'unblock' => [ 'unblock', ], ], 'contentmodel' => [ 'change' => [ 'change', ], 'new' => [ 'new', ], ], 'deferredblock' => [ 'block' => [ 'block', ], 'reblock' => [ 'reblock', ], 'unblock' => [ 'unblock', ], ], 'delete' => [ 'delete' => [ 'delete', ], 'delete_redir' => [ 'delete_redir', 'delete_redir2', ], 'restore' => [ 'restore', ], 'event' => [ 'event', ], 'revision' => [ 'revision', ], ], 'import' => [ 'interwiki' => [ 'interwiki', ], 'upload' => [ 'upload', ], ], 'managetags' => [ 'create' => [ 'create', ], 'delete' => [ 'delete', ], 'activate' => [ 'activate', ], 'deactivate' => [ 'deactivate', ], ], 'move' => [ 'move' => [ 'move', ], 'move_redir' => [ 'move_redir', ], ], 'newusers' => [ 'create' => [ 'create', 'newusers', ], 'create2' => [ 'create2', ], 'autocreate' => [ 'autocreate', ], 'byemail' => [ 'byemail', ], ], 'protect' => [ 'protect' => [ 'protect', ], 'modify' => [ 'modify', ], 'unprotect' => [ 'unprotect', ], 'move_prot' => [ 'move_prot', ], ], 'rights' => [ 'rights' => [ 'rights', ], 'autopromote' => [ 'autopromote', ], ], 'suppress' => [ 'event' => [ 'event', ], 'revision' => [ 'revision', ], 'delete' => [ 'delete', ], 'block' => [ 'block', ], 'reblock' => [ 'reblock', ], 'unblock' => [ 'unblock', ], ], 'upload' => [ 'upload' => [ 'upload', ], 'overwrite' => [ 'overwrite', ], 'revert' => [ 'revert', ], ], ], 'NewUserLog' => true, 'WatchUserPageOnAccountCreation' => true, 'PageCreationLog' => true, 'AllowSpecialInclusion' => true, 'DisableQueryPageUpdate' => false, 'CountCategorizedImagesAsUsed' => false, 'MaxRedirectLinksRetrieved' => 500, 'RangeContributionsCIDRLimit' => [ 'IPv4' => 16, 'IPv6' => 32, ], 'Actions' => [ ], 'DefaultRobotPolicy' => 'index,follow', 'NamespaceRobotPolicies' => [ ], 'ArticleRobotPolicies' => [ ], 'ExemptFromUserRobotsControl' => null, 'DebugAPI' => false, 'APIModules' => [ ], 'APIFormatModules' => [ ], 'APIMetaModules' => [ ], 'APIPropModules' => [ ], 'APIListModules' => [ ], 'APIMaxDBRows' => 5000, 'APIMaxResultSize' => 8388608, 'APIMaxUncachedDiffs' => 1, 'APIMaxLagThreshold' => 7, 'APICacheHelpTimeout' => 3600, 'APIUselessQueryPages' => [ 'MIMEsearch', 'LinkSearch', ], 'AjaxLicensePreview' => true, 'CrossSiteAJAXdomains' => [ ], 'CrossSiteAJAXdomainExceptions' => [ ], 'AllowedCorsHeaders' => [ 'Accept', 'Accept-Language', 'Content-Language', 'Content-Type', 'Accept-Encoding', 'DNT', 'Origin', 'User-Agent', 'Api-User-Agent', 'Promise-Non-Write-API-Action', 'Access-Control-Max-Age', 'Authorization', ], 'RestAPIAdditionalRouteFiles' => [ ], 'RestLocalModuleTestBaseUrl' => null, 'RestModuleOverrides' => [ ], 'RestExternalModules' => [ ], 'RestTermsOfServiceUrl' => null, 'MaxShellMemory' => 307200, 'MaxShellFileSize' => 102400, 'MaxShellTime' => 180, 'MaxShellWallClockTime' => 180, 'ShellCgroup' => false, 'PhpCli' => '/usr/bin/php', 'ShellRestrictionMethod' => 'autodetect', 'ShellboxUrls' => [ 'default' => null, ], 'ShellboxSecretKey' => null, 'ShellboxShell' => '/bin/sh', 'HTTPTimeout' => 25, 'HTTPConnectTimeout' => 5.0, 'HTTPMaxTimeout' => 0, 'HTTPMaxConnectTimeout' => 0, 'HTTPImportTimeout' => 25, 'HTTPUserAgentContact' => false, 'AsyncHTTPTimeout' => 25, 'HTTPProxy' => '', 'LocalVirtualHosts' => [ ], 'LocalHTTPProxy' => false, 'AllowExternalReqID' => false, 'GenerateReqIDFormat' => 'rand24', 'JobRunRate' => 1, 'RunJobsAsync' => false, 'UpdateRowsPerJob' => 300, 'UpdateRowsPerQuery' => 100, 'RedirectOnLogin' => null, 'EventRelayerConfig' => [ 'default' => [ 'class' => 'Wikimedia\\EventRelayer\\EventRelayerNull', ], ], 'Pingback' => false, 'OriginTrials' => [ ], 'ReportToExpiry' => 86400, 'ReportToEndpoints' => [ ], 'FeaturePolicyReportOnly' => [ ], 'SkinsPreferred' => [ 'vector-2022', 'vector', ], 'SpecialContributeSkinsEnabled' => [ ], 'SpecialContributeNewPageTarget' => null, 'EnableEditRecovery' => false, 'EditRecoveryExpiry' => 2592000, 'UseCodexSpecialBlock' => false, 'ShowLogoutConfirmation' => false, 'EnableProtectionIndicators' => true, 'OutputPipelineStages' => [ ], 'FeatureShutdown' => [ ], 'UseLeximorph' => false, 'UsePostprocCacheLegacy' => false, 'UsePostprocCacheParsoid' => true, 'ParserOptionsLogUnsafeSampleRate' => 0, 'ReturnExperimentalPFragmentTypes' => [ ], 'UseParsoidLinksUpdate' => null, 'UseParsoidMessages' => false, 'UseParsoidParser' => true, 'SiteLookup' => [ ], ], 'type' => [ 'ConfigRegistry' => 'object', 'AssumeProxiesUseDefaultProtocolPorts' => 'boolean', 'ForceHTTPS' => 'boolean', 'ExtensionDirectory' => [ 'string', 'null', ], 'StyleDirectory' => [ 'string', 'null', ], 'UploadDirectory' => [ 'string', 'boolean', 'null', ], 'Logos' => [ 'object', 'boolean', ], 'ReferrerPolicy' => [ 'array', 'string', 'boolean', ], 'ActionPaths' => 'object', 'MainPageIsDomainRoot' => 'boolean', 'ImgAuthUrlPathMap' => 'object', 'LocalFileRepo' => 'object', 'ForeignFileRepos' => 'array', 'UseSharedUploads' => 'boolean', 'SharedUploadDirectory' => [ 'string', 'null', ], 'SharedUploadPath' => [ 'string', 'null', ], 'HashedSharedUploadDirectory' => 'boolean', 'FetchCommonsDescriptions' => 'boolean', 'SharedUploadDBname' => [ 'boolean', 'string', ], 'SharedUploadDBprefix' => 'string', 'SharedUploadDBschema' => [ 'string', 'null', ], 'CacheSharedUploads' => 'boolean', 'ForeignUploadTargets' => 'array', 'UploadDialog' => 'object', 'FileBackends' => 'object', 'LockManagers' => 'array', 'DefaultLockManager' => [ 'string', 'null', ], 'CopyUploadsDomains' => 'array', 'CopyUploadTimeout' => [ 'boolean', 'integer', ], 'SharedThumbnailScriptPath' => [ 'string', 'boolean', ], 'HashedUploadDirectory' => 'boolean', 'CSPUploadEntryPoint' => 'boolean', 'FileExtensions' => 'array', 'ProhibitedFileExtensions' => 'array', 'MimeTypeExclusions' => 'array', 'TrustedMediaFormats' => 'array', 'MediaHandlers' => 'object', 'NativeImageLazyLoading' => 'boolean', 'ParserTestMediaHandlers' => 'object', 'MaxInterlacingAreas' => 'object', 'SVGConverters' => 'object', 'SVGNativeRendering' => [ 'string', 'boolean', ], 'MaxImageArea' => [ 'string', 'integer', 'boolean', ], 'TiffThumbnailType' => 'array', 'GenerateThumbnailOnParse' => 'boolean', 'EnableAutoRotation' => [ 'boolean', 'null', ], 'Antivirus' => [ 'string', 'null', ], 'AntivirusSetup' => 'object', 'MimeDetectorCommand' => [ 'string', 'null', ], 'XMLMimeTypes' => 'object', 'ImageLimits' => 'array', 'ThumbLimits' => 'array', 'ThumbnailNamespaces' => 'array', 'ThumbnailSteps' => [ 'array', 'null', ], 'ThumbnailBuckets' => [ 'array', 'null', ], 'UploadThumbnailRenderMap' => 'object', 'GalleryOptions' => 'object', 'DjvuDump' => [ 'string', 'null', ], 'DjvuRenderer' => [ 'string', 'null', ], 'DjvuTxt' => [ 'string', 'null', ], 'DjvuPostProcessor' => [ 'string', 'null', ], 'SMTP' => [ 'boolean', 'object', ], 'EnotifFromEditor' => 'boolean', 'EmailConfirmationBanner' => 'boolean', 'EnotifRevealEditorAddress' => 'boolean', 'UsersNotifiedOnAllChanges' => 'object', 'DBmwschema' => [ 'string', 'null', ], 'SharedTables' => 'array', 'DBservers' => [ 'boolean', 'array', ], 'LBFactoryConf' => 'object', 'LocalDatabases' => 'array', 'VirtualDomainsMapping' => 'object', 'RemoteVirtualDomainsMapping' => 'object', 'FileSchemaMigrationStage' => 'integer', 'ExternalLinksDomainGaps' => 'object', 'ContentHandlers' => 'object', 'NamespaceContentModels' => 'object', 'TextModelsToParse' => 'array', 'ExternalStores' => 'array', 'ExternalServers' => 'object', 'DefaultExternalStore' => [ 'array', 'boolean', ], 'RevisionCacheExpiry' => 'integer', 'PageLanguageUseDB' => 'boolean', 'DiffEngine' => [ 'string', 'null', ], 'ExternalDiffEngine' => [ 'string', 'boolean', ], 'Wikidiff2Options' => 'object', 'RequestTimeLimit' => [ 'integer', 'null', ], 'CriticalSectionTimeLimit' => 'number', 'PoolCounterConf' => [ 'object', 'null', ], 'PoolCountClientConf' => 'object', 'MaxUserDBWriteDuration' => [ 'integer', 'boolean', ], 'MaxJobDBWriteDuration' => [ 'integer', 'boolean', ], 'MultiShardSiteStats' => 'boolean', 'ObjectCaches' => 'object', 'WANObjectCache' => 'object', 'MicroStashType' => [ 'string', 'integer', ], 'ParsoidCacheConfig' => 'object', 'ParsoidSelectiveUpdateSampleRate' => 'integer', 'SplitParsoidParserCache' => 'boolean', 'ParserCacheFilterConfig' => 'object', 'ChronologyProtectorSecret' => 'string', 'SuspiciousIpExpiry' => [ 'integer', 'boolean', ], 'MemCachedServers' => 'array', 'LocalisationCacheConf' => 'object', 'ExtensionInfoMTime' => [ 'integer', 'boolean', ], 'CdnServers' => 'object', 'CdnServersNoPurge' => 'object', 'HTCPRouting' => 'object', 'GrammarForms' => 'object', 'ExtraInterlanguageLinkPrefixes' => 'array', 'InterlanguageLinkCodeMap' => 'object', 'ExtraLanguageNames' => 'object', 'ExtraLanguageCodes' => 'object', 'DummyLanguageCodes' => 'object', 'DisabledVariants' => 'object', 'ForceUIMsgAsContentMsg' => 'object', 'RawHtmlMessages' => 'array', 'OverrideUcfirstCharacters' => 'object', 'XhtmlNamespaces' => 'object', 'BrowserFormatDetection' => 'string', 'SkinMetaTags' => 'object', 'SkipSkins' => 'object', 'FragmentMode' => 'array', 'FooterIcons' => 'object', 'PageShareSkinsEnabled' => 'array', 'InterwikiLogoOverride' => 'array', 'ResourceModules' => 'object', 'ResourceModuleSkinStyles' => 'object', 'ResourceLoaderSources' => 'object', 'ResourceLoaderMaxage' => 'object', 'ResourceLoaderMaxQueryLength' => [ 'integer', 'boolean', ], 'CanonicalNamespaceNames' => 'object', 'ExtraNamespaces' => 'object', 'ExtraGenderNamespaces' => 'object', 'NamespaceAliases' => 'object', 'CapitalLinkOverrides' => 'object', 'NamespacesWithSubpages' => 'object', 'NamespacesWithoutAutoSummaries' => 'array', 'ContentNamespaces' => 'array', 'ShortPagesNamespaceExclusions' => 'array', 'ExtraSignatureNamespaces' => 'array', 'InvalidRedirectTargets' => 'array', 'LocalInterwikis' => 'array', 'InterwikiCache' => [ 'boolean', 'object', ], 'SiteTypes' => 'object', 'UrlProtocols' => 'array', 'TidyConfig' => 'object', 'ParsoidSettings' => 'object', 'ParsoidExperimentalParserFunctionOutput' => 'boolean', 'NoFollowNsExceptions' => 'array', 'NoFollowDomainExceptions' => 'array', 'ExternalLinksIgnoreDomains' => 'array', 'EnableMagicLinks' => 'object', 'ManualRevertSearchRadius' => 'integer', 'RevertedTagMaxDepth' => 'integer', 'CentralIdLookupProviders' => 'object', 'CentralIdLookupProvider' => 'string', 'UserRegistrationProviders' => 'object', 'PasswordPolicy' => 'object', 'AuthManagerConfig' => [ 'object', 'null', ], 'AuthManagerAutoConfig' => 'object', 'RememberMe' => 'string', 'ReauthenticateTime' => 'object', 'ChangeCredentialsBlacklist' => 'array', 'RemoveCredentialsBlacklist' => 'array', 'PasswordConfig' => 'object', 'PasswordResetRoutes' => 'object', 'SignatureAllowedLintErrors' => 'array', 'ReservedUsernames' => 'array', 'DefaultUserOptions' => 'object', 'ConditionalUserOptions' => 'object', 'HiddenPrefs' => 'array', 'UserJsPrefLimit' => 'integer', 'AuthenticationTokenVersion' => [ 'string', 'null', ], 'SessionProviders' => 'object', 'AutoCreateTempUser' => 'object', 'AutoblockExemptions' => 'array', 'BlockCIDRLimit' => 'object', 'EnableMultiBlocks' => 'boolean', 'GroupPermissions' => 'object', 'PrivilegedGroups' => 'array', 'RevokePermissions' => 'object', 'GroupInheritsPermissions' => 'object', 'ImplicitGroups' => 'array', 'GroupsAddToSelf' => 'object', 'GroupsRemoveFromSelf' => 'object', 'RestrictedGroups' => 'object', 'UserRequirementsPrivateConditions' => 'array', 'RestrictionTypes' => 'array', 'RestrictionLevels' => 'array', 'CascadingRestrictionLevels' => 'array', 'SemiprotectedRestrictionLevels' => 'array', 'NamespaceProtection' => 'object', 'RestrictUserPageEditing' => 'boolean', 'NonincludableNamespaces' => 'object', 'Autopromote' => 'object', 'AutopromoteOnce' => 'object', 'AutopromoteOnceRCExcludedGroups' => 'array', 'AddGroups' => 'object', 'RemoveGroups' => 'object', 'AvailableRights' => 'array', 'ImplicitRights' => 'array', 'AccountCreationThrottle' => [ 'integer', 'array', ], 'TempAccountCreationThrottle' => 'array', 'TempAccountNameAcquisitionThrottle' => 'array', 'SpamRegex' => 'array', 'SummarySpamRegex' => 'array', 'DnsBlacklistUrls' => 'array', 'ProxyList' => [ 'string', 'array', ], 'ProxyWhitelist' => 'array', 'SoftBlockRanges' => 'array', 'RateLimits' => 'object', 'RateLimitsExcludedIPs' => 'array', 'ExternalQuerySources' => 'object', 'PasswordAttemptThrottle' => 'array', 'GrantPermissions' => 'object', 'GrantPermissionGroups' => 'object', 'GrantRiskGroups' => 'object', 'EnableBotPasswords' => 'boolean', 'BotPasswordsCluster' => [ 'string', 'boolean', ], 'BotPasswordsDatabase' => [ 'string', 'boolean', ], 'BotPasswordsLimit' => 'integer', 'ReauthenticateForActions' => 'object', 'CSPHeader' => [ 'boolean', 'object', ], 'CSPReportOnlyHeader' => [ 'boolean', 'object', ], 'CSPUseReportURIDirective' => [ 'boolean', 'object', ], 'CSPFalsePositiveUrls' => 'object', 'AllowCrossOrigin' => 'boolean', 'RestAllowCrossOriginCookieAuth' => 'boolean', 'CookieSameSite' => [ 'string', 'null', ], 'CacheVaryCookies' => 'array', 'DeviceBoundSessions' => 'boolean', 'DeviceBoundSessionsReportOnly' => 'boolean', 'DeviceBoundSessionCookieName' => 'string', 'DeviceBoundSessionCredentialTTL' => 'integer', 'DeviceBoundSessionChallengeTTL' => 'integer', 'DeviceBoundSessionBindingTTL' => 'integer', 'DeviceBoundSessionScopeExcludes' => 'array', 'TrxProfilerLimits' => 'object', 'DebugLogGroups' => 'object', 'MWLoggerDefaultSpi' => 'object', 'Profiler' => 'object', 'StatsTarget' => [ 'string', 'null', ], 'StatsFormat' => [ 'string', 'null', ], 'StatsPrefix' => 'string', 'OpenTelemetryConfig' => [ 'object', 'null', ], 'OpenSearchTemplates' => 'object', 'NamespacesToBeSearchedDefault' => 'object', 'SitemapNamespaces' => [ 'boolean', 'array', ], 'SitemapNamespacesPriorities' => [ 'boolean', 'object', ], 'SitemapApiConfig' => 'object', 'SpecialSearchFormOptions' => 'object', 'SearchMatchRedirectPreference' => 'boolean', 'SearchRunSuggestedQuery' => 'boolean', 'PreviewOnOpenNamespaces' => 'object', 'ReadOnlyWatchedItemStore' => 'boolean', 'GitRepositoryViewers' => 'object', 'InstallerInitialPages' => 'array', 'RCLinkLimits' => 'array', 'RCLinkDays' => 'array', 'RCFeeds' => 'object', 'OverrideSiteFeed' => 'object', 'FeedClasses' => 'object', 'AdvertisedFeedTypes' => 'array', 'SoftwareTags' => 'object', 'RestrictedTagViewRights' => 'object', 'RecentChangesFlags' => 'object', 'WatchlistExpiry' => 'boolean', 'EnableWatchstarPopover' => 'boolean', 'EnableWatchlistLabels' => 'boolean', 'WatchlistLabelsMaxPerUser' => 'integer', 'WatchlistPurgeRate' => 'number', 'WatchlistExpiryMaxDuration' => [ 'string', 'null', ], 'EnableChangesListQueryPartitioning' => 'boolean', 'ImportSources' => 'object', 'ExtensionFunctions' => 'array', 'ExtensionMessagesFiles' => 'object', 'MessagesDirs' => 'object', 'TranslationAliasesDirs' => 'object', 'ExtensionEntryPointListFiles' => 'object', 'ValidSkinNames' => 'object', 'SpecialPages' => 'object', 'ExtensionCredits' => 'object', 'Hooks' => 'object', 'ServiceWiringFiles' => 'array', 'JobClasses' => 'object', 'JobTypesExcludedFromDefaultQueue' => 'array', 'JobBackoffThrottling' => 'object', 'JobTypeConf' => 'object', 'SpecialPageCacheUpdates' => 'object', 'PagePropLinkInvalidations' => 'object', 'TempCategoryCollations' => 'array', 'SortedCategories' => 'boolean', 'TrackingCategories' => 'array', 'LogTypes' => 'array', 'LogRestrictions' => 'object', 'FilterLogTypes' => 'object', 'LogNames' => 'object', 'LogHeaders' => 'object', 'LogActions' => 'object', 'LogActionsHandlers' => 'object', 'ActionFilteredLogs' => 'object', 'WatchUserPageOnAccountCreation' => 'boolean', 'RangeContributionsCIDRLimit' => 'object', 'Actions' => 'object', 'NamespaceRobotPolicies' => 'object', 'ArticleRobotPolicies' => 'object', 'ExemptFromUserRobotsControl' => [ 'array', 'null', ], 'APIModules' => 'object', 'APIFormatModules' => 'object', 'APIMetaModules' => 'object', 'APIPropModules' => 'object', 'APIListModules' => 'object', 'APIUselessQueryPages' => 'array', 'CrossSiteAJAXdomains' => 'object', 'CrossSiteAJAXdomainExceptions' => 'object', 'AllowedCorsHeaders' => 'array', 'RestAPIAdditionalRouteFiles' => 'array', 'RestLocalModuleTestBaseUrl' => [ 'string', 'null', ], 'RestModuleOverrides' => 'object', 'RestExternalModules' => 'object', 'RestTermsOfServiceUrl' => [ 'string', 'null', ], 'ShellRestrictionMethod' => [ 'string', 'boolean', ], 'ShellboxUrls' => 'object', 'ShellboxSecretKey' => [ 'string', 'null', ], 'ShellboxShell' => [ 'string', 'null', ], 'HTTPTimeout' => 'number', 'HTTPConnectTimeout' => 'number', 'HTTPMaxTimeout' => 'number', 'HTTPMaxConnectTimeout' => 'number', 'HTTPUserAgentContact' => [ 'string', 'boolean', ], 'LocalVirtualHosts' => 'object', 'LocalHTTPProxy' => [ 'string', 'boolean', ], 'GenerateReqIDFormat' => 'string', 'EventRelayerConfig' => 'object', 'Pingback' => 'boolean', 'OriginTrials' => 'array', 'ReportToExpiry' => 'integer', 'ReportToEndpoints' => 'array', 'FeaturePolicyReportOnly' => 'array', 'SkinsPreferred' => 'array', 'SpecialContributeSkinsEnabled' => 'array', 'SpecialContributeNewPageTarget' => [ 'string', 'null', ], 'EnableEditRecovery' => 'boolean', 'EditRecoveryExpiry' => 'integer', 'UseCodexSpecialBlock' => 'boolean', 'ShowLogoutConfirmation' => 'boolean', 'EnableProtectionIndicators' => 'boolean', 'OutputPipelineStages' => 'object', 'FeatureShutdown' => 'array', 'UseLeximorph' => 'boolean', 'UsePostprocCacheLegacy' => 'boolean', 'UsePostprocCacheParsoid' => 'boolean', 'ParserOptionsLogUnsafeSampleRate' => 'integer', 'ReturnExperimentalPFragmentTypes' => 'array', 'UseParsoidLinksUpdate' => [ 'boolean', 'null', ], 'UseParsoidMessages' => [ 'boolean', 'null', ], 'UseParsoidParser' => 'boolean', 'SiteLookup' => 'object', ], 'mergeStrategy' => [ 'TiffThumbnailType' => 'replace', 'LBFactoryConf' => 'replace', 'InterwikiCache' => 'replace', 'PasswordPolicy' => 'array_replace_recursive', 'AuthManagerAutoConfig' => 'array_plus_2d', 'GroupPermissions' => 'array_plus_2d', 'RevokePermissions' => 'array_plus_2d', 'AddGroups' => 'array_merge_recursive', 'RemoveGroups' => 'array_merge_recursive', 'RateLimits' => 'array_plus_2d', 'GrantPermissions' => 'array_plus_2d', 'MWLoggerDefaultSpi' => 'replace', 'Profiler' => 'replace', 'Hooks' => 'array_merge_recursive', 'RestModuleOverrides' => 'array_replace_recursive', 'RestExternalModules' => 'array_replace_recursive', ], 'dynamicDefault' => [ 'UsePathInfo' => [ 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultUsePathInfo', ], ], 'Script' => [ 'use' => [ 'ScriptPath', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultScript', ], ], 'LoadScript' => [ 'use' => [ 'ScriptPath', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultLoadScript', ], ], 'RestPath' => [ 'use' => [ 'ScriptPath', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultRestPath', ], ], 'StylePath' => [ 'use' => [ 'ResourceBasePath', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultStylePath', ], ], 'LocalStylePath' => [ 'use' => [ 'ScriptPath', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultLocalStylePath', ], ], 'ExtensionAssetsPath' => [ 'use' => [ 'ResourceBasePath', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultExtensionAssetsPath', ], ], 'ArticlePath' => [ 'use' => [ 'Script', 'UsePathInfo', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultArticlePath', ], ], 'UploadPath' => [ 'use' => [ 'ScriptPath', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultUploadPath', ], ], 'FileCacheDirectory' => [ 'use' => [ 'UploadDirectory', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultFileCacheDirectory', ], ], 'Logo' => [ 'use' => [ 'ResourceBasePath', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultLogo', ], ], 'DeletedDirectory' => [ 'use' => [ 'UploadDirectory', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultDeletedDirectory', ], ], 'ShowEXIF' => [ 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultShowEXIF', ], ], 'SharedPrefix' => [ 'use' => [ 'DBprefix', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultSharedPrefix', ], ], 'SharedSchema' => [ 'use' => [ 'DBmwschema', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultSharedSchema', ], ], 'DBerrorLogTZ' => [ 'use' => [ 'Localtimezone', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultDBerrorLogTZ', ], ], 'Localtimezone' => [ 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultLocaltimezone', ], ], 'LocalTZoffset' => [ 'use' => [ 'Localtimezone', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultLocalTZoffset', ], ], 'ResourceBasePath' => [ 'use' => [ 'ScriptPath', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultResourceBasePath', ], ], 'MetaNamespace' => [ 'use' => [ 'Sitename', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultMetaNamespace', ], ], 'CookieSecure' => [ 'use' => [ 'ForceHTTPS', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultCookieSecure', ], ], 'CookiePrefix' => [ 'use' => [ 'SharedDB', 'SharedPrefix', 'SharedTables', 'DBname', 'DBprefix', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultCookiePrefix', ], ], 'ReadOnlyFile' => [ 'use' => [ 'UploadDirectory', ], 'callback' => [ 'MediaWiki\\MainConfigSchema', 'getDefaultReadOnlyFile', ], ], ], ], 'config-schema' => [ 'UploadStashScalerBaseUrl' => [ 'deprecated' => 'since 1.36 Use thumbProxyUrl in $wgLocalFileRepo', ], 'IllegalFileChars' => [ 'deprecated' => 'since 1.41; no longer customizable', ], 'ThumbnailNamespaces' => [ 'items' => [ 'type' => 'integer', ], ], 'LocalDatabases' => [ 'items' => [ 'type' => 'string', ], ], 'ParserCacheFilterConfig' => [ 'additionalProperties' => [ 'type' => 'object', 'description' => 'A map of namespace IDs to filter definitions.', 'additionalProperties' => [ 'type' => 'object', 'description' => 'A map of filter names to values.', 'properties' => [ 'minCpuTime' => [ 'type' => 'number', ], ], ], ], ], 'RawHtmlMessages' => [ 'items' => [ 'type' => 'string', ], ], 'InterwikiLogoOverride' => [ 'items' => [ 'type' => 'string', ], ], 'LegalTitleChars' => [ 'deprecated' => 'since 1.41; use Extension:TitleBlacklist to customize', ], 'ReauthenticateTime' => [ 'additionalProperties' => [ 'type' => [ 'integer', 'array', ], ], ], 'ChangeCredentialsBlacklist' => [ 'items' => [ 'type' => 'string', ], ], 'RemoveCredentialsBlacklist' => [ 'items' => [ 'type' => 'string', ], ], 'GroupPermissions' => [ 'additionalProperties' => [ 'type' => 'object', 'additionalProperties' => [ 'type' => 'boolean', ], ], ], 'GroupInheritsPermissions' => [ 'additionalProperties' => [ 'type' => 'string', ], ], 'AvailableRights' => [ 'items' => [ 'type' => 'string', ], ], 'ImplicitRights' => [ 'items' => [ 'type' => 'string', ], ], 'SoftBlockRanges' => [ 'items' => [ 'type' => 'string', ], ], 'ExternalQuerySources' => [ 'additionalProperties' => [ 'type' => 'object', 'properties' => [ 'enabled' => [ 'type' => 'boolean', 'default' => false, ], 'url' => [ 'type' => 'string', 'format' => 'uri', ], 'timeout' => [ 'type' => 'integer', 'default' => 10, ], ], 'required' => [ 'enabled', 'url', ], 'additionalProperties' => false, ], ], 'GrantPermissions' => [ 'additionalProperties' => [ 'type' => 'object', 'additionalProperties' => [ 'type' => 'boolean', ], ], ], 'GrantPermissionGroups' => [ 'additionalProperties' => [ 'type' => 'string', ], ], 'SitemapNamespacesPriorities' => [ 'deprecated' => 'since 1.45 and ignored', ], 'SitemapApiConfig' => [ 'additionalProperties' => [ 'enabled' => [ 'type' => 'bool', ], 'sitemapsPerIndex' => [ 'type' => 'int', ], 'pagesPerSitemap' => [ 'type' => 'int', ], 'expiry' => [ 'type' => 'int', ], 'skipRedirects' => [ 'type' => 'bool', ], ], ], 'SoftwareTags' => [ 'additionalProperties' => [ 'type' => 'boolean', ], ], 'UseCopyrightUpload' => [ 'deprecated' => 'since 1.47 This feature is being removed.', ], 'JobBackoffThrottling' => [ 'additionalProperties' => [ 'type' => 'number', ], ], 'JobTypeConf' => [ 'additionalProperties' => [ 'type' => 'object', 'properties' => [ 'class' => [ 'type' => 'string', ], 'order' => [ 'type' => 'string', ], 'claimTTL' => [ 'type' => 'integer', ], ], ], ], 'TrackingCategories' => [ 'deprecated' => 'since 1.25 Extensions should now register tracking categories using the new extension registration system.', ], 'RangeContributionsCIDRLimit' => [ 'additionalProperties' => [ 'type' => 'integer', ], ], 'RestModuleOverrides' => [ 'additionalProperties' => [ 'type' => 'object', 'properties' => [ 'availability' => [ 'type' => 'string', ], 'groups' => [ 'type' => 'array', ], ], ], ], 'RestExternalModules' => [ 'additionalProperties' => [ 'type' => 'object', 'properties' => [ 'info' => [ 'type' => 'object', 'properties' => [ 'version' => [ 'type' => 'string', ], 'title' => [ 'type' => 'string', ], 'x-i18n-title' => [ 'type' => 'string', ], 'description' => [ 'type' => 'string', ], 'x-i18n-description' => [ 'type' => 'string', ], ], 'required' => [ 'version', ], ], 'base' => [ 'type' => 'string', 'format' => 'uri', ], 'spec' => [ 'type' => 'string', 'format' => 'uri', ], ], 'required' => [ 'info', 'base', 'spec', ], ], ], 'ShellboxUrls' => [ 'additionalProperties' => [ 'type' => [ 'string', 'boolean', 'null', ], ], ], ], 'obsolete-config' => [ 'MangleFlashPolicy' => 'Since 1.39; no longer has any effect.', 'EnableOpenSearchSuggest' => 'Since 1.35, no longer used', 'AutoloadAttemptLowercase' => 'Since 1.40; no longer has any effect.', ],]
Interface for configuration instances.
Definition Config.php:18
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".
Content objects represent page content, e.g.
Definition Content.php:28
Interface for objects which can provide a MediaWiki context on request.
Data record representing a page that is (or used to be, or could be) an editable page on a wiki.
Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki.
getNamespace()
Returns the page's namespace number.
getDBkey()
Get the page title in DB key form.
MediaWiki\Session entry point interface.
element(SerializerNode $parent, SerializerNode $node, $contents)
ParserOutputFlags
Registry of flags used with ParserOutput::{get,set}OutputFlag() within MediaWiki core.
msg( $key,... $params)