}
// 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 ) );
}
* 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;
if ( !$this->getTitle()->quickUserCan( 'patrol', $user ) || ( !$wgUseNPPatrol && !$wgUseRCPatrol ) ) {
// Patrolling is fully disabled or the user isn't allowed to
- return;
+ return false;
}
wfProfileIn( __METHOD__ );
// 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:
// 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(
// Check for cached results
if ( $cache->get( wfMemcKey( 'NotPatrollablePage', $this->getTitle()->getArticleID() ) ) ) {
wfProfileOut( __METHOD__ );
- return;
+ return false;
}
$dbr = wfGetDB( DB_SLAVE );
// 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(
$cache->set( wfMemcKey( 'NotPatrollablePage', $this->getTitle()->getArticleID() ), '1', $wgRCMaxAge );
}
- return;
+ return false;
}
$rcid = $rc->getAttribute( 'rc_id' );
wfMessage( 'markaspatrolledlink' )->rawParams( $link )->escaped() .
'</div>'
);
+
+ return true;
}
/**