diff options
author | TChin <tchin@wikimedia.org> | 2022-01-06 13:44:56 -0500 |
---|---|---|
committer | TChin <tchin@wikimedia.org> | 2022-01-10 13:55:53 -0500 |
commit | 47adb6d65a9def579135a3d009fd1b22e99e51ba (patch) | |
tree | a8a90bace319d546819fc78ed682a024e0090f03 /includes/OutputHandler.php | |
parent | fb80b943b67a17a85111692fa4ac675f148f05e6 (diff) | |
download | mediawikicore-47adb6d65a9def579135a3d009fd1b22e99e51ba.tar.gz mediawikicore-47adb6d65a9def579135a3d009fd1b22e99e51ba.zip |
Refactor global variables to use MediaWikiServices instead
Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI.
Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228
* This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it.
A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki
Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
Diffstat (limited to 'includes/OutputHandler.php')
-rw-r--r-- | includes/OutputHandler.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/includes/OutputHandler.php b/includes/OutputHandler.php index 845ac9283f5f..7e338dbabdee 100644 --- a/includes/OutputHandler.php +++ b/includes/OutputHandler.php @@ -39,8 +39,9 @@ class OutputHandler { * @return string */ public static function handle( $s, $phase ) { - global $wgDisableOutputCompression, $wgMangleFlashPolicy; - + $config = MediaWikiServices::getInstance()->getMainConfig(); + $disableOutputCompression = $config->get( 'DisableOutputCompression' ); + $mangleFlashPolicy = $config->get( 'MangleFlashPolicy' ); // Don't send headers if output is being discarded (T278579) if ( ( $phase & PHP_OUTPUT_HANDLER_CLEAN ) === PHP_OUTPUT_HANDLER_CLEAN ) { $logger = LoggerFactory::getInstance( 'output' ); @@ -52,7 +53,7 @@ class OutputHandler { return $s; } - if ( $wgMangleFlashPolicy ) { + if ( $mangleFlashPolicy ) { $s = self::mangleFlashPolicy( $s ); } @@ -73,7 +74,7 @@ class OutputHandler { // Compression is not disabled by the application entry point !defined( 'MW_NO_OUTPUT_COMPRESSION' ) && // Compression is not disabled by site configuration - !$wgDisableOutputCompression + !$disableOutputCompression ) { $s = self::handleGzip( $s ); } |