diff options
author | jenkins-bot <jenkins-bot@gerrit.wikimedia.org> | 2025-02-05 19:17:18 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@wikimedia.org> | 2025-02-05 19:17:18 +0000 |
commit | 1f845afa8a3bbb21fda78d02a83addfe511e9063 (patch) | |
tree | 15ac76a04bcdac3345464134e44c1c188ec8d46e | |
parent | 2ae94598a932f55655fe45b7f45d7f681ba1fb16 (diff) | |
parent | 75445500838d1030df5e770083121261967f9316 (diff) | |
download | mediawikicore-1f845afa8a3bbb21fda78d02a83addfe511e9063.tar.gz mediawikicore-1f845afa8a3bbb21fda78d02a83addfe511e9063.zip |
Merge "ResourceLoader: Copy ResourceLoader::inDebugMode to OutputPage"
-rw-r--r-- | includes/Output/OutputPage.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/includes/Output/OutputPage.php b/includes/Output/OutputPage.php index ecd1615d0c18..545ea9f05d7f 100644 --- a/includes/Output/OutputPage.php +++ b/includes/Output/OutputPage.php @@ -478,6 +478,9 @@ class OutputPage extends ContextSource { */ private static $cacheVaryCookies = null; + /** @var int|null */ + private $debugMode = null; + /** * Constructor for OutputPage. This should not be called directly. * Instead, a new RequestContext should be created, and it will implicitly create @@ -3644,6 +3647,27 @@ class OutputPage extends ContextSource { ) ); } + /** + * Determine whether debug mode is on. + * + * Order of priority is: + * - 1) Request parameter, + * - 2) Cookie, + * - 3) Site configuration. + * + * @return int + */ + private function inDebugMode() { + if ( $this->debugMode === null ) { + $resourceLoaderDebug = $this->getConfig()->get( + MainConfigNames::ResourceLoaderDebug ); + $str = $this->getRequest()->getRawVal( 'debug' ) ?? + $this->getRequest()->getCookie( 'resourceLoaderDebug', '', $resourceLoaderDebug ? 'true' : '' ); + $this->debugMode = RL\Context::debugFromString( $str ); + } + return $this->debugMode; + } + private function getRlClientContext() { if ( !$this->rlClientContext ) { $query = ResourceLoader::makeLoaderQuery( @@ -3652,7 +3676,7 @@ class OutputPage extends ContextSource { $this->getSkin()->getSkinName(), $this->getUser()->isRegistered() ? $this->getUser()->getName() : null, null, // version; not relevant - ResourceLoader::inDebugMode(), + $this->inDebugMode(), null, // only; not relevant $this->isPrintable() ); |