From: Kunal Mehta Date: Wed, 24 Aug 2016 00:48:43 +0000 (-0700) Subject: EditPage: Add getContext() function X-Git-Tag: 1.31.0-rc.0~5921 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=841c4076574bc2f390092ea6ae85c9248a999008;p=lhc%2Fweb%2Fwiklou.git 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 --- 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