X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FOutputPage.php;h=57cd74a490db3c5afe81c6b3ba7687d6008af842;hb=110a5877e9e6ebe7a6ecd758f5812f32fc4ef57e;hp=e0f25cd63a2e0372cb8df8a3b6d0d1dff48edd4f;hpb=c54cdc67eea31159d101e29de9f723f975589c0f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e0f25cd63a..57cd74a490 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -548,15 +548,6 @@ class OutputPage extends ContextSource { $this->mModules = array_merge( $this->mModules, (array)$modules ); } - /** - * @deprecated since 1.33 Use getModules() instead. - * @return array - */ - public function getModuleScripts() { - wfDeprecated( __METHOD__, '1.33' ); - return []; - } - /** * Get the list of style-only modules to load on this page. * @@ -755,10 +746,10 @@ class OutputPage extends ContextSource { 'user' => $this->getUser()->getTouched(), 'epoch' => $config->get( 'CacheEpoch' ) ]; - if ( $config->get( 'UseSquid' ) ) { + if ( $config->get( 'UseCdn' ) ) { $modifiedTimes['sepoch'] = wfTimestamp( TS_MW, $this->getCdnCacheEpoch( time(), - $config->get( 'SquidMaxage' ) + $config->get( 'CdnMaxAge' ) ) ); } Hooks::run( 'OutputPageCheckLastModified', [ &$modifiedTimes, $this ] ); @@ -827,7 +818,7 @@ class OutputPage extends ContextSource { * @return int Timestamp */ private function getCdnCacheEpoch( $reqTime, $maxAge ) { - // Ensure Last-Modified is never more than (wgSquidMaxage) in the past, + // Ensure Last-Modified is never more than $wgCdnMaxAge in the past, // because even if the wiki page content hasn't changed since, static // resources may have changed (skin HTML, interface messages, urls, etc.) // and must roll-over in a timely manner (T46570) @@ -1487,7 +1478,7 @@ class OutputPage extends ContextSource { $helpUrl = $to; } else { $toUrlencoded = wfUrlencode( str_replace( ' ', '_', $to ) ); - $helpUrl = "//www.mediawiki.org/wiki/Special:MyLanguage/$toUrlencoded"; + $helpUrl = "https://www.mediawiki.org/wiki/Special:MyLanguage/$toUrlencoded"; } $link = Html::rawElement( @@ -1732,7 +1723,7 @@ class OutputPage extends ContextSource { /** * Get the files used on this page * - * @return array (dbKey => array('time' => MW timestamp or null, 'sha1' => sha1 or '')) + * @return array [ dbKey => [ 'time' => MW timestamp or null, 'sha1' => sha1 or '' ] ] * @since 1.18 */ public function getFileSearchOptions() { @@ -2257,12 +2248,12 @@ class OutputPage extends ContextSource { * * @param string|int|float|bool|null $mtime Last-Modified timestamp * @param int $minTTL Minimum TTL in seconds [default: 1 minute] - * @param int $maxTTL Maximum TTL in seconds [default: $wgSquidMaxage] + * @param int $maxTTL Maximum TTL in seconds [default: $wgCdnMaxAge] * @since 1.28 */ public function adaptCdnTTL( $mtime, $minTTL = 0, $maxTTL = 0 ) { $minTTL = $minTTL ?: IExpiringStore::TTL_MINUTE; - $maxTTL = $maxTTL ?: $this->getConfig()->get( 'SquidMaxage' ); + $maxTTL = $maxTTL ?: $this->getConfig()->get( 'CdnMaxAge' ); if ( $mtime === null || $mtime === false ) { return $minTTL; // entity does not exist @@ -2576,7 +2567,7 @@ class OutputPage extends ContextSource { if ( $this->mEnableClientCache ) { if ( - $config->get( 'UseSquid' ) && + $config->get( 'UseCdn' ) && !$response->hasCookies() && !SessionManager::getGlobalSession()->isPersistent() && !$this->isPrintable() && @@ -2593,7 +2584,7 @@ class OutputPage extends ContextSource { # start with a shorter timeout for initial testing # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"'); $response->header( - "Surrogate-Control: max-age={$config->get( 'SquidMaxage' )}" . + "Surrogate-Control: max-age={$config->get( 'CdnMaxAge' )}" . "+{$this->mCdnMaxage}, content=\"ESI/1.0\"" ); $response->header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' ); @@ -2891,8 +2882,11 @@ class OutputPage extends ContextSource { $query['returntoquery'] = wfArrayToCgi( $returntoquery ); } } + + $services = MediaWikiServices::getInstance(); + $title = SpecialPage::getTitleFor( 'Userlogin' ); - $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); + $linkRenderer = $services->getLinkRenderer(); $loginUrl = $title->getLinkURL( $query, false, PROTO_RELATIVE ); $loginLink = $linkRenderer->makeKnownLink( $title, @@ -2904,9 +2898,13 @@ class OutputPage extends ContextSource { $this->prepareErrorPage( $this->msg( 'loginreqtitle' ) ); $this->addHTML( $this->msg( $msg )->rawParams( $loginLink )->params( $loginUrl )->parse() ); + $permissionManager = $services->getPermissionManager(); + # Don't return to a page the user can't read otherwise # we'll end up in a pointless loop - if ( $displayReturnto && $displayReturnto->userCan( 'read', $this->getUser() ) ) { + if ( $displayReturnto && $permissionManager->userCan( + 'read', $this->getUser(), $displayReturnto + ) ) { $this->returnToMain( null, $displayReturnto ); } } else { @@ -2998,46 +2996,6 @@ class OutputPage extends ContextSource { $this->addHTML( $message ); } - /** - * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. - */ - public function showUnexpectedValueError( $name, $val ) { - wfDeprecated( __METHOD__, '1.32' ); - $this->showFatalError( $this->msg( 'unexpected', $name, $val )->escaped() ); - } - - /** - * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. - */ - public function showFileCopyError( $old, $new ) { - wfDeprecated( __METHOD__, '1.32' ); - $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->escaped() ); - } - - /** - * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. - */ - public function showFileRenameError( $old, $new ) { - wfDeprecated( __METHOD__, '1.32' ); - $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->escaped() ); - } - - /** - * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. - */ - public function showFileDeleteError( $name ) { - wfDeprecated( __METHOD__, '1.32' ); - $this->showFatalError( $this->msg( 'filedeleteerror', $name )->escaped() ); - } - - /** - * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. - */ - public function showFileNotFoundError( $name ) { - wfDeprecated( __METHOD__, '1.32' ); - $this->showFatalError( $this->msg( 'filenotfound', $name )->escaped() ); - } - /** * Add a "return to" link pointing to a specified title * @@ -4263,9 +4221,7 @@ class OutputPage extends ContextSource { 'oojs-ui.styles.indicators', 'oojs-ui.styles.textures', 'mediawiki.widgets.styles', - 'oojs-ui.styles.icons-content', - 'oojs-ui.styles.icons-alerts', - 'oojs-ui.styles.icons-interactions', + 'oojs-ui-core.icons', ] ); }