Bsitu has uploaded a new change for review.
https://gerrit.wikimedia.org/r/66035
Change subject: Add new parameter $patrolFooterShown to hook ArticleViewFooter
......................................................................
Add new parameter $patrolFooterShown to hook ArticleViewFooter
Some extensions like PageTriage can use this new parameter to determine
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, 14 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/35/66035/1
diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 0708e6b..8b2c930 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -86,6 +86,8 @@
HTTP caches when a page is changed.
* Changed the patrolling system to always show the link for patrolling in case
the
current revision is patrollable. This also removed the usage of the rcid URI
parameters.
+* Add a new parameter $patrolFooterShown to hook ArticleViewFooter so the hook
+ handlers can take further action based on the status of the partrol 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..caba9ac 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,7 @@
* 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 +1067,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 +1076,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 +1092,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 +1116,7 @@
// Check for cached results
if ( $cache->get( wfMemcKey( 'NotPatrollablePage',
$this->getTitle()->getArticleID() ) ) ) {
wfProfileOut( __METHOD__ );
- return;
+ return false;
}
$dbr = wfGetDB( DB_SLAVE );
@@ -1130,7 +1131,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 +1160,7 @@
$cache->set( wfMemcKey( 'NotPatrollablePage',
$this->getTitle()->getArticleID() ), '1', $wgRCMaxAge );
}
- return;
+ return false;
}
$rcid = $rc->getAttribute( 'rc_id' );
@@ -1187,6 +1188,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: newchange
Gerrit-Change-Id: I07e85aa37edc994c5a2bf9d011976b91ff01ab14
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits