diff options
author | jenkins-bot <jenkins-bot@gerrit.wikimedia.org> | 2014-03-26 18:23:01 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@wikimedia.org> | 2014-03-26 18:23:01 +0000 |
commit | 2e09c356789bf7569fdfa219827f488976aa16f0 (patch) | |
tree | c190e0ebba1ddbc47bb8c9072e886c41f9b4d088 | |
parent | a7857bb01c6b66ba30e2605b35da9748854861e9 (diff) | |
parent | 65caa90c193860515314dfa67a085501f05fd55d (diff) | |
download | mediawikicore-2e09c356789bf7569fdfa219827f488976aa16f0.tar.gz mediawikicore-2e09c356789bf7569fdfa219827f488976aa16f0.zip |
Merge "Suppress section edit links with action=render"
-rw-r--r-- | RELEASE-NOTES-1.23 | 4 | ||||
-rw-r--r-- | includes/Article.php | 1 | ||||
-rw-r--r-- | includes/OutputPage.php | 29 |
3 files changed, 33 insertions, 1 deletions
diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index 8d5bc1518237..3a912233bc1c 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -141,6 +141,10 @@ production. when the email address is already confirmed. Also, consistently use "confirmed", rather than "authenticated", when messaging whether or not the user has confirmed an email address. +* (bug 19415) action=render no longer shows section edit links. This affects + behavior of several other features where (bogus) section edit links will + disappear, such as file description pages loaded via $wgUseInstantCommons or + pages transcluded cross-wiki via $wgEnableScaryTranscluding. * (bug 56912) Show correct link color on cached result of Special:DeadendPages. * Classes TitleListDependency and TitleDependency have been removed, as they have been found unused in core and extensions for a long time. diff --git a/includes/Article.php b/includes/Article.php index d45b3322bd09..113372460bac 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1528,6 +1528,7 @@ class Article implements Page { */ public function render() { $this->getContext()->getOutput()->setArticleBodyOnly( true ); + $this->getContext()->getOutput()->enableSectionEditLinks( false ); $this->view(); } diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 9cba0cce8705..854290477e5f 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -257,11 +257,16 @@ class OutputPage extends ContextSource { private $mTarget = null; /** - * @var bool: Whether output should contain table of contents + * @var bool: Whether parser output should contain table of contents */ private $mEnableTOC = true; /** + * @var bool: Whether parser output should contain section edit links + */ + private $mEnableSectionEditLinks = true; + + /** * Constructor for OutputPage. This should not be called directly. * Instead a new RequestContext should be created and it will implicitly create * a OutputPage tied to that context. @@ -1613,6 +1618,11 @@ class OutputPage extends ContextSource { function addParserOutput( &$parserOutput ) { $this->addParserOutputNoText( $parserOutput ); $parserOutput->setTOCEnabled( $this->mEnableTOC ); + + // Touch section edit links only if not previously disabled + if ( $parserOutput->getEditSectionTokens() ) { + $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks ); + } $text = $parserOutput->getText(); wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) ); $this->addHTML( $text ); @@ -3691,4 +3701,21 @@ $templates public function isTOCEnabled() { return $this->mEnableTOC; } + + /** + * Enables/disables section edit links, doesn't override __NOEDITSECTION__ + * @param bool $flag + * @since 1.23 + */ + public function enableSectionEditLinks( $flag = true ) { + $this->mEnableSectionEditLinks = $flag; + } + + /** + * @return bool + * @since 1.23 + */ + public function sectionEditLinksEnabled() { + return $this->mEnableSectionEditLinks; + } } |