jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/403337 )

Change subject: Avoid $wgRequest & $wgOut globals in ArticleFromTitle hook 
subscriber
......................................................................


Avoid $wgRequest & $wgOut globals in ArticleFromTitle hook subscriber

Change-Id: I3501ebb7a562b87c12f3ad5c4a87883ed6c04701
---
M UserProfile/UserProfileHooks.php
1 file changed, 9 insertions(+), 5 deletions(-)

Approvals:
  Jack Phoenix: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/UserProfile/UserProfileHooks.php b/UserProfile/UserProfileHooks.php
index 5c2d458..173983b 100644
--- a/UserProfile/UserProfileHooks.php
+++ b/UserProfile/UserProfileHooks.php
@@ -44,7 +44,11 @@
         * @return bool
         */
        public static function onArticleFromTitle( &$title, &$article ) {
-               global $wgRequest, $wgOut, $wgHooks, $wgUserPageChoice;
+               global $wgHooks, $wgUserPageChoice;
+
+               $context = $article->getContext();
+               $out = $context->getOutput();
+               $request = $context->getRequest();
 
                if (
                        !$title->isSubpage() &&
@@ -63,15 +67,15 @@
 
                        if ( !$show_user_page ) {
                                // Prevents editing of userpage
-                               if ( $wgRequest->getVal( 'action' ) == 'edit' ) 
{
-                                       $wgOut->redirect( $title->getFullURL() 
);
+                               if ( $request->getVal( 'action' ) == 'edit' ) {
+                                       $out->redirect( $title->getFullURL() );
                                }
                        } else {
-                               $wgOut->enableClientCache( false );
+                               $out->enableClientCache( false );
                                $wgHooks['ParserLimitReportPrepare'][] = 
'UserProfileHooks::onParserLimitReportPrepare';
                        }
 
-                       $wgOut->addModuleStyles( [
+                       $out->addModuleStyles( [
                                'ext.socialprofile.clearfix',
                                'ext.socialprofile.userprofile.css'
                        ] );

-- 
To view, visit https://gerrit.wikimedia.org/r/403337
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3501ebb7a562b87c12f3ad5c4a87883ed6c04701
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SocialProfile
Gerrit-Branch: master
Gerrit-Owner: SamanthaNguyen <samanthanguyen1...@gmail.com>
Gerrit-Reviewer: Jack Phoenix <ash...@uncyclomedia.co>
Gerrit-Reviewer: Lewis Cawte <le...@lewiscawte.me>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to