X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FOutputPage.php;h=c45fce7a9d6773d30f3e764d5493c0a876260ee4;hp=cb3f1ad203aed348b77dfb92040f7f0d8c685fb2;hb=e1d39f7d02c4c22bbdf6d71ae1c4c527e42ff44b;hpb=b2d4ca1e028e55d29ead42acf31c099bfc776698 diff --git a/includes/OutputPage.php b/includes/OutputPage.php index cb3f1ad203..c45fce7a9d 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. * @@ -2198,8 +2189,6 @@ class OutputPage extends ContextSource { * @return ParserOutput */ private function parseInternal( $text, $title, $linestart, $tidy, $interface, $language ) { - global $wgParser; - if ( is_null( $title ) ) { throw new MWException( 'Empty $mTitle in ' . __METHOD__ ); } @@ -2212,7 +2201,7 @@ class OutputPage extends ContextSource { $oldLang = $popts->setTargetLanguage( $language ); } - $parserOutput = $wgParser->getFreshParser()->parse( + $parserOutput = MediaWikiServices::getInstance()->getParser()->getFreshParser()->parse( $text, $title, $popts, $linestart, true, $this->mRevisionId ); @@ -2527,6 +2516,37 @@ class OutputPage extends ContextSource { return $config->get( 'OriginTrials' ); } + private function getReportTo() { + $config = $this->getConfig(); + + $expiry = $config->get( 'ReportToExpiry' ); + + if ( !$expiry ) { + return false; + } + + $endpoints = $config->get( 'ReportToEndpoints' ); + + if ( !$endpoints ) { + return false; + } + + $output = [ 'max_age' => $expiry, 'endpoints' => [] ]; + + foreach ( $endpoints as $endpoint ) { + $output['endpoints'][] = [ 'url' => $endpoint ]; + } + + return json_encode( $output, JSON_UNESCAPED_SLASHES ); + } + + private function getFeaturePolicyReportOnly() { + $config = $this->getConfig(); + + $features = $config->get( 'FeaturePolicyReportOnly' ); + return implode( ';', $features ); + } + /** * Send cache control HTTP headers */ @@ -2678,10 +2698,6 @@ class OutputPage extends ContextSource { $response->header( 'Content-language: ' . MediaWikiServices::getInstance()->getContentLanguage()->getHtmlCode() ); - if ( !$this->mArticleBodyOnly ) { - $sk = $this->getSkin(); - } - $linkHeader = $this->getLinkHeader(); if ( $linkHeader ) { $response->header( $linkHeader ); @@ -2698,6 +2714,16 @@ class OutputPage extends ContextSource { $response->header( "Origin-Trial: $originTrial", false ); } + $reportTo = $this->getReportTo(); + if ( $reportTo ) { + $response->header( "Report-To: $reportTo" ); + } + + $featurePolicyReportOnly = $this->getFeaturePolicyReportOnly(); + if ( $featurePolicyReportOnly ) { + $response->header( "Feature-Policy-Report-Only: $featurePolicyReportOnly" ); + } + ContentSecurityPolicy::sendHeaders( $this ); if ( $this->mArticleBodyOnly ) { @@ -2963,46 +2989,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 * @@ -3223,7 +3209,10 @@ class OutputPage extends ContextSource { // Use an IE conditional comment to serve the script only to old IE $pieces[] = '