Apply live hack from Wikimedia code base -- remove unused commented-out checker patte...
[lhc/web/wiklou.git] / includes / RecentChange.php
index f9673a3..750404a 100644 (file)
@@ -221,8 +221,7 @@ class RecentChange
                if( $wgUseEnotif ) {
                        # this would be better as an extension hook
                        global $wgUser;
-                       include_once( "UserMailer.php" );
-                       $enotif = new EmailNotification();
+                       $enotif = new EmailNotification;
                        $title = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] );
                        $enotif->notifyOnPageChange( $wgUser, $title,
                                $this->mAttribs['rc_timestamp'],
@@ -251,22 +250,17 @@ class RecentChange
                                'rc_patrolled' => 1
                        ),
                        array(
-                               'rc_id' => $change
+                               'rc_id' => $rcid
                        ),
                        __METHOD__
                );
        }
 
        # Makes an entry in the database corresponding to an edit
-       /*static*/ function notifyEdit( $timestamp, &$title, $minor, &$user, $comment,
-               $oldId, $lastTimestamp, $bot = "default", $ip = '', $oldSize = 0, $newSize = 0,
+       public static function notifyEdit( $timestamp, &$title, $minor, &$user, $comment,
+               $oldId, $lastTimestamp, $bot, $ip = '', $oldSize = 0, $newSize = 0,
                $newId = 0)
        {
-
-               if ( $bot === 'default' ) {
-                       $bot = $user->isAllowed( 'bot' );
-               }
-
                if ( !$ip ) {
                        $ip = wfGetIP();
                        if ( !$ip ) {
@@ -313,7 +307,7 @@ class RecentChange
         * Note: the title object must be loaded with the new id using resetArticleID()
         * @todo Document parameters and return
         */
-       public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot = 'default',
+       public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot,
          $ip='', $size = 0, $newId = 0 )
        {
                if ( !$ip ) {
@@ -322,9 +316,6 @@ class RecentChange
                                $ip = '';
                        }
                }
-               if ( $bot === 'default' ) {
-                       $bot = $user->isAllowed( 'bot' );
-               }
 
                $rc = new RecentChange;
                $rc->mAttribs = array(
@@ -361,8 +352,10 @@ class RecentChange
        }
 
        # Makes an entry in the database corresponding to a rename
-       /*static*/ function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false )
+       public static function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false )
        {
+               global $wgRequest;
+
                if ( !$ip ) {
                        $ip = wfGetIP();
                        if ( !$ip ) {
@@ -384,7 +377,7 @@ class RecentChange
                        'rc_comment'    => $comment,
                        'rc_this_oldid' => 0,
                        'rc_last_oldid' => 0,
-                       'rc_bot'        => $user->isAllowed( 'bot' ) ? 1 : 0,
+                       'rc_bot'        => $user->isAllowed( 'bot' ) ? $wgRequest->getBool( 'bot' , true ) : 0,
                        'rc_moved_to_ns'        => $newTitle->getNamespace(),
                        'rc_moved_to_title'     => $newTitle->getDBkey(),
                        'rc_ip'         => $ip,
@@ -402,19 +395,21 @@ class RecentChange
                $rc->save();
        }
 
-       /* static */ function notifyMoveToNew( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='' ) {
+       public static function notifyMoveToNew( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='' ) {
                RecentChange::notifyMove( $timestamp, $oldTitle, $newTitle, $user, $comment, $ip, false );
        }
 
-       /* static */ function notifyMoveOverRedirect( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='' ) {
+       public static function notifyMoveOverRedirect( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='' ) {
                RecentChange::notifyMove( $timestamp, $oldTitle, $newTitle, $user, $comment, $ip, true );
        }
 
        # A log entry is different to an edit in that previous revisions are
        # not kept
-       /*static*/ function notifyLog( $timestamp, &$title, &$user, $comment, $ip='',
+       public static function notifyLog( $timestamp, &$title, &$user, $comment, $ip='',
           $type, $action, $target, $logComment, $params )
        {
+               global $wgRequest;
+
                if ( !$ip ) {
                        $ip = wfGetIP();
                        if ( !$ip ) {
@@ -436,7 +431,7 @@ class RecentChange
                        'rc_comment'    => $comment,
                        'rc_this_oldid' => 0,
                        'rc_last_oldid' => 0,
-                       'rc_bot'        => $user->isAllowed( 'bot' ) ? 1 : 0,
+                       'rc_bot'        => $user->isAllowed( 'bot' ) ? $wgRequest->getBool( 'bot' , true ) : 0,
                        'rc_moved_to_ns'        => 0,
                        'rc_moved_to_title'     => '',
                        'rc_ip' => $ip,
@@ -626,3 +621,4 @@ class RecentChange
        }
 }
 
+