Index: trunk/phase3/includes/Article.php
===================================================================
--- trunk/phase3/includes/Article.php (revision 27024)
+++ trunk/phase3/includes/Article.php (revision 27025)
@@ -622,7 +622,7 @@
*/
function view() {
global $wgUser, $wgOut, $wgRequest, $wgContLang;
- global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser;
+ global $wgEnableParserCache, $wgStylePath, $wgParser;
global $wgUseTrackbacks, $wgNamespaceRobotPolicies, $wgArticleRobotPolicies;
$sk = $wgUser->getSkin();
@@ -868,7 +868,7 @@
# If we have been passed an &rcid= parameter, we want to give the user a
# chance to mark this new article as patrolled.
- if ( $wgUseRCPatrol && !is_null( $rcid ) && $rcid != 0 && $wgUser->isAllowed( 'patrol' ) ) {
+ if (!is_null( $rcid ) && $rcid != 0 && $wgUser->isAllowed( 'patrol' ) ) {
$wgOut->addHTML(
"<div class='patrollink'>" .
wfMsgHtml( 'markaspatrolledlink',
@@ -1508,18 +1508,38 @@
}
/**
- * Mark this particular edit as patrolled
+ * Mark this particular edit/page as patrolled
*/
function markpatrolled() {
- global $wgOut, $wgRequest, $wgUseRCPatrol, $wgUser;
+ global $wgOut, $wgRequest, $wgUseRCPatrol, $wgUseNPPatrol, $wgUser;
$wgOut->setRobotPolicy( 'noindex,nofollow' );
- # Check RC patrol config. option
- if( !$wgUseRCPatrol ) {
+ # Check patrol config options
+
+ if ( !($wgUseNPPatrol || $wgUseRCPatrol)) {
$wgOut->errorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' );
+ return;
+ }
+
+ # If we haven't been given an rc_id value, we can't do anything
+ $rcid = (int) $wgRequest->getVal('rcid');
+ $rc = $rcid ? RecentChange::newFromId($rcid) : null;
+ if ( is_null ( $rc ) )
+ {
+ $wgOut->errorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
return;
}
+
+ if ( $rc->mAttribs['rc_type'] == RC_NEW && !$wgUseNPPatrol ) {
+ $wgOut->errorpage( 'nppatroldisabled', 'nppatroldisabledtext' );
+ return;
+ }
+ if ( !$wgUseRCPatrol && $rc->mAttribs['rc_type'] != RC_NEW) {
+ $wgOut->errorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' );
+ return;
+ }
+
# Check permissions
$permission_errors = $this->mTitle->getUserPermissionsErrors( 'patrol', $wgUser );
@@ -1529,19 +1549,15 @@
return;
}
- # If we haven't been given an rc_id value, we can't do anything
- $rcid = $wgRequest->getVal( 'rcid' );
- if( !$rcid ) {
- $wgOut->errorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
- return;
- }
-
# Handle the 'MarkPatrolled' hook
if( !wfRunHooks( 'MarkPatrolled', array( $rcid, &$wgUser, false ) ) ) {
return;
}
- $return = SpecialPage::getTitleFor( 'Recentchanges' );
+ #It would be nice to see where the user had actually come from, but for now just guess
+ $returnto = $rc->mAttribs['rc_type'] == RC_NEW ? 'Newpages' : 'Recentchanges';
+ $return = Title::makeTitle( NS_SPECIAL, $returnto );
+
# If it's left up to us, check that the user is allowed to patrol this edit
# If the user has the "autopatrol" right, then we'll assume there are no
# other conditions stopping them doing so
Index: trunk/phase3/includes/SpecialNewpages.php
===================================================================
--- trunk/phase3/includes/SpecialNewpages.php (revision 27024)
+++ trunk/phase3/includes/SpecialNewpages.php (revision 27025)
@@ -50,8 +50,8 @@
}
function getSQL() {
- global $wgUser, $wgUseRCPatrol;
- $usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0;
+ global $wgUser, $wgUseNPPatrol;
+ $usepatrol = ( $wgUseNPPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0;
$dbr = wfGetDB( DB_SLAVE );
list( $recentchanges, $page ) = $dbr->tableNamesN( 'recentchanges', 'page' );
@@ -123,8 +123,8 @@
* @return bool
*/
function patrollable( $result ) {
- global $wgUser, $wgUseRCPatrol;
- return $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) && !$result->patrolled;
+ global $wgUser, $wgUseNPPatrol;
+ return $wgUseNPPatrol && $wgUser->isAllowed( 'patrol' ) && !$result->patrolled;
}
function feedItemDesc( $row ) {
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php (revision 27024)
+++ trunk/phase3/includes/DefaultSettings.php (revision 27025)
@@ -2019,6 +2019,9 @@
/** Use RC Patrolling to check for vandalism */
$wgUseRCPatrol = true;
+/** Use new page patrolling to check new pages on special:Newpages */
+$wgUseNPPatrol = true;
+
/** Set maximum number of results to return in syndication feeds (RSS, Atom) for
* eg Recentchanges, Newpages. */
$wgFeedLimit = 50;
Index: trunk/phase3/languages/messages/MessagesEn.php
===================================================================
--- trunk/phase3/languages/messages/MessagesEn.php (revision 27024)
+++ trunk/phase3/languages/messages/MessagesEn.php (revision 27025)
@@ -2435,6 +2435,8 @@
'markedaspatrollederror' => 'Cannot mark as patrolled',
'markedaspatrollederrortext' => 'You need to specify a revision to mark as patrolled.',
'markedaspatrollederror-noautopatrol' => 'You are not allowed to mark your own changes as patrolled.',
+'nppatroldisabled' => 'New Pages Patrol disabled',
+'nppatroldisabledtext' => 'The New Pages Patrol feature is currently disabled.',
# Patrol log
'patrol-log-page' => 'Patrol log',