29use Wikimedia\WrappedString;
30use Wikimedia\WrappedStringList;
276 'Accept-Encoding' => [
'match=gzip' ],
347 public function redirect( $url, $responsecode =
'302' ) {
348 # Strip newlines as a paranoia check for header injection in PHP<5.1.2
349 $this->mRedirect = str_replace(
"\n",
'', $url );
350 $this->mRedirectCode = $responsecode;
359 return $this->mRedirect;
371 $this->copyrightUrl = $url;
380 $this->mStatusCode = $statusCode;
391 array_push( $this->mMetatags, [
$name, $val ] );
401 return $this->mMetatags;
412 array_push( $this->mLinktags, $linkarr );
422 return $this->mLinktags;
431 $this->mCanonicalUrl = $url;
442 return $this->mCanonicalUrl;
453 $this->mScripts .= $script;
465 if ( substr( $file, 0, 1 ) !==
'/' && !preg_match(
'#^[a-z]*://#i', $file ) ) {
482 $this->mScripts .= Html::inlineScript(
"\n$script\n", $this->
getCSPNonce() ) .
"\n";
497 $filteredModules = [];
503 if ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) ) {
507 $filteredModules[] = $val;
510 return $filteredModules;
514 static $warnings = [];
515 if ( isset( $warnings[$this->mTarget][$moduleName] ) ) {
518 $warnings[$this->mTarget][$moduleName] =
true;
520 'Module "{module}" not loadable on target "{target}".',
522 'module' => $moduleName,
523 'target' => $this->mTarget,
537 public function getModules( $filter =
false, $position =
null, $param =
'mModules',
540 $modules = array_values( array_unique( $this->$param ) );
552 $this->mModules = array_merge( $this->mModules, (
array)
$modules );
563 return $this->
getModules( $filter,
null,
'mModuleScripts',
579 $this->mModuleScripts = array_merge( $this->mModuleScripts, (
array)
$modules );
590 return $this->
getModules( $filter,
null,
'mModuleStyles',
605 $this->mModuleStyles = array_merge( $this->mModuleStyles, (
array)
$modules );
612 return $this->mTarget;
621 $this->mTarget = $target;
632 if ( !$this->contentOverrides ) {
636 return $this->contentOverrides[$key] ??
null;
641 $this->contentOverrides[$key] =
$content;
652 $this->contentOverrideCallbacks[] = $callback;
661 return $this->mHeadItems;
687 $this->mHeadItems = array_merge( $this->mHeadItems, (
array)$values );
697 return isset( $this->mHeadItems[
$name] );
707 $this->mAdditionalBodyClasses = array_merge( $this->mAdditionalBodyClasses, (
array)$classes );
718 $this->mArticleBodyOnly = $only;
727 return $this->mArticleBodyOnly;
749 return $this->mProperties[
$name] ??
null;
764 if ( !$timestamp || $timestamp ==
'19700101000000' ) {
765 wfDebug( __METHOD__ .
": CACHE DISABLED, NO TIMESTAMP\n" );
769 if ( !$config->get(
'CachePages' ) ) {
770 wfDebug( __METHOD__ .
": CACHE DISABLED\n" );
776 'page' => $timestamp,
777 'user' => $this->
getUser()->getTouched(),
778 'epoch' => $config->get(
'CacheEpoch' )
780 if ( $config->get(
'UseSquid' ) ) {
783 $config->get(
'SquidMaxage' )
786 Hooks::run(
'OutputPageCheckLastModified', [ &$modifiedTimes, $this ] );
788 $maxModified = max( $modifiedTimes );
789 $this->mLastModified =
wfTimestamp( TS_RFC2822, $maxModified );
791 $clientHeader = $this->
getRequest()->getHeader(
'If-Modified-Since' );
792 if ( $clientHeader ===
false ) {
793 wfDebug( __METHOD__ .
": client did not send If-Modified-Since header",
'private' );
797 # IE sends sizes after the date like this:
798 # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
799 # this breaks strtotime().
800 $clientHeader = preg_replace(
'/;.*$/',
'', $clientHeader );
802 Wikimedia\suppressWarnings();
803 $clientHeaderTime = strtotime( $clientHeader );
804 Wikimedia\restoreWarnings();
805 if ( !$clientHeaderTime ) {
807 .
": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
810 $clientHeaderTime =
wfTimestamp( TS_MW, $clientHeaderTime );
815 if ( $info !==
'' ) {
821 wfDebug( __METHOD__ .
": client sent If-Modified-Since: " .
822 wfTimestamp( TS_ISO_8601, $clientHeaderTime ),
'private' );
823 wfDebug( __METHOD__ .
": effective Last-Modified: " .
824 wfTimestamp( TS_ISO_8601, $maxModified ),
'private' );
825 if ( $clientHeaderTime < $maxModified ) {
826 wfDebug( __METHOD__ .
": STALE, $info",
'private' );
831 # Give a 304 Not Modified response code and disable body output
832 wfDebug( __METHOD__ .
": NOT MODIFIED, $info",
'private' );
833 ini_set(
'zlib.output_compression', 0 );
834 $this->
getRequest()->response()->statusHeader( 304 );
856 return $reqTime - $maxAge;
866 $this->mLastModified =
wfTimestamp( TS_RFC2822, $timestamp );
880 if ( isset( $policy[
'index'] ) ) {
883 if ( isset( $policy[
'follow'] ) ) {
896 $policy = trim( $policy );
897 if ( in_array( $policy, [
'index',
'noindex' ] ) ) {
898 $this->mIndexPolicy = $policy;
910 $policy = trim( $policy );
911 if ( in_array( $policy, [
'follow',
'nofollow' ] ) ) {
912 $this->mFollowPolicy = $policy;
926 $this->mHTMLtitle =
$name;
936 return $this->mHTMLtitle;
945 $this->mRedirectedFrom =
$t;
963 # change "<script>foo&bar</script>" to "<script>foo&bar</script>"
964 # but leave "<i>foobar</i>" alone
965 $nameWithTags = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags(
$name ) );
966 $this->mPageTitle = $nameWithTags;
968 # change "<i>foo&bar</i>" to "foo&bar"
970 $this->
msg(
'pagetitle' )->rawParams( Sanitizer::stripAllTags( $nameWithTags ) )
971 ->inContentLanguage()
981 return $this->mPageTitle;
992 $this->displayTitle =
$html;
1004 $html = $this->displayTitle;
1005 if (
$html ===
null ) {
1009 return Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags(
$html ) );
1020 $nsPrefix = $this->
getTitle()->getNsText() .
':';
1021 $prefix = preg_quote( $nsPrefix,
'/' );
1023 return preg_replace(
"/^$prefix/i",
'', $text );
1051 if ( $str instanceof
Message ) {
1052 $this->mSubtitle[] = $str->setContext( $this->
getContext() )->parse();
1054 $this->mSubtitle[] = $str;
1067 if (
$title->isRedirect() ) {
1068 $query[
'redirect'] =
'no';
1070 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
1089 $this->mSubtitle = [];
1098 return implode(
"<br />\n\t\t\t\t", $this->mSubtitle );
1106 $this->mPrintable =
true;
1115 return $this->mPrintable;
1122 $this->mDoNothing =
true;
1131 return $this->mDoNothing;
1140 return $this->mNewSectionLink;
1149 return $this->mHideNewSectionLink;
1164 $this->mFeedLinks = [];
1178 $this->mFeedLinks = [];
1182 if ( is_string( $val ) ) {
1196 if ( in_array( $format, $this->
getConfig()->
get(
'AdvertisedFeedTypes' ) ) ) {
1197 $this->mFeedLinks[$format] = $href;
1206 return count( $this->mFeedLinks ) > 0;
1214 return $this->mFeedLinks;
1223 return $this->mFeedLinksAppendQuery;
1234 $this->mIsArticle = $newVal;
1236 $this->mIsArticleRelated = $newVal;
1247 return $this->mIsArticle;
1257 $this->mIsArticleRelated = $newVal;
1259 $this->mIsArticle =
false;
1269 return $this->mIsArticleRelated;
1278 $this->mHasCopyright = $hasCopyright;
1291 return $this->
isArticle() || $this->mHasCopyright;
1301 $this->mLanguageLinks = array_merge( $this->mLanguageLinks, $newLinkArray );
1311 $this->mLanguageLinks = $newLinkArray;
1320 return $this->mLanguageLinks;
1329 if ( !$categories ) {
1335 # Set all the values to 'normal'.
1336 $categories = array_fill_keys( array_keys( $categories ),
'normal' );
1338 # Mark hidden categories
1339 foreach (
$res as $row ) {
1340 if ( isset( $row->pp_value ) ) {
1341 $categories[$row->page_title] =
'hidden';
1346 $outputPage = $this;
1347 # Add the remaining categories to the skin
1349 'OutputPageMakeCategoryLinks',
1350 [ &$outputPage, $categories, &$this->mCategoryLinks ] )
1352 $services = MediaWikiServices::getInstance();
1354 foreach ( $categories
as $category =>
$type ) {
1356 $category = (
string)$category;
1357 $origcategory = $category;
1362 $services->getContentLanguage()->findVariantLink( $category,
$title,
true );
1363 if ( $category != $origcategory && array_key_exists( $category, $categories ) ) {
1366 $text =
$services->getContentLanguage()->convertHtml(
$title->getText() );
1378 # Add the links to a LinkBatch
1383 # Fetch existence plus the hiddencat property
1385 $fields = array_merge(
1386 LinkCache::getSelectFields(),
1387 [
'page_namespace',
'page_title',
'pp_value' ]
1390 $res =
$dbr->select( [
'page',
'page_props' ],
1392 $lb->constructSet(
'page',
$dbr ),
1395 [
'page_props' => [
'LEFT JOIN', [
1396 'pp_propname' =>
'hiddencat',
1401 # Add the results to the link cache
1402 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
1403 $lb->addResultToCache( $linkCache,
$res );
1414 $this->mCategoryLinks = [];
1427 return $this->mCategoryLinks;
1440 if (
$type ===
'all' ) {
1441 $allCategories = [];
1442 foreach ( $this->mCategories
as $categories ) {
1443 $allCategories = array_merge( $allCategories, $categories );
1445 return $allCategories;
1447 if ( !isset( $this->mCategories[
$type] ) ) {
1448 throw new InvalidArgumentException(
'Invalid category type given: ' .
$type );
1450 return $this->mCategories[
$type];
1463 $this->mIndicators = $indicators + $this->mIndicators;
1465 ksort( $this->mIndicators );
1477 return $this->mIndicators;
1490 $text = $this->
msg(
'helppage-top-gethelp' )->escaped();
1492 if ( $overrideBaseUrl ) {
1495 $toUrlencoded =
wfUrlencode( str_replace(
' ',
'_', $to ) );
1496 $helpUrl =
"//www.mediawiki.org/wiki/Special:MyLanguage/$toUrlencoded";
1499 $link = Html::rawElement(
1503 'target' =>
'_blank',
1504 'class' =>
'mw-helplink',
1528 if ( $this->
getConfig()->
get(
'AllowSiteCSSOnRestrictedPages' ) ) {
1547 return min( array_values( $this->mAllowedModules ) );
1572 $this->mBodytext = $text . $this->mBodytext;
1581 $this->mBodytext .= $text;
1601 $this->mBodytext =
'';
1610 return $this->mBodytext;
1622 wfDeprecated( __METHOD__ .
' with non-null $options',
'1.31' );
1628 $anonPO = ParserOptions::newFromAnon();
1629 $anonPO->setAllowUnsafeRawHtml(
false );
1630 if ( !
$options->matches( $anonPO ) ) {
1636 if ( !$this->mParserOptions ) {
1641 $po = ParserOptions::newFromAnon();
1642 $po->setAllowUnsafeRawHtml(
false );
1643 $po->isBogus =
true;
1650 $this->mParserOptions = ParserOptions::newFromContext( $this->
getContext() );
1651 $this->mParserOptions->setAllowUnsafeRawHtml(
false );
1657 return wfSetVar( $this->mParserOptions,
null,
true );
1671 $val = is_null( $revid ) ? null : intval( $revid );
1672 return wfSetVar( $this->mRevisionId, $val,
true );
1681 return $this->mRevisionId;
1692 return wfSetVar( $this->mRevisionTimestamp, $timestamp,
true );
1702 return $this->mRevisionTimestamp;
1713 if ( $file instanceof
File && $file->
exists() ) {
1714 $val = [
'time' => $file->getTimestamp(),
'sha1' => $file->getSha1() ];
1716 return wfSetVar( $this->mFileVersion, $val,
true );
1725 return $this->mFileVersion;
1735 return $this->mTemplateIds;
1745 return $this->mImageTimeKeys;
1760 public function addWikiText( $text, $linestart =
true, $interface =
true ) {
1785 $text, $linestart =
true,
Title $title =
null
1810 $wrapperClass, $text
1835 $text, $linestart =
true,
Title $title =
null
1912 $tidy =
false, $interface =
false
1935 $text,
Title $title, $linestart, $tidy, $interface, $wrapperClass =
null
1938 $text,
$title, $linestart, $tidy, $interface,
null
1942 'enableSectionEditLinks' =>
false,
1943 'wrapperDivClass' => $wrapperClass ??
'',
1956 $this->mLanguageLinks =
1967 $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->
getHeadItems() );
1972 $this->mPreventClickjacking = $this->mPreventClickjacking
1977 if ( isset( $this->mTemplateIds[$ns] ) ) {
1978 $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1980 $this->mTemplateIds[$ns] = $dbks;
1985 $this->mImageTimeKeys[$dbk] = $data;
1989 $parserOutputHooks = $this->
getConfig()->get(
'ParserOutputHooks' );
1991 list( $hookName, $data ) = $hookInfo;
1992 if ( isset( $parserOutputHooks[$hookName] ) ) {
1993 $parserOutputHooks[$hookName]( $this, $parserOutput, $data );
2003 if ( !$this->limitReportJSData ) {
2011 $outputPage = $this;
2012 Hooks::run(
'LanguageLinks', [ $this->
getTitle(), &$this->mLanguageLinks, &$linkFlags ] );
2013 Hooks::runWithoutAbort(
'OutputPageParserOutput', [ &$outputPage, $parserOutput ] );
2020 $this->mEnableTOC =
true;
2050 $text = $parserOutput->
getText( $poOptions );
2052 $outputPage = $this;
2053 Hooks::runWithoutAbort(
'OutputPageBeforeHTML', [ &$outputPage, &$text ] );
2095 public function parse( $text, $linestart =
true, $interface =
false, $language =
null ) {
2097 $text, $this->
getTitle(), $linestart,
false, $interface, $language
2099 'enableSectionEditLinks' =>
false,
2116 $text, $this->
getTitle(), $linestart,
true,
false,
null
2118 'enableSectionEditLinks' =>
false,
2119 'wrapperDivClass' =>
''
2137 $text, $this->
getTitle(), $linestart,
true,
true,
null
2139 'enableSectionEditLinks' =>
false,
2140 'wrapperDivClass' =>
''
2159 return Parser::stripOuterParagraph(
2177 public function parseInline( $text, $linestart =
true, $interface =
false ) {
2179 $text, $this->
getTitle(), $linestart,
false, $interface,
null
2181 'enableSectionEditLinks' =>
false,
2182 'wrapperDivClass' =>
'',
2184 return Parser::stripOuterParagraph( $parsed );
2201 private function parseInternal( $text, $title, $linestart, $tidy, $interface, $language ) {
2204 if ( is_null(
$title ) ) {
2205 throw new MWException(
'Empty $mTitle in ' . __METHOD__ );
2209 $oldTidy = $popts->setTidy( $tidy );
2210 $oldInterface = $popts->setInterfaceMessage( (
bool)$interface );
2212 if ( $language !==
null ) {
2213 $oldLang = $popts->setTargetLanguage( $language );
2216 $parserOutput =
$wgParser->getFreshParser()->parse(
2218 $linestart,
true, $this->mRevisionId
2221 $popts->setTidy( $oldTidy );
2222 $popts->setInterfaceMessage( $oldInterface );
2224 if ( $language !==
null ) {
2225 $popts->setTargetLanguage( $oldLang );
2228 return $parserOutput;
2237 $this->mCdnMaxage = min( $maxage, $this->mCdnMaxageLimit );
2250 $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
2267 $minTTL = $minTTL ?: IExpiringStore::TTL_MINUTE;
2268 $maxTTL = $maxTTL ?: $this->
getConfig()->get(
'SquidMaxage' );
2270 if ( $mtime ===
null || $mtime ===
false ) {
2274 $age = MWTimestamp::time() -
wfTimestamp( TS_UNIX, $mtime );
2275 $adaptiveTTL = max( 0.9 * $age, $minTTL );
2276 $adaptiveTTL = min( $adaptiveTTL, $maxTTL );
2289 return wfSetVar( $this->mEnableClientCache, $state );
2298 if ( self::$cacheVaryCookies ===
null ) {
2300 self::$cacheVaryCookies = array_values( array_unique( array_merge(
2301 SessionManager::singleton()->getVaryCookies(),
2305 $config->get(
'CacheVaryCookies' )
2307 Hooks::run(
'GetCacheVaryCookies', [ $this, &self::$cacheVaryCookies ] );
2309 return self::$cacheVaryCookies;
2321 if (
$request->getCookie( $cookieName,
'',
'' ) !==
'' ) {
2322 wfDebug( __METHOD__ .
": found $cookieName\n" );
2326 wfDebug( __METHOD__ .
": no cache-varying cookies found\n" );
2339 if ( !array_key_exists(
$header, $this->mVaryHeader ) ) {
2340 $this->mVaryHeader[
$header] = [];
2342 if ( !is_array( $option ) ) {
2346 array_unique( array_merge( $this->mVaryHeader[
$header], $option ) );
2361 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2364 return 'Vary: ' . implode(
', ', array_keys( $this->mVaryHeader ) );
2373 $this->mLinkHeader[] =
$header;
2382 if ( !$this->mLinkHeader ) {
2386 return 'Link: ' . implode(
',', $this->mLinkHeader );
2401 $cookiesOption = [];
2402 foreach ( $cvCookies
as $cookieName ) {
2403 $cookiesOption[] =
'param=' . $cookieName;
2407 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2412 foreach ( $this->mVaryHeader
as $header => $option ) {
2414 if ( is_array( $option ) && count( $option ) > 0 ) {
2415 $newheader .=
';' . implode(
';', $option );
2417 $headers[] = $newheader;
2419 $key =
'Key: ' . implode(
',', $headers );
2438 if ( !$this->
getRequest()->getCheck(
'variant' ) &&
$lang->hasVariants() ) {
2439 $variants =
$lang->getVariants();
2441 foreach ( $variants
as $variant ) {
2442 if ( $variant ===
$lang->getCode() ) {
2456 $aloption[] =
"substr=$variant";
2460 $variantBCP47 = LanguageCode::bcp47( $variant );
2461 if ( $variantBCP47 !== $variant ) {
2462 $aloption[] =
"substr=$variantBCP47";
2480 $this->mPreventClickjacking = $enable;
2489 $this->mPreventClickjacking =
false;
2499 return $this->mPreventClickjacking;
2511 if ( $config->get(
'BreakFrames' ) ) {
2513 } elseif ( $this->mPreventClickjacking && $config->get(
'EditPageFrameOptions' ) ) {
2514 return $config->get(
'EditPageFrameOptions' );
2529 # don't serve compressed data to clients who can't handle it
2530 # maintain different caches for logged-in users and non-logged in ones
2533 if ( $config->get(
'UseKeyHeader' ) ) {
2537 if ( $this->mEnableClientCache ) {
2539 $config->get(
'UseSquid' ) &&
2541 !SessionManager::getGlobalSession()->isPersistent() &&
2542 !$this->isPrintable() &&
2543 $this->mCdnMaxage != 0 &&
2544 !$this->haveCacheVaryCookies()
2546 if ( $config->get(
'UseESI' ) ) {
2547 # We'll purge the proxy cache explicitly, but require end user agents
2548 # to revalidate against the proxy on each visit.
2549 # Surrogate-Control controls our CDN, Cache-Control downstream caches
2551 ": proxy caching with ESI; {$this->mLastModified} **",
'private' );
2552 # start with a shorter timeout for initial testing
2553 # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
2555 "Surrogate-Control: max-age={$config->get( 'SquidMaxage' )}" .
2556 "+{$this->mCdnMaxage}, content=\"ESI/1.0\""
2558 $response->header(
'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
2560 # We'll purge the proxy cache for anons explicitly, but require end user agents
2561 # to revalidate against the proxy on each visit.
2562 # IMPORTANT! The CDN needs to replace the Cache-Control header with
2563 # Cache-Control: s-maxage=0, must-revalidate, max-age=0
2565 ": local proxy caching; {$this->mLastModified} **",
'private' );
2566 # start with a shorter timeout for initial testing
2567 # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
2569 "s-maxage={$this->mCdnMaxage}, must-revalidate, max-age=0" );
2572 # We do want clients to cache if they can, but they *must* check for updates
2573 # on revisiting the page.
2574 wfDebug( __METHOD__ .
": private caching; {$this->mLastModified} **",
'private' );
2575 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
2576 $response->header(
"Cache-Control: private, must-revalidate, max-age=0" );
2578 if ( $this->mLastModified ) {
2579 $response->header(
"Last-Modified: {$this->mLastModified}" );
2582 wfDebug( __METHOD__ .
": no caching **",
'private' );
2584 # In general, the absence of a last modified header should be enough to prevent
2585 # the client from using its cache. We send a few other things just to make sure.
2586 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
2587 $response->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2588 $response->header(
'Pragma: no-cache' );
2598 foreach ( $sk->getDefaultModules()
as $group =>
$modules ) {
2599 if ( $group ===
'styles' ) {
2600 foreach (
$modules as $key => $moduleMembers ) {
2620 if ( $this->mDoNothing ) {
2621 return $return ?
'' :
null;
2627 if ( $this->mRedirect !=
'' ) {
2628 # Standards require redirect URLs to be absolute
2631 $redirect = $this->mRedirect;
2632 $code = $this->mRedirectCode;
2634 if ( Hooks::run(
"BeforePageRedirect", [ $this, &$redirect, &
$code ] ) ) {
2636 if ( !$config->get(
'DebugRedirects' ) ) {
2641 if ( $config->get(
'VaryOnXFP' ) ) {
2646 $response->header(
"Content-Type: text/html; charset=utf-8" );
2647 if ( $config->get(
'DebugRedirects' ) ) {
2648 $url = htmlspecialchars( $redirect );
2649 print "<!DOCTYPE html>\n<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2650 print "<p>Location: <a href=\"$url\">$url</a></p>\n";
2651 print "</body>\n</html>\n";
2653 $response->header(
'Location: ' . $redirect );
2657 return $return ?
'' :
null;
2658 } elseif ( $this->mStatusCode ) {
2659 $response->statusHeader( $this->mStatusCode );
2662 # Buffer output; final headers may depend on later processing
2665 $response->header(
'Content-type: ' . $config->get(
'MimeType' ) .
'; charset=UTF-8' );
2666 $response->header(
'Content-language: ' .
2667 MediaWikiServices::getInstance()->getContentLanguage()->getHtmlCode() );
2669 if ( !$this->mArticleBodyOnly ) {
2674 if ( $linkHeader ) {
2680 if ( $frameOptions ) {
2681 $response->header(
"X-Frame-Options: $frameOptions" );
2686 if ( $this->mArticleBodyOnly ) {
2687 echo $this->mBodytext;
2690 if ( $this->
getRequest()->getBool(
'safemode' ) ) {
2697 MWDebug::addModules( $this );
2700 $outputPage = $this;
2703 Hooks::runWithoutAbort(
'BeforePageDisplay', [ &$outputPage, &$sk ] );
2707 }
catch ( Exception
$e ) {
2715 Hooks::runWithoutAbort(
'AfterFinalPageOutput', [ $this ] );
2716 }
catch ( Exception
$e ) {
2724 return ob_get_clean();
2743 if ( $htmlTitle !==
false ) {
2749 $this->mRedirect =
'';
2773 if ( $msg instanceof
Message ) {
2775 trigger_error(
'Argument ignored: $params. The message parameters argument '
2776 .
'is discarded when the $msg argument is a Message object instead of '
2777 .
'a string.', E_USER_NOTICE );
2779 $this->
addHTML( $msg->parseAsBlock() );
2794 foreach ( $errors
as $key => $error ) {
2795 $errors[$key] = (
array)$error;
2803 if ( in_array( $action, [
'read',
'edit',
'createpage',
'createtalk',
'upload' ] )
2804 && $this->
getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2805 && ( $errors[0][0] ==
'badaccess-groups' || $errors[0][0] ==
'badaccess-group0' )
2809 $displayReturnto =
null;
2811 # Due to T34276, if a user does not have read permissions,
2812 # $this->getTitle() will just give Special:Badtitle, which is
2813 # not especially useful as a returnto parameter. Use the title
2814 # from the request instead, if there was one.
2816 $returnto = Title::newFromText(
$request->getVal(
'title',
'' ) );
2817 if ( $action ==
'edit' ) {
2818 $msg =
'whitelistedittext';
2819 $displayReturnto = $returnto;
2820 } elseif ( $action ==
'createpage' || $action ==
'createtalk' ) {
2821 $msg =
'nocreatetext';
2822 } elseif ( $action ==
'upload' ) {
2823 $msg =
'uploadnologintext';
2825 $msg =
'loginreqpagetext';
2826 $displayReturnto = Title::newMainPage();
2832 $query[
'returnto'] = $returnto->getPrefixedText();
2835 $returntoquery =
$request->getValues();
2836 unset( $returntoquery[
'title'] );
2837 unset( $returntoquery[
'returnto'] );
2838 unset( $returntoquery[
'returntoquery'] );
2842 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
2844 SpecialPage::getTitleFor(
'Userlogin' ),
2845 $this->
msg(
'loginreqlink' )->
text(),
2851 $this->
addHTML( $this->
msg( $msg )->rawParams( $loginLink )->
parse() );
2853 # Don't return to a page the user can't read otherwise
2854 # we'll end up in a pointless loop
2855 if ( $displayReturnto && $displayReturnto->userCan(
'read', $this->getUser() ) ) {
2873 $this->
addWikiMsg(
'versionrequiredtext', $version );
2885 if ( $action ==
null ) {
2886 $text = $this->
msg(
'permissionserrorstext', count( $errors ) )->plain() .
"\n\n";
2888 $action_desc = $this->
msg(
"action-$action" )->plain();
2890 'permissionserrorstext-withaction',
2893 )->plain() .
"\n\n";
2896 if ( count( $errors ) > 1 ) {
2897 $text .=
'<ul class="permissions-errors">' .
"\n";
2899 foreach ( $errors
as $error ) {
2901 $text .= $this->
msg( ...$error )->plain();
2906 $text .=
"<div class=\"permissions-errors\">\n" .
2907 $this->
msg( ...reset( $errors ) )->plain() .
2925 if ( $lag >= $config->get(
'SlaveLagWarning' ) ) {
2926 $lag = floor( $lag );
2927 $message = $lag < $config->get(
'SlaveLagCritical' )
2930 $wrap = Html::rawElement(
'div', [
'class' =>
"mw-{$message}" ],
"\n$1\n" );
2968 $this->
showFatalError( $this->
msg(
'filerenameerror', $old, $new )->escpaed() );
2997 ->getLinkRendererFactory()->createFromLegacyOptions(
$options );
2998 $link = $this->
msg(
'returnto' )->rawParams(
3000 $this->
addHTML(
"<p id=\"mw-returnto\">{$link}</p>\n" );
3011 public function returnToMain( $unused =
null, $returnto =
null, $returntoquery =
null ) {
3012 if ( $returnto ==
null ) {
3013 $returnto = $this->
getRequest()->getText(
'returnto' );
3016 if ( $returntoquery ==
null ) {
3017 $returntoquery = $this->
getRequest()->getText(
'returntoquery' );
3020 if ( $returnto ===
'' ) {
3021 $returnto = Title::newMainPage();
3024 if ( is_object( $returnto ) ) {
3025 $titleObj = $returnto;
3027 $titleObj = Title::newFromText( $returnto );
3031 if ( !is_object( $titleObj ) || $titleObj->isExternal() ) {
3032 $titleObj = Title::newMainPage();
3039 if ( !$this->rlClientContext ) {
3043 $this->
getSkin()->getSkinName(),
3044 $this->
getUser()->isLoggedIn() ? $this->
getUser()->getName() :
null,
3055 if ( $this->contentOverrideCallbacks ) {
3057 $this->rlClientContext->setContentOverrideCallback(
function (
Title $title ) {
3058 foreach ( $this->contentOverrideCallbacks
as $callback ) {
3061 $text = ContentHandler::getContentText(
$content );
3062 if ( strpos( $text,
'</script>' ) !==
false ) {
3066 $titleFormatted =
$title->getPrefixedText();
3068 Xml::encodeJsCall(
'mw.log.error', [
3069 "Cannot preview $titleFormatted due to script-closing tag."
3080 return $this->rlClientContext;
3095 if ( !$this->rlClient ) {
3108 $this->
getSkin()->setupSkinUserCss( $this );
3111 $exemptGroups = [
'site' => [],
'noscript' => [],
'private' => [],
'user' => [] ];
3117 $userBatch = [
'user.styles',
'user' ];
3118 $siteBatch = array_diff( $moduleStyles, $userBatch );
3120 ResourceLoaderWikiModule::preloadTitleInfo(
$context,
$dbr, $siteBatch );
3121 ResourceLoaderWikiModule::preloadTitleInfo(
$context,
$dbr, $userBatch );
3124 $moduleStyles = array_filter( $moduleStyles,
3126 $module = $rl->getModule(
$name );
3128 $group = $module->getGroup();
3129 if ( isset( $exemptGroups[$group] ) ) {
3130 $exemptStates[
$name] =
'ready';
3131 if ( !$module->isKnownEmpty(
$context ) ) {
3133 $exemptGroups[$group][] = $name;
3141 $this->rlExemptStyleModules = $exemptGroups;
3164 return $this->rlClient;
3174 $sitedir = MediaWikiServices::getInstance()->getContentLanguage()->getDir();
3177 $pieces[] = Html::htmlHeader( Sanitizer::mergeAttributes(
3181 $pieces[] = Html::openElement(
'head' );
3187 if ( !Html::isXmlMimeType( $this->
getConfig()->
get(
'MimeType' ) ) ) {
3196 $pieces[] = Html::element(
'meta', [
'charset' =>
'UTF-8' ] );
3199 $pieces[] = Html::element(
'title',
null, $this->
getHTMLTitle() );
3203 $pieces = array_merge( $pieces, array_values( $this->mHeadItems ) );
3206 $pieces[] =
'<!--[if lt IE 9]>' .
3216 $pieces[] = Html::closeElement(
'head' );
3218 $bodyClasses = $this->mAdditionalBodyClasses;
3219 $bodyClasses[] =
'mediawiki';
3221 # Classes for LTR/RTL directionality support
3222 $bodyClasses[] = $userdir;
3223 $bodyClasses[] =
"sitedir-$sitedir";
3225 $underline = $this->
getUser()->getOption(
'underline' );
3226 if ( $underline < 2 ) {
3230 $bodyClasses[] =
'mw-underline-' . ( $underline ?
'always' :
'never' );
3233 if ( $this->
getLanguage()->capitalizeAllNouns() ) {
3234 # A <body> class is probably not the best way to do this . . .
3235 $bodyClasses[] =
'capitalize-all-nouns';
3241 $bodyClasses[] =
'mw-hide-empty-elt';
3244 $bodyClasses[] =
'skin-' . Sanitizer::escapeClass( $sk->
getSkinName() );
3251 $bodyAttrs[
'class'] = implode(
' ', $bodyClasses );
3255 Hooks::run(
'OutputPageBodyAttributes', [ $this, $sk, &$bodyAttrs ] );
3257 $pieces[] = Html::openElement(
'body', $bodyAttrs );
3259 return self::combineWrappedStrings( $pieces );
3268 if ( is_null( $this->mResourceLoader ) ) {
3271 LoggerFactory::getInstance(
'resourceloader' )
3274 return $this->mResourceLoader;
3306 $chunks = array_filter( $chunks,
'strlen' );
3307 return WrappedString::join(
"\n", $chunks );
3321 $chunks[] = $this->mScripts;
3323 if ( $this->limitReportJSData ) {
3326 [
'wgPageParseReport' => $this->limitReportJSData ]
3332 return self::combineWrappedStrings( $chunks );
3342 return $this->mJsConfigVars;
3352 if ( is_array(
$keys ) ) {
3354 $this->mJsConfigVars[$key] =
$value;
3374 $canonicalSpecialPageName =
false; # T23115
3375 $services = MediaWikiServices::getInstance();
3378 $ns =
$title->getNamespace();
3379 $canonicalNamespace = MWNamespace::exists( $ns )
3380 ? MWNamespace::getCanonicalName( $ns )
3386 $relevantTitle = $sk->getRelevantTitle();
3387 $relevantUser = $sk->getRelevantUser();
3390 list( $canonicalSpecialPageName, ) =
3392 resolveAlias(
$title->getDBkey() );
3395 $curRevisionId = $wikiPage->getLatest();
3396 $articleId = $wikiPage->getId();
3402 $separatorTransTable =
$lang->separatorTransformTable();
3403 $separatorTransTable = $separatorTransTable ?: [];
3404 $compactSeparatorTransTable = [
3405 implode(
"\t", array_keys( $separatorTransTable ) ),
3406 implode(
"\t", $separatorTransTable ),
3408 $digitTransTable =
$lang->digitTransformTable();
3409 $digitTransTable = $digitTransTable ?: [];
3410 $compactDigitTransTable = [
3411 implode(
"\t", array_keys( $digitTransTable ) ),
3412 implode(
"\t", $digitTransTable ),
3418 'wgCanonicalNamespace' => $canonicalNamespace,
3419 'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3420 'wgNamespaceNumber' =>
$title->getNamespace(),
3421 'wgPageName' =>
$title->getPrefixedDBkey(),
3422 'wgTitle' =>
$title->getText(),
3423 'wgCurRevisionId' => $curRevisionId,
3425 'wgArticleId' => $articleId,
3427 'wgIsRedirect' =>
$title->isRedirect(),
3429 'wgUserName' =>
$user->isAnon() ? null :
$user->getName(),
3430 'wgUserGroups' =>
$user->getEffectiveGroups(),
3433 'wgPageContentLanguage' =>
$lang->getCode(),
3434 'wgPageContentModel' =>
$title->getContentModel(),
3435 'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3436 'wgDigitTransformTable' => $compactDigitTransTable,
3437 'wgDefaultDateFormat' =>
$lang->getDefaultDateFormat(),
3438 'wgMonthNames' =>
$lang->getMonthNamesArray(),
3439 'wgMonthNamesShort' =>
$lang->getMonthAbbreviationsArray(),
3440 'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3441 'wgRelevantArticleId' => $relevantTitle->getArticleID(),
3442 'wgRequestId' => WebRequest::getRequestId(),
3446 if (
$user->isLoggedIn() ) {
3448 $vars[
'wgUserEditCount'] =
$user->getEditCount();
3449 $userReg =
$user->getRegistration();
3450 $vars[
'wgUserRegistration'] = $userReg ?
wfTimestamp( TS_UNIX, $userReg ) * 1000 :
null;
3454 $vars[
'wgUserNewMsgRevisionId'] =
$user->getNewMessageRevisionId();
3457 $contLang =
$services->getContentLanguage();
3458 if ( $contLang->hasVariants() ) {
3459 $vars[
'wgUserVariant'] = $contLang->getPreferredVariant();
3465 $vars[
'wgRelevantPageIsProbablyEditable'] = $relevantTitle
3466 && $relevantTitle->quickUserCan(
'edit',
$user )
3467 && ( $relevantTitle->exists() || $relevantTitle->quickUserCan(
'create',
$user ) );
3475 if (
$title->isMainPage() ) {
3476 $vars[
'wgIsMainPage'] =
true;
3479 if ( $this->mRedirectedFrom ) {
3480 $vars[
'wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3483 if ( $relevantUser ) {
3484 $vars[
'wgRelevantUserName'] = $relevantUser->getName();
3491 Hooks::run(
'MakeGlobalVariablesScript', [ &
$vars, $this ] );
3509 $request->getVal(
'action' ) !==
'submit' ||
3517 if ( !
$user->isLoggedIn() ) {
3521 if ( !
$user->matchEditToken(
$request->getVal(
'wpEditToken' ) ) ) {
3526 $errors =
$title->getUserPermissionsErrors(
'edit',
$user );
3527 if ( count( $errors ) !== 0 ) {
3543 $canonicalUrl = $this->mCanonicalUrl;
3545 $tags[
'meta-generator'] = Html::element(
'meta', [
3546 'name' =>
'generator',
3547 'content' =>
"MediaWiki $wgVersion",
3550 if ( $config->get(
'ReferrerPolicy' ) !==
false ) {
3553 foreach ( array_reverse( (
array)$config->get(
'ReferrerPolicy' ) )
as $i => $policy ) {
3554 $tags[
"meta-referrer-$i"] = Html::element(
'meta', [
3555 'name' =>
'referrer',
3556 'content' => $policy,
3561 $p =
"{$this->mIndexPolicy},{$this->mFollowPolicy}";
3562 if ( $p !==
'index,follow' ) {
3565 $tags[
'meta-robots'] = Html::element(
'meta', [
3571 foreach ( $this->mMetatags
as $tag ) {
3572 if ( strncasecmp( $tag[0],
'http:', 5 ) === 0 ) {
3574 $tag[0] = substr( $tag[0], 5 );
3575 } elseif ( strncasecmp( $tag[0],
'og:', 3 ) === 0 ) {
3580 $tagName =
"meta-{$tag[0]}";
3581 if ( isset( $tags[$tagName] ) ) {
3582 $tagName .= $tag[1];
3584 $tags[$tagName] = Html::element(
'meta',
3587 'content' => $tag[1]
3592 foreach ( $this->mLinktags
as $tag ) {
3593 $tags[] = Html::element(
'link', $tag );
3596 # Universal edit button
3597 if ( $config->get(
'UniversalEditButton' ) && $this->isArticleRelated() ) {
3600 && ( $this->
getTitle()->exists() ||
3604 $msg = $this->
msg(
'edit' )->text();
3605 $tags[
'universal-edit-button'] = Html::element(
'link', [
3606 'rel' =>
'alternate',
3607 'type' =>
'application/x-wiki',
3609 'href' => $this->
getTitle()->getEditURL(),
3612 $tags[
'alternative-edit'] = Html::element(
'link', [
3615 'href' => $this->
getTitle()->getEditURL(),
3620 # Generally the order of the favicon and apple-touch-icon links
3621 # should not matter, but Konqueror (3.5.9 at least) incorrectly
3622 # uses whichever one appears later in the HTML source. Make sure
3623 # apple-touch-icon is specified first to avoid this.
3624 if ( $config->get(
'AppleTouchIcon' ) !==
false ) {
3625 $tags[
'apple-touch-icon'] = Html::element(
'link', [
3626 'rel' =>
'apple-touch-icon',
3627 'href' => $config->get(
'AppleTouchIcon' )
3631 if ( $config->get(
'Favicon' ) !==
false ) {
3632 $tags[
'favicon'] = Html::element(
'link', [
3633 'rel' =>
'shortcut icon',
3634 'href' => $config->get(
'Favicon' )
3638 # OpenSearch description link
3639 $tags[
'opensearch'] = Html::element(
'link', [
3641 'type' =>
'application/opensearchdescription+xml',
3642 'href' =>
wfScript(
'opensearch_desc' ),
3643 'title' => $this->
msg(
'opensearch-desc' )->inContentLanguage()->
text(),
3646 # Real Simple Discovery link, provides auto-discovery information
3647 # for the MediaWiki API (and potentially additional custom API
3648 # support such as WordPress or Twitter-compatible APIs for a
3649 # blogging extension, etc)
3650 $tags[
'rsd'] = Html::element(
'link', [
3652 'type' =>
'application/rsd+xml',
3658 [
'action' =>
'rsd' ] ),
3664 if ( !$config->get(
'DisableLangConversion' ) ) {
3666 if (
$lang->hasVariants() ) {
3667 $variants =
$lang->getVariants();
3668 foreach ( $variants
as $variant ) {
3669 $tags[
"variant-$variant"] = Html::element(
'link', [
3670 'rel' =>
'alternate',
3671 'hreflang' => LanguageCode::bcp47( $variant ),
3672 'href' => $this->
getTitle()->getLocalURL(
3673 [
'variant' => $variant ] )
3677 # x-default link per https:
3678 $tags[
"variant-x-default"] = Html::element(
'link', [
3679 'rel' =>
'alternate',
3680 'hreflang' =>
'x-default',
3681 'href' => $this->
getTitle()->getLocalURL() ] );
3686 if ( $this->copyrightUrl !==
null ) {
3687 $copyright = $this->copyrightUrl;
3690 if ( $config->get(
'RightsPage' ) ) {
3691 $copy = Title::newFromText( $config->get(
'RightsPage' ) );
3694 $copyright = $copy->getLocalURL();
3698 if ( !$copyright && $config->get(
'RightsUrl' ) ) {
3699 $copyright = $config->get(
'RightsUrl' );
3704 $tags[
'copyright'] = Html::element(
'link', [
3706 'href' => $copyright ]
3711 if ( $config->get(
'Feed' ) ) {
3715 # Use the page name for the title. In principle, this could
3716 # lead to issues with having the same name for different feeds
3717 # corresponding to the same page, but we can't avoid that at
3723 # Used
messages:
'page-rss-feed' and 'page-atom-feed' (
for an easier grep)
3725 "page-{$format}-feed", $this->
getTitle()->getPrefixedText()
3730 # Recent changes feed should appear on every page (except recentchanges,
3731 # that would be redundant). Put it after the per-page feed to avoid
3732 # changing existing behavior. It's still available, probably via a
3733 # menu in your browser. Some sites might have a different feed they'd
3734 # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3735 # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3736 # If so, use it instead.
3737 $sitename = $config->get(
'Sitename' );
3738 if ( $config->get(
'OverrideSiteFeed' ) ) {
3739 foreach ( $config->get(
'OverrideSiteFeed' )
as $type => $feedUrl ) {
3744 $this->
msg(
"site-{$type}-feed", $sitename )->
text()
3747 } elseif ( !$this->
getTitle()->isSpecial(
'Recentchanges' ) ) {
3748 $rctitle = SpecialPage::getTitleFor(
'Recentchanges' );
3749 foreach ( $config->get(
'AdvertisedFeedTypes' )
as $format ) {
3752 $rctitle->getLocalURL( [
'feed' => $format ] ),
3753 # For grep:
'site-rss-feed',
'site-atom-feed'
3754 $this->
msg(
"site-{$format}-feed", $sitename )->text()
3759 # Allow extensions to change the list pf feeds. This hook is primarily for changing,
3760 # manipulating or removing existing feed tags. If you want to add new feeds, you should
3761 # use OutputPage::addFeedLink() instead.
3762 Hooks::run(
'AfterBuildFeedLinks', [ &$feedLinks ] );
3764 $tags += $feedLinks;
3768 if ( $config->get(
'EnableCanonicalServerLink' ) ) {
3769 if ( $canonicalUrl !==
false ) {
3781 if ( in_array( $action, [
'history',
'info' ] ) ) {
3782 $query =
"action={$action}";
3788 $reqUrl = $this->
getRequest()->getRequestURL();
3793 if ( $canonicalUrl !==
false ) {
3794 $tags[] = Html::element(
'link', [
3795 'rel' =>
'canonical',
3796 'href' => $canonicalUrl
3805 Hooks::run(
'OutputPageAfterGetHeadLinksArray', [ &$tags, $this ] );
3819 return Html::element(
'link', [
3820 'rel' =>
'alternate',
3821 'type' =>
"application/$type+xml",
3836 public function addStyle( $style, $media =
'', $condition =
'', $dir =
'' ) {
3842 $options[
'condition'] = $condition;
3858 if ( $flip ===
'flip' && $this->
getLanguage()->isRTL() ) {
3859 # If wanted, and the interface is right-to-left, flip the CSS
3860 $style_css = CSSJanus::transform( $style_css,
true,
false );
3862 $this->mInlineStyles .= Html::inlineStyle( $style_css );
3886 $chunks[] = Html::element(
3888 [
'name' =>
'ResourceLoaderDynamicStyles',
'content' =>
'' ]
3891 $separateReq = [
'site.styles',
'user.styles' ];
3892 foreach ( $this->rlExemptStyleModules
as $group => $moduleNames ) {
3895 array_diff( $moduleNames, $separateReq ),
3899 foreach ( array_intersect( $moduleNames, $separateReq )
as $name ) {
3908 return self::combineWrappedStrings( array_merge( $chunks, $append ) );
3917 foreach ( $this->styles
as $file =>
$options ) {
3920 $links[$file] =
$link;
3940 if ( isset(
$options[
'media'] ) ) {
3941 $media = self::transformCssMedia(
$options[
'media'] );
3942 if ( is_null( $media ) ) {
3949 if ( substr( $style, 0, 1 ) ==
'/' ||
3950 substr( $style, 0, 5 ) ==
'http:' ||
3951 substr( $style, 0, 6 ) ==
'https:' ) {
3956 $url = self::transformResourcePath(
3958 $config->get(
'StylePath' ) .
'/' . $style
3962 $link = Html::linkedStyle( $url, $media );
3964 if ( isset(
$options[
'condition'] ) ) {
3965 $condition = htmlspecialchars(
$options[
'condition'] );
3966 $link =
"<!--[if $condition]>$link<![endif]-->";
3996 $remotePathPrefix = $config->
get(
'ResourceBasePath' );
3997 if ( $remotePathPrefix ===
'' ) {
4002 $remotePath = $remotePathPrefix;
4004 if ( strpos(
$path, $remotePath ) !== 0 || substr(
$path, 0, 2 ) ===
'//' ) {
4013 $uploadPath = $config->
get(
'UploadPath' );
4014 if ( strpos(
$path, $uploadPath ) === 0 ) {
4015 $localDir = $config->
get(
'UploadDirectory' );
4016 $remotePathPrefix = $remotePath = $uploadPath;
4019 $path = RelPath::getRelativePath(
$path, $remotePath );
4020 return self::transformFilePath( $remotePathPrefix, $localDir,
$path );
4035 $hash = md5_file(
"$localPath/$file" );
4036 if ( $hash ===
false ) {
4037 wfLogWarning( __METHOD__ .
": Failed to hash $localPath/$file" );
4040 return "$remotePathPrefix/$file?" . substr( $hash, 0, 5 );
4054 $screenMediaQueryRegex =
'/^(?:only\s+)?screen\b/i';
4058 'printable' =>
'print',
4059 'handheld' =>
'handheld',
4061 foreach ( $switches
as $switch => $targetMedia ) {
4063 if ( $media == $targetMedia ) {
4065 } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
4079 if ( $targetMedia ==
'print' || $media ==
'screen' ) {
4096 $args = func_get_args();
4139 $msgSpecs = func_get_args();
4140 array_shift( $msgSpecs );
4141 $msgSpecs = array_values( $msgSpecs );
4143 foreach ( $msgSpecs
as $n => $spec ) {
4144 if ( is_array( $spec ) ) {
4147 if ( isset(
$args[
'options'] ) ) {
4148 unset(
$args[
'options'] );
4150 'Adding "options" to ' . __METHOD__ .
' is no longer supported',
4169 return $this->mEnableTOC;
4199 public static function setupOOUI( $skinName =
'default', $dir =
'ltr' ) {
4200 $themes = ResourceLoaderOOUIModule::getSkinThemeMap();
4201 $theme = $themes[$skinName] ?? $themes[
'default'];
4203 $themeClass =
"OOUI\\{$theme}Theme";
4204 OOUI\Theme::setSingleton(
new $themeClass() );
4205 OOUI\Element::setDefaultDir( $dir );
4216 strtolower( $this->
getSkin()->getSkinName() ),
4220 'oojs-ui-core.styles',
4221 'oojs-ui.styles.indicators',
4222 'oojs-ui.styles.textures',
4223 'mediawiki.widgets.styles',
4224 'oojs-ui.styles.icons-content',
4225 'oojs-ui.styles.icons-alerts',
4226 'oojs-ui.styles.icons-interactions',
4243 if ( $this->CSPNonce ===
null ) {
4246 $rand = random_bytes( 15 );
4247 $this->CSPNonce = base64_encode( $rand );
4249 return $this->CSPNonce;
and(b) You must cause any modified files to carry prominent notices stating that You changed the files
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
$wgVersion
MediaWiki version number.
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,...
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
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...
wfGetAllCallers( $limit=3)
Return a string consisting of callers in the stack.
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
wfClearOutputBuffers()
More legible than passing a 'false' parameter to wfResetOutputBuffers():
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 path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
if(! $wgDBerrorLogTZ) $wgRequest
static getActionName(IContextSource $context)
Get the action that will be executed, not necessarily the one passed passed through the "action" requ...
static formatRobotPolicy( $policy)
Converts a String robot policy into an associative array, to allow merging of several policies using ...
static isNonceRequired(Config $config)
Should we set nonce attribute.
static sendHeaders(IContextSource $context)
Send CSP headers based on wiki config.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
getWikiPage()
Get the WikiPage object.
setContext(IContextSource $context)
Allows changing specific properties of a context object, without changing the main one.
WebRequest clone which takes values from a provided array.
Implements some public methods and some protected utility functions which are required by multiple ch...
exists()
Returns true if file exists in the repository.
Marks HTML that shouldn't be escaped.
Content for JavaScript pages.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
setArray( $array)
Set the link list to a given 2-d array First key is the namespace, second is the DB key,...
The Message class provides methods which fulfil two basic services:
This class should be covered by a general architecture document which does not exist as of January 20...
isArticle()
Return whether the content displayed page is related to the source of the corresponding article on th...
addWikiMsg()
Add a wikitext-formatted message to the output.
addLinkHeader( $header)
Add an HTTP Link: header.
setFileVersion( $file)
Set the displayed file version.
$mScripts
Used for JavaScript (predates ResourceLoader)
getDisplayTitle()
Returns page display title.
string $CSPNonce
The nonce for Content-Security-Policy.
getCdnCacheEpoch( $reqTime, $maxAge)
disable()
Disable output completely, i.e.
addLink(array $linkarr)
Add a new <link> tag to the page header.
ResourceLoader $mResourceLoader
showFileCopyError( $old, $new)
static array $cacheVaryCookies
A cache of the names of the cookies that will influence the cache.
getCanonicalUrl()
Returns the URL to be used for the <link rel=canonical>> if one is set.
getPageTitle()
Return the "page title", i.e.
getModuleScripts( $filter=false, $position=null)
Get the list of script-only modules to load on this page.
isArticleRelated()
Return whether this page is related an article on the wiki.
addCategoryLinksToLBAndGetResult(array $categories)
getLanguageLinks()
Get the list of language links.
addWikiText( $text, $linestart=true, $interface=true)
Convert wikitext to HTML and add it to the buffer Default assumes that the current page title will be...
addScriptFile( $file, $unused=null)
Add a JavaScript file to be loaded as <script> on this page.
allowClickjacking()
Turn off frame-breaking.
filterModules(array $modules, $position=null, $type=ResourceLoaderModule::TYPE_COMBINED)
Filter an array of modules to remove insufficiently trustworthy members, and modules which are no lon...
wrapWikiTextAsInterface( $wrapperClass, $text)
Convert wikitext in the user interface language to HTML and add it to the buffer with a <div class="$...
getSyndicationLinks()
Return URLs for each supported syndication format for this page.
setArticleFlag( $newVal)
Set whether the displayed content is related to the source of the corresponding article on the wiki S...
addMeta( $name, $val)
Add a new "<meta>" tag To add an http-equiv meta tag, precede the name with "http:".
showFileNotFoundError( $name)
parseInline( $text, $linestart=true, $interface=false)
Parse wikitext, strip paragraph wrapper, and return the HTML.
showFileRenameError( $old, $new)
$mFeedLinks
Handles the Atom / RSS links.
showUnexpectedValueError( $name, $val)
setCopyrightUrl( $url)
Set the copyright URL to send with the output.
parseInternal( $text, $title, $linestart, $tidy, $interface, $language)
Parse wikitext and return the HTML (internal implementation helper)
setRobotPolicy( $policy)
Set the robot policy for the page: http://www.robotstxt.org/meta.html
__construct(IContextSource $context)
Constructor for OutputPage.
setIndexPolicy( $policy)
Set the index policy for the page, but leave the follow policy un- touched.
getTemplateIds()
Get the templates used on this page.
setDisplayTitle( $html)
Same as page title but only contains name of the page, not any other text.
setPageTitle( $name)
"Page title" means the contents of <h1>.
output( $return=false)
Finally, all the text has been munged and accumulated into the object, let's actually output it:
redirect( $url, $responsecode='302')
Redirect to $url rather than displaying the normal page.
getRedirect()
Get the URL to redirect to, or an empty string if not redirect URL set.
setLastModified( $timestamp)
Override the last modified timestamp.
addWikiTextTitleTidy( $text, Title $title, $linestart=true)
Add wikitext in content language with a custom Title object.
setLanguageLinks(array $newLinkArray)
Reset the language links and add new language links.
addFeedLink( $format, $href)
Add a feed link to the page header.
setTitle(Title $t)
Set the Title object to use.
setCategoryLinks(array $categories)
Reset the category links (but not the category list) and add $categories.
getFileVersion()
Get the displayed file version.
setSyndicated( $show=true)
Add or remove feed links in the page header This is mainly kept for backward compatibility,...
bool $mHideNewSectionLink
bool $mIsArticle
Is the displayed content related to the source of the corresponding wiki article.
adaptCdnTTL( $mtime, $minTTL=0, $maxTTL=0)
Get TTL in [$minTTL,$maxTTL] in pass it to lowerCdnMaxage()
showsCopyright()
Return whether the standard copyright should be shown for the current page.
sendCacheControl()
Send cache control HTTP headers.
setTarget( $target)
Sets ResourceLoader target for load.php links.
addCategoryLinks(array $categories)
Add an array of categories, with names in the keys.
int $mRevisionId
To include the variable {{REVISIONID}}.
showLagWarning( $lag)
Show a warning about replica DB lag.
clearSubtitle()
Clear the subtitles.
showFatalError( $message)
Output an error page.
setCdnMaxage( $maxage)
Set the value of the "s-maxage" part of the "Cache-control" HTTP header.
getJsConfigVars()
Get the javascript config vars to include on this page.
getHTML()
Get the body HTML.
addWikiTextWithTitle( $text, Title $title, $linestart=true)
Add wikitext with a custom Title object.
addContentOverride(LinkTarget $target, Content $content)
Add a mapping from a LinkTarget to a Content, for things like page preview.
array $mMetatags
Should be private.
parseAsContent( $text, $linestart=true)
Parse wikitext in the page content language and return the HTML.
setCopyright( $hasCopyright)
Set whether the standard copyright should be shown for the current page.
addWikiTextTitle( $text, Title $title, $linestart, $tidy=false, $interface=false)
Add wikitext with a custom Title object.
array $mAllowedModules
What level of 'untrustworthiness' is allowed in CSS/JS modules loaded on this page?
addParserOutput(ParserOutput $parserOutput, $poOptions=[])
Add everything from a ParserOutput object.
getJSVars()
Get an array containing the variables to be set in mw.config in JavaScript.
bool $mPreventClickjacking
Controls if anti-clickjacking / frame-breaking headers will be sent.
haveCacheVaryCookies()
Check if the request has a cache-varying cookie header If it does, it's very important that we don't ...
isTOCEnabled()
Whether the output has a table of contents.
versionRequired( $version)
Display an error page indicating that a given version of MediaWiki is required to use it.
reduceAllowedModules( $type, $level)
Limit the highest level of CSS/JS untrustworthiness allowed.
addInlineStyle( $style_css, $flip='noflip')
Adds inline CSS styles Internal use only.
getRevisionTimestamp()
Get the timestamp of displayed revision.
preventClickjacking( $enable=true)
Set a flag which will cause an X-Frame-Options header appropriate for edit pages to be sent.
bool $mPrintable
We have to set isPrintable().
setFollowPolicy( $policy)
Set the follow policy for the page, but leave the index policy un- touched.
getHeadItemsArray()
Get an array of head items.
isPrintable()
Return whether the page is "printable".
getModules( $filter=false, $position=null, $param='mModules', $type=ResourceLoaderModule::TYPE_COMBINED)
Get the list of modules to include on this page.
setRedirectedFrom( $t)
Set $mRedirectedFrom, the Title of the page which redirected us to the current page.
getFeedAppendQuery()
Will currently always return null.
addModuleStyles( $modules)
Load the styles of one or more ResourceLoader modules on this page.
setHTMLTitle( $name)
"HTML title" means the contents of "<title>".
loadSkinModules( $sk)
Transfer styles and JavaScript modules from skin.
array $mAdditionalBodyClasses
Additional <body> classes; there are also <body> classes from other sources.
returnToMain( $unused=null, $returnto=null, $returntoquery=null)
Add a "return to" link pointing to a specified title, or the title indicated in the request,...
array $mHeadItems
Array of elements in "<head>".
isSyndicated()
Should we output feed links for this page?
$mLinkHeader
Link: header contents.
styleLink( $style, array $options)
Generate <link> tags for stylesheets.
parseAsInterface( $text, $linestart=true)
Parse wikitext in the user interface language and return the HTML.
addParserOutputMetadata(ParserOutput $parserOutput)
Add all metadata associated with a ParserOutput object, but without the actual HTML.
static transformResourcePath(Config $config, $path)
Transform path to web-accessible static resource.
addElement( $element, array $attribs=[], $contents='')
Shortcut for adding an Html::element via addHTML.
makeResourceLoaderLink( $modules, $only, array $extraQuery=[])
Explicily load or embed modules on a page.
getSubtitle()
Get the subtitle.
showPermissionsErrorPage(array $errors, $action=null)
Output a standard permission error page.
addSubtitle( $str)
Add $str to the subtitle.
static setupOOUI( $skinName='default', $dir='ltr')
Helper function to setup the PHP implementation of OOUI to use in this request.
setRevisionId( $revid)
Set the revision ID which will be seen by the wiki text parser for things such as embedded {{REVISION...
addParserOutputContent(ParserOutput $parserOutput, $poOptions=[])
Add the HTML and enhancements for it (like ResourceLoader modules) associated with a ParserOutput obj...
getPreventClickjacking()
Get the prevent-clickjacking flag.
enableOOUI()
Add ResourceLoader module styles for OOUI and set up the PHP implementation of it for use with MediaW...
getCategories( $type='all')
Get the list of category names this page belongs to.
sectionEditLinksEnabled()
getIndicators()
Get the indicators associated with this page.
$mProperties
Additional key => value data.
parseInlineAsInterface( $text, $linestart=true)
Parse wikitext in the user interface language, strip paragraph wrapper, and return the HTML.
addWikiMsgArray( $name, $args)
Add a wikitext-formatted message to the output.
addModuleScripts( $modules)
Load the scripts of one or more ResourceLoader modules, on this page.
array $contentOverrides
Map Title to Content.
addBodyClasses( $classes)
Add a class to the <body> element.
addParserOutputText(ParserOutput $parserOutput, $poOptions=[])
Add the HTML associated with a ParserOutput object, without any metadata.
warnModuleTargetFilter( $moduleName)
string $mBodytext
Contains all of the "<body>" content.
addScript( $script)
Add raw HTML to the list of scripts (including <script> tag, etc.) Internal use only.
clearHTML()
Clear the body HTML.
array $mSubtitle
Contains the page subtitle.
addVaryHeader( $header, array $option=null)
Add an HTTP header that will influence on the cache.
addStyle( $style, $media='', $condition='', $dir='')
Add a local or specified stylesheet, with the given media options.
getLinkHeader()
Return a Link: header.
setPrintable()
Set the page as printable, i.e.
getResourceLoader()
Get a ResourceLoader object associated with this OutputPage.
feedLink( $type, $url, $text)
Generate a "<link rel/>" for a feed.
bool $mNoGallery
Comes from the parser.
getModuleStyles( $filter=false, $position=null)
Get the list of style-only modules to load on this page.
enableClientCache( $state)
Use enableClientCache(false) to force it to send nocache headers.
userCanPreview()
To make it harder for someone to slip a user a fake JavaScript or CSS preview, a random token is asso...
array $limitReportJSData
Profiling data.
getFileSearchOptions()
Get the files used on this page.
addWikiTextTidy( $text, $linestart=true)
Add wikitext in content language.
addHTML( $text)
Append $text to the body HTML.
formatPermissionsErrorMessage(array $errors, $action=null)
Format a list of error messages.
string $mRevisionTimestamp
string null $copyrightUrl
The URL to send in a <link> element with rel=license.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getHTMLTitle()
Return the "HTML title", i.e.
disallowUserJs()
Do not allow scripts which can be modified by wiki users to load on this page; only allow scripts bun...
string $mHTMLtitle
Stores contents of "<title>" tag.
addJsConfigVars( $keys, $value=null)
Add one or more variables to be set in mw.config in JavaScript.
static transformCssMedia( $media)
Transform "media" attribute based on request parameters.
enableSectionEditLinks( $flag=true)
Enables/disables section edit links, doesn't override NOEDITSECTION
setCanonicalUrl( $url)
Set the URL to be used for the <link rel=canonical>>.
ParserOptions $mParserOptions
lazy initialised, use parserOptions()
addTemplate(&$template)
Add the output of a QuickTemplate to the output buffer.
addWikiTextTitleInternal( $text, Title $title, $linestart, $tidy, $interface, $wrapperClass=null)
Add wikitext with a custom Title object.
getRlClient()
Call this to freeze the module queue and JS config and create a formatter.
static transformFilePath( $remotePathPrefix, $localPath, $file)
Utility method for transformResourceFilePath().
callable[] $contentOverrideCallbacks
int $mCdnMaxageLimit
Upper limit on mCdnMaxage.
ResourceLoaderClientHtml $rlClient
setArticleBodyOnly( $only)
Set whether the output should only contain the body of the article, without any skin,...
showFileDeleteError( $name)
addInlineScript( $script)
Add a self-contained script tag with the given contents Internal use only.
addAcceptLanguage()
T23672: Add Accept-Language to Vary and Key headers if there's no 'variant' parameter in GET.
setStatusCode( $statusCode)
Set the HTTP status code to send with the output.
getCacheVaryCookies()
Get the list of cookie names that will influence the cache.
ResourceLoaderContext $rlClientContext
showErrorPage( $title, $msg, $params=[])
Output a standard error page.
getLinkTags()
Returns the current <link> tags.
getArticleBodyOnly()
Return whether the output will contain only the body of the article.
setProperty( $name, $value)
Set an additional output property.
setRevisionTimestamp( $timestamp)
Set the timestamp of the revision which will be displayed.
checkLastModified( $timestamp)
checkLastModified tells the client to use the client-cached page if possible.
getVaryHeader()
Return a Vary: header on which to vary caches.
string $mLastModified
Used for sending cache control.
addWikiTextAsContent( $text, $linestart=true, Title $title=null)
Convert wikitext in the page content language to HTML and add it to the buffer.
showNewSectionLink()
Show an "add new section" link?
bool $mDoNothing
Whether output is disabled.
string $mPageTitle
The contents of.
string $mPageLinkTitle
Used by skin template.
addHeadItem( $name, $value)
Add or replace a head item to the output.
getRevisionId()
Get the displayed revision ID.
setIndicators(array $indicators)
Add an array of indicators, with their identifiers as array keys and HTML contents as values.
bool $mEnableTOC
Whether parser output contains a table of contents.
Title $mRedirectedFrom
If the current page was reached through a redirect, $mRedirectedFrom contains the Title of the redire...
lowerCdnMaxage( $maxage)
Set the value of the "s-maxage" part of the "Cache-control" HTTP header to $maxage if that is lower t...
forceHideNewSectionLink()
Forcibly hide the new section link?
bool $mHasCopyright
Is the content subject to copyright.
string null $mTarget
ResourceLoader target for load.php links.
int $mCdnMaxage
Cache stuff.
addBacklinkSubtitle(Title $title, $query=[])
Add a subtitle containing a backlink to a page.
getAllowedModules( $type)
Show what level of JavaScript / CSS untrustworthiness is allowed on this page.
parserOptions( $options=null)
Get/set the ParserOptions object to use for wikitext parsing.
string $displayTitle
The displayed title of the page.
prependHTML( $text)
Prepend $text to the body HTML.
addLanguageLinks(array $newLinkArray)
Add new language links.
array $mLanguageLinks
Array of Interwiki Prefixed (non DB key) Titles (e.g.
wrapWikiMsg( $wrap)
This function takes a number of message/argument specifications, wraps them in some overall structure...
setArticleRelated( $newVal)
Set whether this page is related an article on the wiki Setting false will cause the change of "artic...
string $mInlineStyles
Inline CSS styles.
addModules( $modules)
Load one or more ResourceLoader modules on this page.
buildExemptModules()
Build exempt modules and legacy non-ResourceLoader styles.
getProperty( $name)
Get an additional output property.
addWikiTextAsInterface( $text, $linestart=true, Title $title=null)
Convert wikitext in the user interface language to HTML and add it to the buffer.
headElement(Skin $sk, $includeStyle=true)
prepareErrorPage( $pageTitle, $htmlTitle=false)
Prepare this object to display an error page; disable caching and indexing, clear the current text an...
addContentOverrideCallback(callable $callback)
Add a callback for mapping from a Title to a Content object, for things like page preview.
static buildBacklinkSubtitle(Title $title, $query=[])
Build message object for a subtitle containing a backlink to a page.
setFeedAppendQuery( $val)
Add default feeds to the page header This is mainly kept for backward compatibility,...
getBottomScripts()
JS stuff to put at the bottom of the <body>.
addReturnTo( $title, array $query=[], $text=null, $options=[])
Add a "return to" link pointing to a specified title.
getMetaTags()
Returns the current <meta> tags.
bool $mArticleBodyOnly
Flag if output should only contain the body of the article.
setSubtitle( $str)
Replace the subtitle with $str.
array $rlExemptStyleModules
getKeyHeader()
Get a complete Key header.
getCategoryLinks()
Get the list of category links, in a 2-D array with the following format: $arr[$type][] = $link,...
getFrameOptions()
Get the X-Frame-Options header value (without the name part), or false if there isn't one.
addHeadItems( $values)
Add one or more head items to the output.
static combineWrappedStrings(array $chunks)
Combine WrappedString chunks and filter out empty ones.
bool $mIsArticleRelated
Stores "article flag" toggle.
parse( $text, $linestart=true, $interface=false, $language=null)
Parse wikitext and return the HTML.
getUnprefixedDisplayTitle()
Returns page display title without namespace prefix if possible.
getCSPNonce()
Get (and set if not yet set) the CSP nonce.
array $mVaryHeader
Headers that cause the cache to vary.
hasHeadItem( $name)
Check if the header item $name is already set.
array $styles
An array of stylesheet filenames (relative from skins path), with options for CSS media,...
isDisabled()
Return whether the output will be completely disabled.
Set options of the Parser.
preventClickjacking( $flag=null)
Get or set the prevent-clickjacking flag.
getText( $options=[])
Get the output HTML.
Bootstrap a ResourceLoader client on an HTML page.
setModules(array $modules)
Ensure one or more modules are loaded.
static makeLoad(ResourceLoaderContext $mainContext, array $modules, $only, array $extraQuery=[], $nonce=null)
Explicily load or embed modules on a page.
setModuleScripts(array $modules)
Ensure the scripts of one or more modules are loaded.
setConfig(array $vars)
Set mw.config variables.
setExemptStates(array $states)
Set state of special modules that are handled by the caller manually.
setModuleStyles(array $modules)
Ensure the styles of one or more modules are loaded.
Object passed around to modules which contains information about the state of a specific loader reque...
static newDummyContext()
Return a dummy ResourceLoaderContext object suitable for passing into things that don't "really" need...
Abstraction for ResourceLoader modules, with name registration and maxage functionality.
const ORIGIN_USER_SITEWIDE
getOrigin()
Get this module's origin.
const ORIGIN_CORE_INDIVIDUAL
Dynamic JavaScript and CSS resource loading system.
static makeInlineScript( $script, $nonce=null)
Returns an HTML script tag that runs given JS code after startup and base modules.
static inDebugMode()
Determine whether debug mode was requested Order of priority is 1) request param, 2) cookie,...
static makeConfigSetScript(array $configuration)
Returns JS code which will set the MediaWiki configuration array to the given value.
static makeLoaderQuery( $modules, $lang, $skin, $user=null, $version=null, $debug=false, $only=null, $printable=false, $handheld=false, $extraQuery=[])
Build a query array (array representation of query string) for load.php.
The main skin class which provides methods and properties for all other skins.
getHtmlElementAttributes()
Return values for <html> element.
addToBodyAttributes( $out, &$bodyAttrs)
This will be called by OutputPage::headElement when it is creating the "<body>" tag,...
getPageClasses( $title)
TODO: document.
Represents a title within MediaWiki.
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
while(( $__line=Maintenance::readconsole()) !==false) print
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping $template
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $services
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Allows to change the fields on the form that will be generated $name
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext such as when responding to a resource loader request or generating HTML output & $resourceLoader
this hook is for auditing only $response
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
passed in as a query string parameter to the various URLs constructed here(i.e. $prevlink) $ldel you ll need to handle error messages
returning false will NOT prevent logging $e
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Interface for configuration instances.
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".
Base interface for content objects.
Interface for objects which can provide a MediaWiki context on request.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(!isset( $args[0])) $lang