Index: trunk/phase3/includes/Article.php |
— | — | @@ -622,7 +622,7 @@ |
623 | 623 | */ |
624 | 624 | function view() { |
625 | 625 | global $wgUser, $wgOut, $wgRequest, $wgContLang; |
626 | | - global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser; |
| 626 | + global $wgEnableParserCache, $wgStylePath, $wgParser; |
627 | 627 | global $wgUseTrackbacks, $wgNamespaceRobotPolicies, $wgArticleRobotPolicies; |
628 | 628 | $sk = $wgUser->getSkin(); |
629 | 629 | |
— | — | @@ -868,7 +868,7 @@ |
869 | 869 | |
870 | 870 | # If we have been passed an &rcid= parameter, we want to give the user a |
871 | 871 | # chance to mark this new article as patrolled. |
872 | | - if ( $wgUseRCPatrol && !is_null( $rcid ) && $rcid != 0 && $wgUser->isAllowed( 'patrol' ) ) { |
| 872 | + if (!is_null( $rcid ) && $rcid != 0 && $wgUser->isAllowed( 'patrol' ) ) { |
873 | 873 | $wgOut->addHTML( |
874 | 874 | "<div class='patrollink'>" . |
875 | 875 | wfMsgHtml( 'markaspatrolledlink', |
— | — | @@ -1508,18 +1508,38 @@ |
1509 | 1509 | } |
1510 | 1510 | |
1511 | 1511 | /** |
1512 | | - * Mark this particular edit as patrolled |
| 1512 | + * Mark this particular edit/page as patrolled |
1513 | 1513 | */ |
1514 | 1514 | function markpatrolled() { |
1515 | | - global $wgOut, $wgRequest, $wgUseRCPatrol, $wgUser; |
| 1515 | + global $wgOut, $wgRequest, $wgUseRCPatrol, $wgUseNPPatrol, $wgUser; |
1516 | 1516 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
1517 | 1517 | |
1518 | | - # Check RC patrol config. option |
1519 | | - if( !$wgUseRCPatrol ) { |
| 1518 | + # Check patrol config options |
| 1519 | + |
| 1520 | + if ( !($wgUseNPPatrol || $wgUseRCPatrol)) { |
1520 | 1521 | $wgOut->errorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' ); |
| 1522 | + return; |
| 1523 | + } |
| 1524 | + |
| 1525 | + # If we haven't been given an rc_id value, we can't do anything |
| 1526 | + $rcid = (int) $wgRequest->getVal('rcid'); |
| 1527 | + $rc = $rcid ? RecentChange::newFromId($rcid) : null; |
| 1528 | + if ( is_null ( $rc ) ) |
| 1529 | + { |
| 1530 | + $wgOut->errorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' ); |
1521 | 1531 | return; |
1522 | 1532 | } |
| 1533 | + |
| 1534 | + if ( $rc->mAttribs['rc_type'] == RC_NEW && !$wgUseNPPatrol ) { |
| 1535 | + $wgOut->errorpage( 'nppatroldisabled', 'nppatroldisabledtext' ); |
| 1536 | + return; |
| 1537 | + } |
1523 | 1538 | |
| 1539 | + if ( !$wgUseRCPatrol && $rc->mAttribs['rc_type'] != RC_NEW) { |
| 1540 | + $wgOut->errorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' ); |
| 1541 | + return; |
| 1542 | + } |
| 1543 | + |
1524 | 1544 | # Check permissions |
1525 | 1545 | $permission_errors = $this->mTitle->getUserPermissionsErrors( 'patrol', $wgUser ); |
1526 | 1546 | |
— | — | @@ -1529,19 +1549,15 @@ |
1530 | 1550 | return; |
1531 | 1551 | } |
1532 | 1552 | |
1533 | | - # If we haven't been given an rc_id value, we can't do anything |
1534 | | - $rcid = $wgRequest->getVal( 'rcid' ); |
1535 | | - if( !$rcid ) { |
1536 | | - $wgOut->errorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' ); |
1537 | | - return; |
1538 | | - } |
1539 | | - |
1540 | 1553 | # Handle the 'MarkPatrolled' hook |
1541 | 1554 | if( !wfRunHooks( 'MarkPatrolled', array( $rcid, &$wgUser, false ) ) ) { |
1542 | 1555 | return; |
1543 | 1556 | } |
1544 | 1557 | |
1545 | | - $return = SpecialPage::getTitleFor( 'Recentchanges' ); |
| 1558 | + #It would be nice to see where the user had actually come from, but for now just guess |
| 1559 | + $returnto = $rc->mAttribs['rc_type'] == RC_NEW ? 'Newpages' : 'Recentchanges'; |
| 1560 | + $return = Title::makeTitle( NS_SPECIAL, $returnto ); |
| 1561 | + |
1546 | 1562 | # If it's left up to us, check that the user is allowed to patrol this edit |
1547 | 1563 | # If the user has the "autopatrol" right, then we'll assume there are no |
1548 | 1564 | # other conditions stopping them doing so |
Index: trunk/phase3/includes/SpecialNewpages.php |
— | — | @@ -50,8 +50,8 @@ |
51 | 51 | } |
52 | 52 | |
53 | 53 | function getSQL() { |
54 | | - global $wgUser, $wgUseRCPatrol; |
55 | | - $usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0; |
| 54 | + global $wgUser, $wgUseNPPatrol; |
| 55 | + $usepatrol = ( $wgUseNPPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0; |
56 | 56 | $dbr = wfGetDB( DB_SLAVE ); |
57 | 57 | list( $recentchanges, $page ) = $dbr->tableNamesN( 'recentchanges', 'page' ); |
58 | 58 | |
— | — | @@ -123,8 +123,8 @@ |
124 | 124 | * @return bool |
125 | 125 | */ |
126 | 126 | function patrollable( $result ) { |
127 | | - global $wgUser, $wgUseRCPatrol; |
128 | | - return $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) && !$result->patrolled; |
| 127 | + global $wgUser, $wgUseNPPatrol; |
| 128 | + return $wgUseNPPatrol && $wgUser->isAllowed( 'patrol' ) && !$result->patrolled; |
129 | 129 | } |
130 | 130 | |
131 | 131 | function feedItemDesc( $row ) { |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -2019,6 +2019,9 @@ |
2020 | 2020 | /** Use RC Patrolling to check for vandalism */ |
2021 | 2021 | $wgUseRCPatrol = true; |
2022 | 2022 | |
| 2023 | +/** Use new page patrolling to check new pages on special:Newpages */ |
| 2024 | +$wgUseNPPatrol = true; |
| 2025 | + |
2023 | 2026 | /** Set maximum number of results to return in syndication feeds (RSS, Atom) for |
2024 | 2027 | * eg Recentchanges, Newpages. */ |
2025 | 2028 | $wgFeedLimit = 50; |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2435,6 +2435,8 @@ |
2436 | 2436 | 'markedaspatrollederror' => 'Cannot mark as patrolled', |
2437 | 2437 | 'markedaspatrollederrortext' => 'You need to specify a revision to mark as patrolled.', |
2438 | 2438 | 'markedaspatrollederror-noautopatrol' => 'You are not allowed to mark your own changes as patrolled.', |
| 2439 | +'nppatroldisabled' => 'New Pages Patrol disabled', |
| 2440 | +'nppatroldisabledtext' => 'The New Pages Patrol feature is currently disabled.', |
2439 | 2441 | |
2440 | 2442 | # Patrol log |
2441 | 2443 | 'patrol-log-page' => 'Patrol log', |