jenkins-bot has submitted this change and it was merged.

Change subject: EditPage: Add getContext() function
......................................................................


EditPage: Add getContext() function

EditPage already has access to a IContextSource object via
$this->mArticle->getContext(), but no code ever uses it. Add a
$this->getContext() helper function and $this->context member variable
so developers are aware that RequestContext is available and should be
used instead of globals. This is the first step to de-globalifying
EditPage.

Change-Id: I17130bdaf214e9bbe0577a0ee5564ca4760c99e1
---
M includes/EditPage.php
1 file changed, 14 insertions(+), 0 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/EditPage.php b/includes/EditPage.php
index c7b014a..b5becee 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -402,12 +402,18 @@
        private $enableApiEditOverride = false;
 
        /**
+        * @var IContextSource
+        */
+       protected $context;
+
+       /**
         * @param Article $article
         */
        public function __construct( Article $article ) {
                $this->mArticle = $article;
                $this->page = $article->getPage(); // model object
                $this->mTitle = $article->getTitle();
+               $this->context = $article->getContext();
 
                $this->contentModel = $this->mTitle->getContentModel();
 
@@ -423,6 +429,14 @@
        }
 
        /**
+        * @since 1.28
+        * @return IContextSource
+        */
+       public function getContext() {
+               return $this->context;
+       }
+
+       /**
         * @since 1.19
         * @return Title
         */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I17130bdaf214e9bbe0577a0ee5564ca4760c99e1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com>
Gerrit-Reviewer: Tpt <thoma...@hotmail.fr>
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