If you really must have a useless $wgUseRCPatrol option, might as well use it
authorArne Heizmann <timwi@users.mediawiki.org>
Mon, 9 Aug 2004 23:30:02 +0000 (23:30 +0000)
committerArne Heizmann <timwi@users.mediawiki.org>
Mon, 9 Aug 2004 23:30:02 +0000 (23:30 +0000)
consistently everywhere to ensure that setting it to 0 actually does disable the
feature.  Also, tell the user that it is disabled if they happen to follow a link
with &action=markpatrolled in it.  Additionally, make &action=markpatrolled say
"log in required" if the user is not logged in.

includes/Article.php
includes/DifferenceEngine.php
includes/Skin.php
includes/SpecialNewpages.php
languages/Language.php

index d56a000..361b9d4 100644 (file)
@@ -625,7 +625,7 @@ class Article {
        function view()
        {
                global $wgUser, $wgOut, $wgLang, $wgRequest, $wgMwRedir, $wgOnlySysopsCanPatrol;
-               global $wgLinkCache, $IP, $wgEnableParserCache, $wgStylePath;
+               global $wgLinkCache, $IP, $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol;
                $sk = $wgUser->getSkin();
 
                $fname = 'Article::view';
@@ -735,7 +735,7 @@ class Article {
 
                # If we have been passed an &rcid= parameter, we want to give the user a
                # chance to mark this new article as patrolled.
-               if ( !is_null ( $rcid ) && $rcid != 0 && $wgUser->getID() != 0 &&
+               if ( $wgUseRCPatrol && !is_null ( $rcid ) && $rcid != 0 && $wgUser->getID() != 0 &&
                     ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) )
                {
                        $wgOut->addHTML( wfMsg ( 'markaspatrolledlink',
@@ -1086,9 +1086,20 @@ class Article {
        # Mark this particular edit as patrolled
        function markpatrolled()
        {
-               global $wgOut, $wgRequest, $wgOnlySysopsCanPatrol;
+               global $wgOut, $wgRequest, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
                $wgOut->setRobotpolicy( 'noindex,follow' );
-               if( $wgOnlySysopsCanPatrol && !$wgUser->isSysop() )
+
+               if ( !$wgUseRCPatrol )
+               {
+                       $wgOut->errorpage( 'rcpatroldisabled', 'rcpatroldisabledtext' );
+                       return;
+               }
+               if ( $wgUser->getID() == 0 )
+               {
+                       $wgOut->loginToUse();
+                       return;
+               }
+               if ( $wgOnlySysopsCanPatrol && !$wgUser->isSysop() )
                {
                        $wgOut->sysopRequired();
                        return;
index be90b68..7b9acb8 100644 (file)
@@ -74,9 +74,8 @@ class DifferenceEngine {
                } else {
                        $rollback = "";
                }
-               if ( $wgUseRCPatrol && 
-                      ($this->mRcidMarkPatrolled != 0 && $wgUser->getID() != 0 &&
-                      ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) )
+               if ( $wgUseRCPatrol && $this->mRcidMarkPatrolled != 0 && $wgUser->getID() != 0 &&
+                    ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) )
                {
                        $patrol = " [" . $sk->makeKnownLinkObj( $wgTitle, wfMsg( 'markaspatrolleddiff' ),
                                "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}" ) . "]";
index aa2acdf..8e087ce 100644 (file)
@@ -2250,7 +2250,7 @@ class Skin {
 
        function recentChangesLineOld( &$rc, $watched = false )
        {
-               global $wgTitle, $wgLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol;
+               global $wgTitle, $wgLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol, $wgOnlySysopsCanPatrol;
 
                # Extract DB fields into local scope
                extract( $rc->mAttribs );
@@ -2285,7 +2285,7 @@ class Skin {
                        if ( $rc_type == RC_NEW || $rc_type == RC_LOG ) {
                                $diffLink = wfMsg( 'diff' );
                        } else {
-                               if ( $rc_patrolled == 0 && $wgUser->getID() != 0 &&
+                               if ( $wgUseRCPatrol && $rc_patrolled == 0 && $wgUser->getID() != 0 &&
                                     ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) )
                                        $rcidparam = "&rcid={$rc_id}";
                                else
@@ -2309,8 +2309,8 @@ class Skin {
                        # Article link
                        # If it's a new article, there is no diff link, but if it hasn't been
                        # patrolled yet, we need to give users a way to do so
-                       if ( $rc_type == RC_NEW && $rc_patrolled == 0 && $wgUser->getID() != 0 &&
-                            ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) )
+                       if ( $wgUseRCPatrol && $rc_type == RC_NEW && $rc_patrolled == 0 &&
+                            $wgUser->getID() != 0 && ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) )
                                $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
                        else
                                $articleLink = $this->makeKnownLinkObj( $rc->getTitle(), '' );
index d9f85fe..2d9a47a 100644 (file)
@@ -15,8 +15,9 @@ class NewPagesPage extends QueryPage {
        }
 
        function getSQL() {
-               global $wgUser, $wgOnlySysopsCanPatrol;
-               $usepatrol = ( $wgUser->getID() != 0 && ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) ? 1 : 0;
+               global $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
+               $usepatrol = ( $wgUseRCPatrol && $wgUser->getID() != 0 &&
+                              ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) ) ? 1 : 0;
                $dbr =& wfGetDB( DB_SLAVE );
                extract( $dbr->tableNames( 'recentchanges', 'cur' ) );
 
@@ -40,14 +41,14 @@ class NewPagesPage extends QueryPage {
        }
 
        function formatResult( $skin, $result ) {
-               global $wgLang, $wgUser, $wgOnlySysopsCanPatrol;
+               global $wgLang, $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
                $u = $result->user;
                $ut = $result->user_text;
 
                $length = wfMsg( "nbytes", $wgLang->formatNum( $result->length ) );
                $c = $skin->formatComment($result->comment );
 
-               if ( 0 == $u ) { # not by a logged-in user
+               if ( $u == 0 ) { # not by a logged-in user
                        $ul = $ut;
                }
                else {
@@ -58,8 +59,8 @@ class NewPagesPage extends QueryPage {
 
                # Since there is no diff link, we need to give users a way to
                # mark the article as patrolled if it isn't already
-               if ( $result->usepatrol && $result->patrolled == 0 && $wgUser->getID() != 0 &&
-                    ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) )
+               if ( $wgUseRCPatrol && $result->usepatrol && $result->patrolled == 0 &&
+                    $wgUser->getID() != 0 && ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) )
                        $link = $skin->makeKnownLink( $result->title, '', "rcid={$result->rcid}" );
                else
                        $link = $skin->makeKnownLink( $result->title, '' );
index df2d29d..f975709 100644 (file)
@@ -1439,6 +1439,8 @@ You might want to check the following regular expression for patterns that are c
 'markaspatrolledtext'   => "Mark this article as patrolled",
 'markedaspatrolled'     => "Marked as patrolled",
 'markedaspatrolledtext' => "The selected revision has been marked as patrolled.",
+'rcpatroldisabled'      => "Recent Changes Patrol disabled",
+'rcpatroldisabledtext'  => "The Recent Changes Patrol feature is currently disabled.",
 
 # Monobook.js: tooltips and access keys for monobook
 'Monobook.js' => '/* tooltips and access keys */