From: Jack Phoenix Date: Wed, 11 Jul 2018 08:08:48 +0000 (+0300) Subject: Add new 'ArticleShowPatrolFooter' hook to allow extensions to decide if the [mark... X-Git-Tag: 1.34.0-rc.0~4767^2 X-Git-Url: http://git.cyclocoop.org/data/modifier.php?a=commitdiff_plain;h=72f1866b92b714acbb8dbf1b84f7556497421d3d;p=lhc%2Fweb%2Fwiklou.git Add new 'ArticleShowPatrolFooter' hook to allow extensions to decide if the [mark as patrolled] link should not be shown Used on wikiHow to simply never show this particular link. Change-Id: Id6b11135cc062798964a6b3e927ad665fd757616 --- diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 179e9700b3..df3d3d7b2d 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -48,6 +48,9 @@ production. * The 'ImageBeforeProduceHTML' hook is now passed three new parameters, $parser, &$query and &$widthOption, allowing extensions even finer control over the resulting HTML code. +* Added new 'ArticleShowPatrolFooter' hook, which allows extensions to determine + if the [mark as patrolled] link should be shown at the footer of patrollable + pages. === External library changes in 1.32 === * … diff --git a/docs/hooks.txt b/docs/hooks.txt index 708456c926..b38b086388 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -739,6 +739,11 @@ $user: the user who did the rollback $revision: the revision the page was reverted back to $current: the reverted revision +'ArticleShowPatrolFooter': Called at the beginning of Article#showPatrolFooter. +Extensions can use this to not show the [mark as patrolled] link in certain +circumstances. +$article: the Article object + 'ArticleUndelete': When one or more revisions of an article are restored. &$title: Title corresponding to the article restored $create: Whether or not the restoration caused the page to be created (i.e. it diff --git a/includes/page/Article.php b/includes/page/Article.php index abf32d78ce..9015a32300 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -976,6 +976,11 @@ class Article implements Page { public function showPatrolFooter() { global $wgUseNPPatrol, $wgUseRCPatrol, $wgUseFilePatrol; + // Allow hooks to decide whether to not output this at all + if ( !Hooks::run( 'ArticleShowPatrolFooter', [ $this ] ) ) { + return false; + } + $outputPage = $this->getContext()->getOutput(); $user = $this->getContext()->getUser(); $title = $this->getTitle();