From: daniel Date: Thu, 15 Nov 2018 14:56:57 +0000 (+0100) Subject: Make the context page the edited page in EditPages X-Git-Tag: 1.34.0-rc.0~3481^2 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=501bb93e3ed7eb7bcb23348856ed002b4e307dc5;p=lhc%2Fweb%2Fwiklou.git Make the context page the edited page in EditPages This forces the WikiPage returned by $this->getContext()->getPage() to be the same as $this->page. This seems to be redundant at the moment, but it seems prudent to make sure this does not break. Having two WikiPage instances may cause subtle problems, such as redundant parsing of content during edits. Bug: T205369 Change-Id: I8dd3235ec395fa8772ad810f8b09a098a940ab0c --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 373f6d9bf6..09dc070ca3 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -476,7 +476,15 @@ class EditPage { $this->mArticle = $article; $this->page = $article->getPage(); // model object $this->mTitle = $article->getTitle(); - $this->context = $article->getContext(); + + // Make sure the local context is in sync with other member variables. + // Particularly make sure everything is using the same WikiPage instance. + // This should probably be the case in Article as well, but it's + // particularly important for EditPage, to make use of the in-place caching + // facility in WikiPage::prepareContentForEdit. + $this->context = new DerivativeContext( $article->getContext() ); + $this->context->setWikiPage( $this->page ); + $this->context->setTitle( $this->mTitle ); $this->contentModel = $this->mTitle->getContentModel();