From 841c4076574bc2f390092ea6ae85c9248a999008 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 23 Aug 2016 17:48:43 -0700 Subject: [PATCH] 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 --- includes/EditPage.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/includes/EditPage.php b/includes/EditPage.php index c7b014a7ff..b5beceeeba 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -401,6 +401,11 @@ class EditPage { */ private $enableApiEditOverride = false; + /** + * @var IContextSource + */ + protected $context; + /** * @param Article $article */ @@ -408,6 +413,7 @@ class EditPage { $this->mArticle = $article; $this->page = $article->getPage(); // model object $this->mTitle = $article->getTitle(); + $this->context = $article->getContext(); $this->contentModel = $this->mTitle->getContentModel(); @@ -422,6 +428,14 @@ class EditPage { return $this->mArticle; } + /** + * @since 1.28 + * @return IContextSource + */ + public function getContext() { + return $this->context; + } + /** * @since 1.19 * @return Title -- 2.20.1