Add new 'ArticleShowPatrolFooter' hook to allow extensions to decide if the [mark...
authorJack Phoenix <ashley@uncyclomedia.co>
Wed, 11 Jul 2018 08:08:48 +0000 (11:08 +0300)
committerJack Phoenix <ashley@uncyclomedia.co>
Wed, 11 Jul 2018 08:08:48 +0000 (11:08 +0300)
Used on wikiHow to simply never show this particular link.

Change-Id: Id6b11135cc062798964a6b3e927ad665fd757616

RELEASE-NOTES-1.32
docs/hooks.txt
includes/page/Article.php

index 179e970..df3d3d7 100644 (file)
@@ -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 ===
 * …
index 708456c..b38b086 100644 (file)
@@ -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
index abf32d7..9015a32 100644 (file)
@@ -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();