28use Wikimedia\WrappedString;
29use Wikimedia\WrappedStringList;
272 'Accept-Encoding' => [
'match=gzip' ],
343 public function redirect( $url, $responsecode =
'302' ) {
344 # Strip newlines as a paranoia check for header injection in PHP<5.1.2
345 $this->mRedirect = str_replace(
"\n",
'', $url );
346 $this->mRedirectCode = $responsecode;
355 return $this->mRedirect;
367 $this->copyrightUrl = $url;
376 $this->mStatusCode = $statusCode;
387 array_push( $this->mMetatags, [
$name, $val ] );
397 return $this->mMetatags;
408 array_push( $this->mLinktags, $linkarr );
418 return $this->mLinktags;
427 $this->mCanonicalUrl = $url;
438 return $this->mCanonicalUrl;
449 $this->mScripts .= $script;
461 if ( substr(
$file, 0, 1 ) !==
'/' && !preg_match(
'#^[a-z]*://#i',
$file ) ) {
478 $this->mScripts .= Html::inlineScript(
"\n$script\n", $this->
getCSPNonce() ) .
"\n";
493 $filteredModules = [];
499 if ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) ) {
503 $filteredModules[] = $val;
506 return $filteredModules;
510 static $warnings = [];
511 if ( isset( $warnings[$this->mTarget][$moduleName] ) ) {
514 $warnings[$this->mTarget][$moduleName] =
true;
516 'Module "{module}" not loadable on target "{target}".',
518 'module' => $moduleName,
519 'target' => $this->mTarget,
536 $modules = array_values( array_unique( $this->$param ) );
548 $this->mModules = array_merge( $this->mModules, (
array)
$modules );
583 $this->mModuleStyles = array_merge( $this->mModuleStyles, (
array)
$modules );
590 return $this->mTarget;
599 $this->mTarget = $target;
610 if ( !$this->contentOverrides ) {
614 return $this->contentOverrides[$key] ??
null;
619 $this->contentOverrides[$key] =
$content;
630 $this->contentOverrideCallbacks[] = $callback;
639 return $this->mHeadItems;
665 $this->mHeadItems = array_merge( $this->mHeadItems, (
array)$values );
675 return isset( $this->mHeadItems[
$name] );
685 $this->mAdditionalBodyClasses = array_merge( $this->mAdditionalBodyClasses, (
array)$classes );
696 $this->mArticleBodyOnly = $only;
705 return $this->mArticleBodyOnly;
727 return $this->mProperties[
$name] ??
null;
742 if ( !$timestamp || $timestamp ==
'19700101000000' ) {
743 wfDebug( __METHOD__ .
": CACHE DISABLED, NO TIMESTAMP\n" );
747 if ( !$config->get(
'CachePages' ) ) {
748 wfDebug( __METHOD__ .
": CACHE DISABLED\n" );
754 'page' => $timestamp,
755 'user' => $this->
getUser()->getTouched(),
756 'epoch' => $config->get(
'CacheEpoch' )
758 if ( $config->get(
'UseSquid' ) ) {
761 $config->get(
'SquidMaxage' )
764 Hooks::run(
'OutputPageCheckLastModified', [ &$modifiedTimes, $this ] );
766 $maxModified = max( $modifiedTimes );
767 $this->mLastModified =
wfTimestamp( TS_RFC2822, $maxModified );
769 $clientHeader = $this->
getRequest()->getHeader(
'If-Modified-Since' );
770 if ( $clientHeader ===
false ) {
771 wfDebug( __METHOD__ .
": client did not send If-Modified-Since header",
'private' );
775 # IE sends sizes after the date like this:
776 # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
777 # this breaks strtotime().
778 $clientHeader = preg_replace(
'/;.*$/',
'', $clientHeader );
780 Wikimedia\suppressWarnings();
781 $clientHeaderTime = strtotime( $clientHeader );
782 Wikimedia\restoreWarnings();
783 if ( !$clientHeaderTime ) {
785 .
": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
788 $clientHeaderTime =
wfTimestamp( TS_MW, $clientHeaderTime );
793 if ( $info !==
'' ) {
799 wfDebug( __METHOD__ .
": client sent If-Modified-Since: " .
800 wfTimestamp( TS_ISO_8601, $clientHeaderTime ),
'private' );
801 wfDebug( __METHOD__ .
": effective Last-Modified: " .
802 wfTimestamp( TS_ISO_8601, $maxModified ),
'private' );
803 if ( $clientHeaderTime < $maxModified ) {
804 wfDebug( __METHOD__ .
": STALE, $info",
'private' );
809 # Give a 304 Not Modified response code and disable body output
810 wfDebug( __METHOD__ .
": NOT MODIFIED, $info",
'private' );
811 ini_set(
'zlib.output_compression', 0 );
812 $this->
getRequest()->response()->statusHeader( 304 );
834 return $reqTime - $maxAge;
844 $this->mLastModified =
wfTimestamp( TS_RFC2822, $timestamp );
858 if ( isset( $policy[
'index'] ) ) {
861 if ( isset( $policy[
'follow'] ) ) {
874 $policy = trim( $policy );
875 if ( in_array( $policy, [
'index',
'noindex' ] ) ) {
876 $this->mIndexPolicy = $policy;
888 $policy = trim( $policy );
889 if ( in_array( $policy, [
'follow',
'nofollow' ] ) ) {
890 $this->mFollowPolicy = $policy;
904 $this->mHTMLtitle =
$name;
914 return $this->mHTMLtitle;
923 $this->mRedirectedFrom =
$t;
943 # change "<script>foo&bar</script>" to "<script>foo&bar</script>"
944 # but leave "<i>foobar</i>" alone
945 $nameWithTags = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags(
$name ) );
946 $this->mPageTitle = $nameWithTags;
948 # change "<i>foo&bar</i>" to "foo&bar"
950 $this->
msg(
'pagetitle' )->plaintextParams( Sanitizer::stripAllTags( $nameWithTags ) )
951 ->inContentLanguage()
961 return $this->mPageTitle;
972 $this->displayTitle =
$html;
984 $html = $this->displayTitle;
985 if (
$html ===
null ) {
989 return Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags(
$html ) );
1000 $nsPrefix = $this->
getTitle()->getNsText() .
':';
1001 $prefix = preg_quote( $nsPrefix,
'/' );
1003 return preg_replace(
"/^$prefix/i",
'', $text );
1031 if ( $str instanceof
Message ) {
1032 $this->mSubtitle[] = $str->setContext( $this->
getContext() )->parse();
1034 $this->mSubtitle[] = $str;
1047 if (
$title->isRedirect() ) {
1048 $query[
'redirect'] =
'no';
1050 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
1069 $this->mSubtitle = [];
1078 return implode(
"<br />\n\t\t\t\t", $this->mSubtitle );
1086 $this->mPrintable =
true;
1095 return $this->mPrintable;
1102 $this->mDoNothing =
true;
1111 return $this->mDoNothing;
1120 return $this->mNewSectionLink;
1129 return $this->mHideNewSectionLink;
1144 $this->mFeedLinks = [];
1155 if ( $this->
getConfig()->
get(
'Feed' ) ) {
1156 return $this->
getConfig()->get(
'AdvertisedFeedTypes' );
1172 $this->mFeedLinks = [];
1176 if ( is_string( $val ) ) {
1191 $this->mFeedLinks[$format] = $href;
1200 return count( $this->mFeedLinks ) > 0;
1208 return $this->mFeedLinks;
1217 return $this->mFeedLinksAppendQuery;
1228 $this->mIsArticle = $newVal;
1230 $this->mIsArticleRelated = $newVal;
1241 return $this->mIsArticle;
1251 $this->mIsArticleRelated = $newVal;
1253 $this->mIsArticle =
false;
1263 return $this->mIsArticleRelated;
1272 $this->mHasCopyright = $hasCopyright;
1285 return $this->
isArticle() || $this->mHasCopyright;
1295 $this->mLanguageLinks = array_merge( $this->mLanguageLinks, $newLinkArray );
1305 $this->mLanguageLinks = $newLinkArray;
1314 return $this->mLanguageLinks;
1323 if ( !$categories ) {
1329 # Set all the values to 'normal'.
1330 $categories = array_fill_keys( array_keys( $categories ),
'normal' );
1332 # Mark hidden categories
1333 foreach (
$res as $row ) {
1334 if ( isset( $row->pp_value ) ) {
1335 $categories[$row->page_title] =
'hidden';
1340 $outputPage = $this;
1341 # Add the remaining categories to the skin
1343 'OutputPageMakeCategoryLinks',
1344 [ &$outputPage, $categories, &$this->mCategoryLinks ] )
1346 $services = MediaWikiServices::getInstance();
1348 foreach ( $categories
as $category =>
$type ) {
1350 $category = (
string)$category;
1351 $origcategory = $category;
1356 $services->getContentLanguage()->findVariantLink( $category,
$title,
true );
1357 if ( $category != $origcategory && array_key_exists( $category, $categories ) ) {
1360 $text =
$services->getContentLanguage()->convertHtml(
$title->getText() );
1372 # Add the links to a LinkBatch
1377 # Fetch existence plus the hiddencat property
1379 $fields = array_merge(
1380 LinkCache::getSelectFields(),
1381 [
'page_namespace',
'page_title',
'pp_value' ]
1384 $res =
$dbr->select( [
'page',
'page_props' ],
1386 $lb->constructSet(
'page',
$dbr ),
1389 [
'page_props' => [
'LEFT JOIN', [
1390 'pp_propname' =>
'hiddencat',
1395 # Add the results to the link cache
1396 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
1397 $lb->addResultToCache( $linkCache,
$res );
1408 $this->mCategoryLinks = [];
1421 return $this->mCategoryLinks;
1434 if (
$type ===
'all' ) {
1435 $allCategories = [];
1436 foreach ( $this->mCategories
as $categories ) {
1437 $allCategories = array_merge( $allCategories, $categories );
1439 return $allCategories;
1441 if ( !isset( $this->mCategories[
$type] ) ) {
1442 throw new InvalidArgumentException(
'Invalid category type given: ' .
$type );
1444 return $this->mCategories[
$type];
1457 $this->mIndicators = $indicators + $this->mIndicators;
1459 ksort( $this->mIndicators );
1471 return $this->mIndicators;
1484 $text = $this->
msg(
'helppage-top-gethelp' )->escaped();
1486 if ( $overrideBaseUrl ) {
1489 $toUrlencoded =
wfUrlencode( str_replace(
' ',
'_', $to ) );
1490 $helpUrl =
"//www.mediawiki.org/wiki/Special:MyLanguage/$toUrlencoded";
1493 $link = Html::rawElement(
1497 'target' =>
'_blank',
1498 'class' =>
'mw-helplink',
1522 if ( $this->
getConfig()->
get(
'AllowSiteCSSOnRestrictedPages' ) ) {
1541 return min( array_values( $this->mAllowedModules ) );
1566 $this->mBodytext = $text . $this->mBodytext;
1575 $this->mBodytext .= $text;
1595 $this->mBodytext =
'';
1604 return $this->mBodytext;
1616 wfDeprecated( __METHOD__ .
' with non-null $options',
'1.31' );
1622 $anonPO = ParserOptions::newFromAnon();
1623 $anonPO->setAllowUnsafeRawHtml(
false );
1624 if ( !
$options->matches( $anonPO ) ) {
1630 if ( !$this->mParserOptions ) {
1631 if ( !$this->
getUser()->isSafeToLoad() ) {
1635 $po = ParserOptions::newFromAnon();
1636 $po->setAllowUnsafeRawHtml(
false );
1637 $po->isBogus =
true;
1644 $this->mParserOptions = ParserOptions::newFromContext( $this->
getContext() );
1645 $this->mParserOptions->setAllowUnsafeRawHtml(
false );
1651 return wfSetVar( $this->mParserOptions,
null,
true );
1665 $val = is_null( $revid ) ?
null : intval( $revid );
1666 return wfSetVar( $this->mRevisionId, $val,
true );
1675 return $this->mRevisionId;
1686 return wfSetVar( $this->mRevisionTimestamp, $timestamp,
true );
1696 return $this->mRevisionTimestamp;
1708 $val = [
'time' =>
$file->getTimestamp(),
'sha1' =>
$file->getSha1() ];
1710 return wfSetVar( $this->mFileVersion, $val,
true );
1719 return $this->mFileVersion;
1729 return $this->mTemplateIds;
1739 return $this->mImageTimeKeys;
1754 public function addWikiText( $text, $linestart =
true, $interface =
true ) {
1780 $text, $linestart =
true,
Title $title =
null
1805 $wrapperClass, $text
1830 $text, $linestart =
true,
Title $title =
null
1907 $tidy =
false, $interface =
false
1930 $text,
Title $title, $linestart, $tidy, $interface, $wrapperClass =
null
1937 $text,
$title, $linestart, $tidy, $interface,
null
1941 'enableSectionEditLinks' =>
false,
1942 'wrapperDivClass' => $wrapperClass ??
'',
1955 $this->mLanguageLinks =
1966 $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->
getHeadItems() );
1970 $this->mPreventClickjacking = $this->mPreventClickjacking
1975 if ( isset( $this->mTemplateIds[$ns] ) ) {
1976 $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1978 $this->mTemplateIds[$ns] = $dbks;
1983 $this->mImageTimeKeys[$dbk] =
$data;
1987 $parserOutputHooks = $this->
getConfig()->get(
'ParserOutputHooks' );
1990 if ( isset( $parserOutputHooks[$hookName] ) ) {
1991 $parserOutputHooks[$hookName]( $this, $parserOutput,
$data );
2001 if ( !$this->limitReportJSData ) {
2009 $outputPage = $this;
2010 Hooks::run(
'LanguageLinks', [ $this->
getTitle(), &$this->mLanguageLinks, &$linkFlags ] );
2011 Hooks::runWithoutAbort(
'OutputPageParserOutput', [ &$outputPage, $parserOutput ] );
2018 $this->mEnableTOC =
true;
2047 $text = $parserOutput->
getText( $poOptions );
2049 $outputPage = $this;
2050 Hooks::runWithoutAbort(
'OutputPageBeforeHTML', [ &$outputPage, &$text ] );
2092 public function parse( $text, $linestart =
true, $interface =
false, $language =
null ) {
2095 $text, $this->
getTitle(), $linestart,
false, $interface, $language
2097 'enableSectionEditLinks' =>
false,
2114 $text, $this->
getTitle(), $linestart,
true,
false,
null
2116 'enableSectionEditLinks' =>
false,
2117 'wrapperDivClass' =>
''
2135 $text, $this->
getTitle(), $linestart,
true,
true,
null
2137 'enableSectionEditLinks' =>
false,
2138 'wrapperDivClass' =>
''
2157 return Parser::stripOuterParagraph(
2175 public function parseInline( $text, $linestart =
true, $interface =
false ) {
2178 $text, $this->
getTitle(), $linestart,
false, $interface,
null
2180 'enableSectionEditLinks' =>
false,
2181 'wrapperDivClass' =>
'',
2183 return Parser::stripOuterParagraph( $parsed );
2200 private function parseInternal( $text, $title, $linestart, $tidy, $interface, $language ) {
2203 if ( is_null(
$title ) ) {
2204 throw new MWException(
'Empty $mTitle in ' . __METHOD__ );
2208 $oldTidy = $popts->setTidy( $tidy );
2209 $oldInterface = $popts->setInterfaceMessage( (
bool)$interface );
2211 if ( $language !==
null ) {
2212 $oldLang = $popts->setTargetLanguage( $language );
2215 $parserOutput =
$wgParser->getFreshParser()->parse(
2217 $linestart,
true, $this->mRevisionId
2220 $popts->setTidy( $oldTidy );
2221 $popts->setInterfaceMessage( $oldInterface );
2223 if ( $language !==
null ) {
2224 $popts->setTargetLanguage( $oldLang );
2227 return $parserOutput;
2236 $this->mCdnMaxage = min( $maxage, $this->mCdnMaxageLimit );
2249 $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
2266 $minTTL = $minTTL ?: IExpiringStore::TTL_MINUTE;
2267 $maxTTL = $maxTTL ?: $this->
getConfig()->get(
'SquidMaxage' );
2269 if ( $mtime ===
null || $mtime ===
false ) {
2273 $age = MWTimestamp::time() -
wfTimestamp( TS_UNIX, $mtime );
2274 $adaptiveTTL = max( 0.9 * $age, $minTTL );
2275 $adaptiveTTL = min( $adaptiveTTL, $maxTTL );
2288 return wfSetVar( $this->mEnableClientCache, $state );
2297 if ( self::$cacheVaryCookies ===
null ) {
2299 self::$cacheVaryCookies = array_values( array_unique( array_merge(
2300 SessionManager::singleton()->getVaryCookies(),
2304 $config->get(
'CacheVaryCookies' )
2306 Hooks::run(
'GetCacheVaryCookies', [ $this, &self::$cacheVaryCookies ] );
2308 return self::$cacheVaryCookies;
2320 if (
$request->getCookie( $cookieName,
'',
'' ) !==
'' ) {
2321 wfDebug( __METHOD__ .
": found $cookieName\n" );
2325 wfDebug( __METHOD__ .
": no cache-varying cookies found\n" );
2338 if ( !array_key_exists(
$header, $this->mVaryHeader ) ) {
2339 $this->mVaryHeader[
$header] = [];
2341 if ( !is_array( $option ) ) {
2345 array_unique( array_merge( $this->mVaryHeader[
$header], $option ) );
2360 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2363 return 'Vary: ' . implode(
', ', array_keys( $this->mVaryHeader ) );
2372 $this->mLinkHeader[] =
$header;
2381 if ( !$this->mLinkHeader ) {
2385 return 'Link: ' . implode(
',', $this->mLinkHeader );
2400 $cookiesOption = [];
2401 foreach ( $cvCookies
as $cookieName ) {
2402 $cookiesOption[] =
'param=' . $cookieName;
2406 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2411 foreach ( $this->mVaryHeader
as $header => $option ) {
2413 if ( is_array( $option ) && count( $option ) > 0 ) {
2414 $newheader .=
';' . implode(
';', $option );
2416 $headers[] = $newheader;
2418 $key =
'Key: ' . implode(
',', $headers );
2437 if ( !$this->
getRequest()->getCheck(
'variant' ) &&
$lang->hasVariants() ) {
2438 $variants =
$lang->getVariants();
2440 foreach ( $variants
as $variant ) {
2441 if ( $variant ===
$lang->getCode() ) {
2455 $aloption[] =
"substr=$variant";
2459 $variantBCP47 = LanguageCode::bcp47( $variant );
2460 if ( $variantBCP47 !== $variant ) {
2461 $aloption[] =
"substr=$variantBCP47";
2479 $this->mPreventClickjacking = $enable;
2488 $this->mPreventClickjacking =
false;
2498 return $this->mPreventClickjacking;
2510 if ( $config->get(
'BreakFrames' ) ) {
2512 } elseif ( $this->mPreventClickjacking && $config->get(
'EditPageFrameOptions' ) ) {
2513 return $config->get(
'EditPageFrameOptions' );
2527 return $config->get(
'OriginTrials' );
2540 # don't serve compressed data to clients who can't handle it
2541 # maintain different caches for logged-in users and non-logged in ones
2544 if ( $config->get(
'UseKeyHeader' ) ) {
2548 if ( $this->mEnableClientCache ) {
2550 $config->get(
'UseSquid' ) &&
2552 !SessionManager::getGlobalSession()->isPersistent() &&
2553 !$this->isPrintable() &&
2554 $this->mCdnMaxage != 0 &&
2555 !$this->haveCacheVaryCookies()
2557 if ( $config->get(
'UseESI' ) ) {
2559 # We'll purge the proxy cache explicitly, but require end user agents
2560 # to revalidate against the proxy on each visit.
2561 # Surrogate-Control controls our CDN, Cache-Control downstream caches
2563 ": proxy caching with ESI; {$this->mLastModified} **",
'private' );
2564 # start with a shorter timeout for initial testing
2565 # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
2567 "Surrogate-Control: max-age={$config->get( 'SquidMaxage' )}" .
2568 "+{$this->mCdnMaxage}, content=\"ESI/1.0\""
2570 $response->header(
'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
2572 # We'll purge the proxy cache for anons explicitly, but require end user agents
2573 # to revalidate against the proxy on each visit.
2574 # IMPORTANT! The CDN needs to replace the Cache-Control header with
2575 # Cache-Control: s-maxage=0, must-revalidate, max-age=0
2577 ": local proxy caching; {$this->mLastModified} **",
'private' );
2578 # start with a shorter timeout for initial testing
2579 # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
2581 "s-maxage={$this->mCdnMaxage}, must-revalidate, max-age=0" );
2584 # We do want clients to cache if they can, but they *must* check for updates
2585 # on revisiting the page.
2586 wfDebug( __METHOD__ .
": private caching; {$this->mLastModified} **",
'private' );
2587 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
2588 $response->header(
"Cache-Control: private, must-revalidate, max-age=0" );
2590 if ( $this->mLastModified ) {
2591 $response->header(
"Last-Modified: {$this->mLastModified}" );
2594 wfDebug( __METHOD__ .
": no caching **",
'private' );
2596 # In general, the absence of a last modified header should be enough to prevent
2597 # the client from using its cache. We send a few other things just to make sure.
2598 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
2599 $response->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2600 $response->header(
'Pragma: no-cache' );
2610 foreach ( $sk->getDefaultModules()
as $group =>
$modules ) {
2611 if ( $group ===
'styles' ) {
2612 foreach (
$modules as $key => $moduleMembers ) {
2632 if ( $this->mDoNothing ) {
2633 return $return ?
'' :
null;
2639 if ( $this->mRedirect !=
'' ) {
2640 # Standards require redirect URLs to be absolute
2643 $redirect = $this->mRedirect;
2644 $code = $this->mRedirectCode;
2646 if ( Hooks::run(
"BeforePageRedirect", [ $this, &$redirect, &
$code ] ) ) {
2648 if ( !$config->get(
'DebugRedirects' ) ) {
2653 if ( $config->get(
'VaryOnXFP' ) ) {
2658 $response->header(
"Content-Type: text/html; charset=utf-8" );
2659 if ( $config->get(
'DebugRedirects' ) ) {
2660 $url = htmlspecialchars( $redirect );
2661 print "<!DOCTYPE html>\n<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2662 print "<p>Location: <a href=\"$url\">$url</a></p>\n";
2663 print "</body>\n</html>\n";
2665 $response->header(
'Location: ' . $redirect );
2669 return $return ?
'' :
null;
2670 } elseif ( $this->mStatusCode ) {
2671 $response->statusHeader( $this->mStatusCode );
2674 # Buffer output; final headers may depend on later processing
2677 $response->header(
'Content-type: ' . $config->get(
'MimeType' ) .
'; charset=UTF-8' );
2678 $response->header(
'Content-language: ' .
2679 MediaWikiServices::getInstance()->getContentLanguage()->getHtmlCode() );
2681 if ( !$this->mArticleBodyOnly ) {
2686 if ( $linkHeader ) {
2692 if ( $frameOptions ) {
2693 $response->header(
"X-Frame-Options: $frameOptions" );
2697 foreach ( $originTrials
as $originTrial ) {
2698 $response->header(
"Origin-Trial: $originTrial",
false );
2703 if ( $this->mArticleBodyOnly ) {
2704 echo $this->mBodytext;
2707 if ( $this->
getRequest()->getBool(
'safemode' ) ) {
2714 MWDebug::addModules( $this );
2717 $outputPage = $this;
2720 Hooks::runWithoutAbort(
'BeforePageDisplay', [ &$outputPage, &$sk ] );
2724 }
catch ( Exception
$e ) {
2732 Hooks::runWithoutAbort(
'AfterFinalPageOutput', [ $this ] );
2733 }
catch ( Exception
$e ) {
2741 return ob_get_clean();
2760 if ( $htmlTitle !==
false ) {
2766 $this->mRedirect =
'';
2790 if ( $msg instanceof
Message ) {
2792 trigger_error(
'Argument ignored: $params. The message parameters argument '
2793 .
'is discarded when the $msg argument is a Message object instead of '
2794 .
'a string.', E_USER_NOTICE );
2796 $this->
addHTML( $msg->parseAsBlock() );
2811 foreach ( $errors
as $key => $error ) {
2812 $errors[$key] = (
array)$error;
2820 if ( in_array( $action, [
'read',
'edit',
'createpage',
'createtalk',
'upload' ] )
2821 && $this->
getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2822 && ( $errors[0][0] ==
'badaccess-groups' || $errors[0][0] ==
'badaccess-group0' )
2826 $displayReturnto =
null;
2828 # Due to T34276, if a user does not have read permissions,
2829 # $this->getTitle() will just give Special:Badtitle, which is
2830 # not especially useful as a returnto parameter. Use the title
2831 # from the request instead, if there was one.
2833 $returnto = Title::newFromText(
$request->getVal(
'title',
'' ) );
2834 if ( $action ==
'edit' ) {
2835 $msg =
'whitelistedittext';
2836 $displayReturnto = $returnto;
2837 } elseif ( $action ==
'createpage' || $action ==
'createtalk' ) {
2838 $msg =
'nocreatetext';
2839 } elseif ( $action ==
'upload' ) {
2840 $msg =
'uploadnologintext';
2842 $msg =
'loginreqpagetext';
2843 $displayReturnto = Title::newMainPage();
2849 $query[
'returnto'] = $returnto->getPrefixedText();
2852 $returntoquery =
$request->getValues();
2853 unset( $returntoquery[
'title'] );
2854 unset( $returntoquery[
'returnto'] );
2855 unset( $returntoquery[
'returntoquery'] );
2859 $title = SpecialPage::getTitleFor(
'Userlogin' );
2860 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
2864 $this->
msg(
'loginreqlink' )->
text(),
2870 $this->
addHTML( $this->
msg( $msg )->rawParams( $loginLink )->params( $loginUrl )->
parse() );
2872 # Don't return to a page the user can't read otherwise
2873 # we'll end up in a pointless loop
2874 if ( $displayReturnto && $displayReturnto->userCan(
'read', $this->getUser() ) ) {
2892 $this->
addWikiMsg(
'versionrequiredtext', $version );
2904 if ( $action ==
null ) {
2905 $text = $this->
msg(
'permissionserrorstext', count( $errors ) )->plain() .
"\n\n";
2907 $action_desc = $this->
msg(
"action-$action" )->plain();
2909 'permissionserrorstext-withaction',
2912 )->plain() .
"\n\n";
2915 if ( count( $errors ) > 1 ) {
2916 $text .=
'<ul class="permissions-errors">' .
"\n";
2918 foreach ( $errors
as $error ) {
2920 $text .= $this->
msg( ...$error )->plain();
2925 $text .=
"<div class=\"permissions-errors\">\n" .
2926 $this->
msg( ...reset( $errors ) )->plain() .
2944 if ( $lag >= $config->get(
'SlaveLagWarning' ) ) {
2945 $lag = floor( $lag );
2946 $message = $lag < $config->get(
'SlaveLagCritical' )
2949 $wrap = Html::rawElement(
'div', [
'class' =>
"mw-{$message}" ],
"\n$1\n" );
2987 $this->
showFatalError( $this->
msg(
'filerenameerror', $old, $new )->escaped() );
3016 ->getLinkRendererFactory()->createFromLegacyOptions(
$options );
3017 $link = $this->
msg(
'returnto' )->rawParams(
3019 $this->
addHTML(
"<p id=\"mw-returnto\">{$link}</p>\n" );
3030 public function returnToMain( $unused =
null, $returnto =
null, $returntoquery =
null ) {
3031 if ( $returnto ==
null ) {
3032 $returnto = $this->
getRequest()->getText(
'returnto' );
3035 if ( $returntoquery ==
null ) {
3036 $returntoquery = $this->
getRequest()->getText(
'returntoquery' );
3039 if ( $returnto ===
'' ) {
3040 $returnto = Title::newMainPage();
3043 if ( is_object( $returnto ) ) {
3044 $titleObj = $returnto;
3046 $titleObj = Title::newFromText( $returnto );
3050 if ( !is_object( $titleObj ) || $titleObj->isExternal() ) {
3051 $titleObj = Title::newMainPage();
3058 if ( !$this->rlClientContext ) {
3059 $query = ResourceLoader::makeLoaderQuery(
3062 $this->
getSkin()->getSkinName(),
3063 $this->
getUser()->isLoggedIn() ? $this->
getUser()->getName() :
null,
3065 ResourceLoader::inDebugMode(),
3074 if ( $this->contentOverrideCallbacks ) {
3076 $this->rlClientContext->setContentOverrideCallback(
function (
Title $title ) {
3077 foreach ( $this->contentOverrideCallbacks
as $callback ) {
3080 $text = ContentHandler::getContentText(
$content );
3081 if ( strpos( $text,
'</script>' ) !==
false ) {
3085 $titleFormatted =
$title->getPrefixedText();
3087 Xml::encodeJsCall(
'mw.log.error', [
3088 "Cannot preview $titleFormatted due to script-closing tag."
3099 return $this->rlClientContext;
3114 if ( !$this->rlClient ) {
3127 $this->
getSkin()->setupSkinUserCss( $this );
3130 $exemptGroups = [
'site' => [],
'noscript' => [],
'private' => [],
'user' => [] ];
3136 $userBatch = [
'user.styles',
'user' ];
3137 $siteBatch = array_diff( $moduleStyles, $userBatch );
3139 ResourceLoaderWikiModule::preloadTitleInfo(
$context,
$dbr, $siteBatch );
3140 ResourceLoaderWikiModule::preloadTitleInfo(
$context,
$dbr, $userBatch );
3143 $moduleStyles = array_filter( $moduleStyles,
3145 $module = $rl->getModule(
$name );
3147 $group = $module->getGroup();
3148 if ( isset( $exemptGroups[$group] ) ) {
3149 $exemptStates[
$name] =
'ready';
3150 if ( !$module->isKnownEmpty(
$context ) ) {
3152 $exemptGroups[$group][] = $name;
3160 $this->rlExemptStyleModules = $exemptGroups;
3182 return $this->rlClient;
3192 $sitedir = MediaWikiServices::getInstance()->getContentLanguage()->getDir();
3195 $pieces[] = Html::htmlHeader( Sanitizer::mergeAttributes(
3199 $pieces[] = Html::openElement(
'head' );
3205 if ( !Html::isXmlMimeType( $this->
getConfig()->
get(
'MimeType' ) ) ) {
3214 $pieces[] = Html::element(
'meta', [
'charset' =>
'UTF-8' ] );
3217 $pieces[] = Html::element(
'title',
null, $this->
getHTMLTitle() );
3221 $pieces = array_merge( $pieces, array_values( $this->mHeadItems ) );
3224 $pieces[] =
'<!--[if lt IE 9]>' .
3237 $pieces[] = Html::closeElement(
'head' );
3239 $bodyClasses = $this->mAdditionalBodyClasses;
3240 $bodyClasses[] =
'mediawiki';
3242 # Classes for LTR/RTL directionality support
3243 $bodyClasses[] = $userdir;
3244 $bodyClasses[] =
"sitedir-$sitedir";
3246 $underline = $this->
getUser()->getOption(
'underline' );
3247 if ( $underline < 2 ) {
3251 $bodyClasses[] =
'mw-underline-' . ( $underline ?
'always' :
'never' );
3254 if ( $this->
getLanguage()->capitalizeAllNouns() ) {
3255 # A <body> class is probably not the best way to do this . . .
3256 $bodyClasses[] =
'capitalize-all-nouns';
3262 $bodyClasses[] =
'mw-hide-empty-elt';
3265 $bodyClasses[] =
'skin-' . Sanitizer::escapeClass( $sk->
getSkinName() );
3267 'action-' . Sanitizer::escapeClass( Action::getActionName( $this->
getContext() ) );
3272 $bodyAttrs[
'class'] = implode(
' ', $bodyClasses );
3276 Hooks::run(
'OutputPageBodyAttributes', [ $this, $sk, &$bodyAttrs ] );
3278 $pieces[] = Html::openElement(
'body', $bodyAttrs );
3280 return self::combineWrappedStrings( $pieces );
3289 if ( is_null( $this->mResourceLoader ) ) {
3291 $this->mResourceLoader = MediaWikiServices::getInstance()->getResourceLoader();
3293 return $this->mResourceLoader;
3325 $chunks = array_filter( $chunks,
'strlen' );
3326 return WrappedString::join(
"\n", $chunks );
3340 $chunks[] = $this->mScripts;
3342 if ( $this->limitReportJSData ) {
3343 $chunks[] = ResourceLoader::makeInlineScript(
3344 ResourceLoader::makeConfigSetScript(
3345 [
'wgPageParseReport' => $this->limitReportJSData ]
3351 return self::combineWrappedStrings( $chunks );
3361 return $this->mJsConfigVars;
3371 if ( is_array(
$keys ) ) {
3373 $this->mJsConfigVars[$key] =
$value;
3393 $canonicalSpecialPageName =
false; # T23115
3394 $services = MediaWikiServices::getInstance();
3397 $ns =
$title->getNamespace();
3398 $canonicalNamespace = MWNamespace::exists( $ns )
3399 ? MWNamespace::getCanonicalName( $ns )
3405 $relevantTitle = $sk->getRelevantTitle();
3406 $relevantUser = $sk->getRelevantUser();
3409 list( $canonicalSpecialPageName, ) =
3411 resolveAlias(
$title->getDBkey() );
3414 $curRevisionId = $wikiPage->getLatest();
3415 $articleId = $wikiPage->getId();
3421 $separatorTransTable =
$lang->separatorTransformTable();
3422 $separatorTransTable = $separatorTransTable ?: [];
3423 $compactSeparatorTransTable = [
3424 implode(
"\t", array_keys( $separatorTransTable ) ),
3425 implode(
"\t", $separatorTransTable ),
3427 $digitTransTable =
$lang->digitTransformTable();
3428 $digitTransTable = $digitTransTable ?: [];
3429 $compactDigitTransTable = [
3430 implode(
"\t", array_keys( $digitTransTable ) ),
3431 implode(
"\t", $digitTransTable ),
3437 'wgCanonicalNamespace' => $canonicalNamespace,
3438 'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3439 'wgNamespaceNumber' =>
$title->getNamespace(),
3440 'wgPageName' =>
$title->getPrefixedDBkey(),
3441 'wgTitle' =>
$title->getText(),
3442 'wgCurRevisionId' => $curRevisionId,
3444 'wgArticleId' => $articleId,
3446 'wgIsRedirect' =>
$title->isRedirect(),
3447 'wgAction' => Action::getActionName( $this->
getContext() ),
3449 'wgUserGroups' =>
$user->getEffectiveGroups(),
3452 'wgPageContentLanguage' =>
$lang->getCode(),
3453 'wgPageContentModel' =>
$title->getContentModel(),
3454 'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3455 'wgDigitTransformTable' => $compactDigitTransTable,
3456 'wgDefaultDateFormat' =>
$lang->getDefaultDateFormat(),
3457 'wgMonthNames' =>
$lang->getMonthNamesArray(),
3458 'wgMonthNamesShort' =>
$lang->getMonthAbbreviationsArray(),
3459 'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3460 'wgRelevantArticleId' => $relevantTitle->getArticleID(),
3461 'wgRequestId' => WebRequest::getRequestId(),
3465 if (
$user->isLoggedIn() ) {
3467 $vars[
'wgUserEditCount'] =
$user->getEditCount();
3468 $userReg =
$user->getRegistration();
3469 $vars[
'wgUserRegistration'] = $userReg ?
wfTimestamp( TS_UNIX, $userReg ) * 1000 :
null;
3473 $vars[
'wgUserNewMsgRevisionId'] =
$user->getNewMessageRevisionId();
3476 $contLang =
$services->getContentLanguage();
3477 if ( $contLang->hasVariants() ) {
3478 $vars[
'wgUserVariant'] = $contLang->getPreferredVariant();
3484 $vars[
'wgRelevantPageIsProbablyEditable'] = $relevantTitle
3485 && $relevantTitle->quickUserCan(
'edit',
$user )
3486 && ( $relevantTitle->exists() || $relevantTitle->quickUserCan(
'create',
$user ) );
3494 if (
$title->isMainPage() ) {
3495 $vars[
'wgIsMainPage'] =
true;
3498 if ( $this->mRedirectedFrom ) {
3499 $vars[
'wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3502 if ( $relevantUser ) {
3503 $vars[
'wgRelevantUserName'] = $relevantUser->getName();
3510 Hooks::run(
'MakeGlobalVariablesScript', [ &
$vars, $this ] );
3528 $request->getVal(
'action' ) !==
'submit' ||
3536 if ( !
$user->isLoggedIn() ) {
3540 if ( !
$user->matchEditToken(
$request->getVal(
'wpEditToken' ) ) ) {
3545 $errors =
$title->getUserPermissionsErrors(
'edit',
$user );
3546 if ( count( $errors ) !== 0 ) {
3562 $canonicalUrl = $this->mCanonicalUrl;
3564 $tags[
'meta-generator'] = Html::element(
'meta', [
3565 'name' =>
'generator',
3566 'content' =>
"MediaWiki $wgVersion",
3569 if ( $config->get(
'ReferrerPolicy' ) !==
false ) {
3572 foreach ( array_reverse( (
array)$config->get(
'ReferrerPolicy' ) )
as $i => $policy ) {
3573 $tags[
"meta-referrer-$i"] = Html::element(
'meta', [
3574 'name' =>
'referrer',
3575 'content' => $policy,
3580 $p =
"{$this->mIndexPolicy},{$this->mFollowPolicy}";
3581 if ( $p !==
'index,follow' ) {
3584 $tags[
'meta-robots'] = Html::element(
'meta', [
3590 foreach ( $this->mMetatags
as $tag ) {
3591 if ( strncasecmp( $tag[0],
'http:', 5 ) === 0 ) {
3593 $tag[0] = substr( $tag[0], 5 );
3594 } elseif ( strncasecmp( $tag[0],
'og:', 3 ) === 0 ) {
3599 $tagName =
"meta-{$tag[0]}";
3600 if ( isset( $tags[$tagName] ) ) {
3601 $tagName .= $tag[1];
3603 $tags[$tagName] = Html::element(
'meta',
3606 'content' => $tag[1]
3611 foreach ( $this->mLinktags
as $tag ) {
3612 $tags[] = Html::element(
'link', $tag );
3615 # Universal edit button
3616 if ( $config->get(
'UniversalEditButton' ) && $this->isArticleRelated() ) {
3619 && ( $this->
getTitle()->exists() ||
3623 $msg = $this->
msg(
'edit' )->text();
3624 $tags[
'universal-edit-button'] = Html::element(
'link', [
3625 'rel' =>
'alternate',
3626 'type' =>
'application/x-wiki',
3628 'href' => $this->
getTitle()->getEditURL(),
3631 $tags[
'alternative-edit'] = Html::element(
'link', [
3634 'href' => $this->
getTitle()->getEditURL(),
3639 # Generally the order of the favicon and apple-touch-icon links
3640 # should not matter, but Konqueror (3.5.9 at least) incorrectly
3641 # uses whichever one appears later in the HTML source. Make sure
3642 # apple-touch-icon is specified first to avoid this.
3643 if ( $config->get(
'AppleTouchIcon' ) !==
false ) {
3644 $tags[
'apple-touch-icon'] = Html::element(
'link', [
3645 'rel' =>
'apple-touch-icon',
3646 'href' => $config->get(
'AppleTouchIcon' )
3650 if ( $config->get(
'Favicon' ) !==
false ) {
3651 $tags[
'favicon'] = Html::element(
'link', [
3652 'rel' =>
'shortcut icon',
3653 'href' => $config->get(
'Favicon' )
3657 # OpenSearch description link
3658 $tags[
'opensearch'] = Html::element(
'link', [
3660 'type' =>
'application/opensearchdescription+xml',
3661 'href' =>
wfScript(
'opensearch_desc' ),
3662 'title' => $this->
msg(
'opensearch-desc' )->inContentLanguage()->
text(),
3665 # Real Simple Discovery link, provides auto-discovery information
3666 # for the MediaWiki API (and potentially additional custom API
3667 # support such as WordPress or Twitter-compatible APIs for a
3668 # blogging extension, etc)
3669 $tags[
'rsd'] = Html::element(
'link', [
3671 'type' =>
'application/rsd+xml',
3677 [
'action' =>
'rsd' ] ),
3683 if ( !$config->get(
'DisableLangConversion' ) ) {
3685 if (
$lang->hasVariants() ) {
3686 $variants =
$lang->getVariants();
3687 foreach ( $variants
as $variant ) {
3688 $tags[
"variant-$variant"] = Html::element(
'link', [
3689 'rel' =>
'alternate',
3690 'hreflang' => LanguageCode::bcp47( $variant ),
3691 'href' => $this->
getTitle()->getLocalURL(
3692 [
'variant' => $variant ] )
3696 # x-default link per https:
3697 $tags[
"variant-x-default"] = Html::element(
'link', [
3698 'rel' =>
'alternate',
3699 'hreflang' =>
'x-default',
3700 'href' => $this->
getTitle()->getLocalURL() ] );
3705 if ( $this->copyrightUrl !==
null ) {
3706 $copyright = $this->copyrightUrl;
3709 if ( $config->get(
'RightsPage' ) ) {
3710 $copy = Title::newFromText( $config->get(
'RightsPage' ) );
3713 $copyright = $copy->getLocalURL();
3717 if ( !$copyright && $config->get(
'RightsUrl' ) ) {
3718 $copyright = $config->get(
'RightsUrl' );
3723 $tags[
'copyright'] = Html::element(
'link', [
3725 'href' => $copyright ]
3730 if ( $config->get(
'Feed' ) ) {
3734 # Use the page name for the title. In principle, this could
3735 # lead to issues with having the same name for different feeds
3736 # corresponding to the same page, but we can't avoid that at
3742 # Used
messages:
'page-rss-feed' and 'page-atom-feed' (
for an easier grep)
3744 "page-{$format}-feed", $this->
getTitle()->getPrefixedText()
3749 # Recent changes feed should appear on every page (except recentchanges,
3750 # that would be redundant). Put it after the per-page feed to avoid
3751 # changing existing behavior. It's still available, probably via a
3752 # menu in your browser. Some sites might have a different feed they'd
3753 # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3754 # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3755 # If so, use it instead.
3756 $sitename = $config->get(
'Sitename' );
3757 $overrideSiteFeed = $config->get(
'OverrideSiteFeed' );
3758 if ( $overrideSiteFeed ) {
3759 foreach ( $overrideSiteFeed
as $type => $feedUrl ) {
3764 $this->
msg(
"site-{$type}-feed", $sitename )->
text()
3767 } elseif ( !$this->
getTitle()->isSpecial(
'Recentchanges' ) ) {
3768 $rctitle = SpecialPage::getTitleFor(
'Recentchanges' );
3772 $rctitle->getLocalURL( [
'feed' => $format ] ),
3773 # For grep:
'site-rss-feed',
'site-atom-feed'
3774 $this->
msg(
"site-{$format}-feed", $sitename )->text()
3779 # Allow extensions to change the list pf feeds. This hook is primarily for changing,
3780 # manipulating or removing existing feed tags. If you want to add new feeds, you should
3781 # use OutputPage::addFeedLink() instead.
3782 Hooks::run(
'AfterBuildFeedLinks', [ &$feedLinks ] );
3784 $tags += $feedLinks;
3788 if ( $config->get(
'EnableCanonicalServerLink' ) ) {
3789 if ( $canonicalUrl !==
false ) {
3799 $action = Action::getActionName( $this->
getContext() );
3800 if ( in_array( $action, [
'history',
'info' ] ) ) {
3801 $query =
"action={$action}";
3807 $reqUrl = $this->
getRequest()->getRequestURL();
3811 if ( $canonicalUrl !==
false ) {
3812 $tags[] = Html::element(
'link', [
3813 'rel' =>
'canonical',
3814 'href' => $canonicalUrl
3823 Hooks::run(
'OutputPageAfterGetHeadLinksArray', [ &$tags, $this ] );
3837 return Html::element(
'link', [
3838 'rel' =>
'alternate',
3839 'type' =>
"application/$type+xml",
3854 public function addStyle( $style, $media =
'', $condition =
'', $dir =
'' ) {
3860 $options[
'condition'] = $condition;
3876 if ( $flip ===
'flip' && $this->
getLanguage()->isRTL() ) {
3877 # If wanted, and the interface is right-to-left, flip the CSS
3878 $style_css = CSSJanus::transform( $style_css,
true,
false );
3880 $this->mInlineStyles .= Html::inlineStyle( $style_css );
3904 $chunks[] = Html::element(
3906 [
'name' =>
'ResourceLoaderDynamicStyles',
'content' =>
'' ]
3909 $separateReq = [
'site.styles',
'user.styles' ];
3910 foreach ( $this->rlExemptStyleModules
as $group => $moduleNames ) {
3913 array_diff( $moduleNames, $separateReq ),
3917 foreach ( array_intersect( $moduleNames, $separateReq )
as $name ) {
3926 return self::combineWrappedStrings( array_merge( $chunks, $append ) );
3956 if ( isset(
$options[
'media'] ) ) {
3957 $media = self::transformCssMedia(
$options[
'media'] );
3958 if ( is_null( $media ) ) {
3965 if ( substr( $style, 0, 1 ) ==
'/' ||
3966 substr( $style, 0, 5 ) ==
'http:' ||
3967 substr( $style, 0, 6 ) ==
'https:' ) {
3972 $url = self::transformResourcePath(
3974 $config->get(
'StylePath' ) .
'/' . $style
3978 $link = Html::linkedStyle( $url, $media );
3980 if ( isset(
$options[
'condition'] ) ) {
3981 $condition = htmlspecialchars(
$options[
'condition'] );
3982 $link =
"<!--[if $condition]>$link<![endif]-->";
4012 $remotePathPrefix = $config->
get(
'ResourceBasePath' );
4013 if ( $remotePathPrefix ===
'' ) {
4018 $remotePath = $remotePathPrefix;
4020 if ( strpos(
$path, $remotePath ) !== 0 || substr(
$path, 0, 2 ) ===
'//' ) {
4029 $uploadPath = $config->
get(
'UploadPath' );
4030 if ( strpos(
$path, $uploadPath ) === 0 ) {
4031 $localDir = $config->
get(
'UploadDirectory' );
4032 $remotePathPrefix = $remotePath = $uploadPath;
4035 $path = RelPath::getRelativePath(
$path, $remotePath );
4036 return self::transformFilePath( $remotePathPrefix, $localDir,
$path );
4051 $hash = md5_file(
"$localPath/$file" );
4052 if ( $hash ===
false ) {
4053 wfLogWarning( __METHOD__ .
": Failed to hash $localPath/$file" );
4056 return "$remotePathPrefix/$file?" . substr( $hash, 0, 5 );
4070 $screenMediaQueryRegex =
'/^(?:only\s+)?screen\b/i';
4074 'printable' =>
'print',
4075 'handheld' =>
'handheld',
4077 foreach ( $switches
as $switch => $targetMedia ) {
4079 if ( $media == $targetMedia ) {
4081 } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
4095 if ( $targetMedia ==
'print' || $media ==
'screen' ) {
4112 $args = func_get_args();
4155 $msgSpecs = func_get_args();
4156 array_shift( $msgSpecs );
4157 $msgSpecs = array_values( $msgSpecs );
4159 foreach ( $msgSpecs
as $n => $spec ) {
4160 if ( is_array( $spec ) ) {
4163 if ( isset(
$args[
'options'] ) ) {
4164 unset(
$args[
'options'] );
4166 'Adding "options" to ' . __METHOD__ .
' is no longer supported',
4185 return $this->mEnableTOC;
4215 public static function setupOOUI( $skinName =
'default', $dir =
'ltr' ) {
4216 $themes = ResourceLoaderOOUIModule::getSkinThemeMap();
4217 $theme = $themes[$skinName] ?? $themes[
'default'];
4219 $themeClass =
"OOUI\\{$theme}Theme";
4220 OOUI\Theme::setSingleton(
new $themeClass() );
4221 OOUI\Element::setDefaultDir( $dir );
4232 strtolower( $this->
getSkin()->getSkinName() ),
4236 'oojs-ui-core.styles',
4237 'oojs-ui.styles.indicators',
4238 'oojs-ui.styles.textures',
4239 'mediawiki.widgets.styles',
4240 'oojs-ui.styles.icons-content',
4241 'oojs-ui.styles.icons-alerts',
4242 'oojs-ui.styles.icons-interactions',
4259 if ( $this->CSPNonce ===
null ) {
4262 $rand = random_bytes( 15 );
4263 $this->CSPNonce = base64_encode( $rand );
4265 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 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...
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.
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.
getAdvertisedFeedTypes()
Return effective list of advertised feed types.
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.
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.
getOriginTrials()
Get the Origin-Trial header values.
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.
Load and configure 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.
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...
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.
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
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
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 hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
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
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 When $user is not null
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
return true to allow those checks to and false if checking is done & $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(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
if(!isset( $args[0])) $lang