From: Umherirrender Date: Mon, 31 Dec 2018 20:13:49 +0000 (+0100) Subject: Use ContextSource::getConfig instead of globals X-Git-Tag: 1.34.0-rc.0~3179^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=ca06a63f3bab6ac7ee9558dedfe829462d2ab9d9;p=lhc%2Fweb%2Fwiklou.git Use ContextSource::getConfig instead of globals Change-Id: I26dd9b1efc0292bbe0044d823f639a2ac5e339dd --- diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 826eecbb56..8ca480f796 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -755,14 +755,14 @@ class DifferenceEngine extends ContextSource { * or false if no link is needed */ protected function getMarkPatrolledLinkInfo() { - global $wgUseRCPatrol; - $user = $this->getUser(); + $config = $this->getConfig(); // Prepare a change patrol link, if applicable if ( // Is patrolling enabled and the user allowed to? - $wgUseRCPatrol && $this->mNewPage && $this->mNewPage->quickUserCan( 'patrol', $user ) && + $config->get( 'UseRCPatrol' ) && + $this->mNewPage && $this->mNewPage->quickUserCan( 'patrol', $user ) && // Only do this if the revision isn't more than 6 hours older // than the Max RC age (6h because the RC might not be cleaned out regularly) RecentChange::isInRCLifespan( $this->mNewRev->getTimestamp(), 21600 ) @@ -1336,12 +1336,11 @@ class DifferenceEngine extends ContextSource { * @return string */ protected function debug( $generator = "internal" ) { - global $wgShowHostnames; if ( !$this->enableDebugComment ) { return ''; } $data = [ $generator ]; - if ( $wgShowHostnames ) { + if ( $this->getConfig()->get( 'ShowHostnames' ) ) { $data[] = wfHostname(); } $data[] = wfTimestamp( TS_DB ); diff --git a/includes/page/ImageHistoryList.php b/includes/page/ImageHistoryList.php index 0a07c6884f..53133345ca 100644 --- a/includes/page/ImageHistoryList.php +++ b/includes/page/ImageHistoryList.php @@ -54,13 +54,14 @@ class ImageHistoryList extends ContextSource { * @param ImagePage $imagePage */ public function __construct( $imagePage ) { - global $wgShowArchiveThumbnails; + $context = $imagePage->getContext(); $this->current = $imagePage->getPage()->getFile(); $this->img = $imagePage->getDisplayedFile(); $this->title = $imagePage->getTitle(); $this->imagePage = $imagePage; - $this->showThumb = $wgShowArchiveThumbnails && $this->img->canRender(); - $this->setContext( $imagePage->getContext() ); + $this->showThumb = $context->getConfig()->get( 'ShowArchiveThumbnails' ) && + $this->img->canRender(); + $this->setContext( $context ); } /** diff --git a/includes/specials/helpers/LoginHelper.php b/includes/specials/helpers/LoginHelper.php index a35a420ee6..6c9bea598f 100644 --- a/includes/specials/helpers/LoginHelper.php +++ b/includes/specials/helpers/LoginHelper.php @@ -63,10 +63,9 @@ class LoginHelper extends ContextSource { public function showReturnToPage( $type, $returnTo = '', $returnToQuery = '', $stickHTTPS = false ) { - global $wgRedirectOnLogin, $wgSecureLogin; - - if ( $type !== 'error' && $wgRedirectOnLogin !== null ) { - $returnTo = $wgRedirectOnLogin; + $config = $this->getConfig(); + if ( $type !== 'error' && $config->get( 'RedirectOnLogin' ) !== null ) { + $returnTo = $config->get( 'RedirectOnLogin' ); $returnToQuery = []; } elseif ( is_string( $returnToQuery ) ) { $returnToQuery = wfCgiToArray( $returnToQuery ); @@ -77,10 +76,10 @@ class LoginHelper extends ContextSource { $returnToTitle = Title::newFromText( $returnTo ) ?: Title::newMainPage(); - if ( $wgSecureLogin && !$stickHTTPS ) { + if ( $config->get( 'SecureLogin' ) && !$stickHTTPS ) { $options = [ 'http' ]; $proto = PROTO_HTTP; - } elseif ( $wgSecureLogin ) { + } elseif ( $config->get( 'SecureLogin' ) ) { $options = [ 'https' ]; $proto = PROTO_HTTPS; } else {