jenkins-bot has submitted this change and it was merged.

Change subject: Add new parameter $patrolFooterShown to hook ArticleViewFooter
......................................................................


Add new parameter $patrolFooterShown to hook ArticleViewFooter

Some extensions like PageTriage will be able to use this new
parameter to determine whether to show its own curation toolbar.

Change-Id: I07e85aa37edc994c5a2bf9d011976b91ff01ab14
---
M RELEASE-NOTES-1.22
M docs/hooks.txt
M includes/Article.php
3 files changed, 15 insertions(+), 8 deletions(-)

Approvals:
  Hoo man: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 9a9aaa5..ded2cee 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -93,6 +93,8 @@
   propper connect string.
   More about DRCP can be found at:
   
http://www.oracle-base.com/articles/11g/database-resident-connection-pool-11gr1.php
+* Add a new parameter $patrolFooterShown to hook ArticleViewFooter so the hook
+  handlers can take further action based on the status of the patrol footer
 
 === Bug fixes in 1.22 ===
 * Disable Special:PasswordReset when $wgEnableEmail is false. Previously one
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 640d642..3c77985 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -615,6 +615,7 @@
 
 'ArticleViewFooter': After showing the footer section of an ordinary page view
 $article: Article object
+$patrolFooterShown: boolean whether patrol footer is shown
 
 'ArticleViewHeader': Before the parser cache is about to be tried for article
 viewing.
diff --git a/includes/Article.php b/includes/Article.php
index da24a98..4972d2b 100644
--- a/includes/Article.php
+++ b/includes/Article.php
@@ -1038,9 +1038,9 @@
                }
 
                // Show a footer allowing the user to patrol the shown revision 
or page if possible
-               $this->showPatrolFooter();
+               $patrolFooterShown = $this->showPatrolFooter();
 
-               wfRunHooks( 'ArticleViewFooter', array( $this ) );
+               wfRunHooks( 'ArticleViewFooter', array( $this, 
$patrolFooterShown ) );
 
        }
 
@@ -1050,6 +1050,8 @@
         * desired, does nothing.
         * Side effect: When the patrol link is build, this method will call
         * OutputPage::preventClickjacking() and load 
mediawiki.page.patrol.ajax.
+        *
+        * @return bool
         */
        public function showPatrolFooter() {
                global $wgUseRCPatrol, $wgUseNPPatrol, $wgRCMaxAge, 
$wgEnableAPI, $wgEnableWriteAPI;
@@ -1066,7 +1068,7 @@
 
                if ( !$this->getTitle()->quickUserCan( 'patrol', $user ) || ( 
!$wgUseNPPatrol && !$wgUseRCPatrol ) ) {
                        // Patrolling is fully disabled or the user isn't 
allowed to
-                       return;
+                       return false;
                }
 
                wfProfileIn( __METHOD__ );
@@ -1075,7 +1077,7 @@
                        // Check for cached results
                        if ( $cache->get( wfMemcKey( 'NotPatrollableRevId', 
$this->getRevIdFetched() ) ) ) {
                                wfProfileOut( __METHOD__ );
-                               return;
+                               return false;
                        }
 
                        // We make use of a little index trick over here:
@@ -1091,7 +1093,7 @@
                                // The revision is more than 6 hours older than 
the Max RC age
                                // no need to torture the DB any further (6h 
because the RC might not be cleaned out regularly)
                                wfProfileOut( __METHOD__ );
-                               return;
+                               return false;
                        }
                        $rc = RecentChange::newFromConds(
                                array(
@@ -1115,7 +1117,7 @@
                        // Check for cached results
                        if ( $cache->get( wfMemcKey( 'NotPatrollablePage', 
$this->getTitle()->getArticleID() ) ) ) {
                                wfProfileOut( __METHOD__ );
-                               return;
+                               return false;
                        }
 
                        $dbr = wfGetDB( DB_SLAVE );
@@ -1130,7 +1132,7 @@
                                // We either didn't find the oldest revision 
for the given page
                                // or it's to old for the RC table (with 6h 
tolerance)
                                wfProfileOut( __METHOD__ );
-                               return;
+                               return false;
                        }
 
                        $rc = RecentChange::newFromConds(
@@ -1159,7 +1161,7 @@
                                $cache->set( wfMemcKey( 'NotPatrollablePage', 
$this->getTitle()->getArticleID() ), '1', $wgRCMaxAge );
                        }
 
-                       return;
+                       return false;
                }
 
                $rcid = $rc->getAttribute( 'rc_id' );
@@ -1187,6 +1189,8 @@
                                wfMessage( 'markaspatrolledlink' )->rawParams( 
$link )->escaped() .
                        '</div>'
                );
+
+               return true;
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/66035
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I07e85aa37edc994c5a2bf9d011976b91ff01ab14
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: EBernhardson (WMF) <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to