Clean up log restrictions check
authorAaron Schulz <aaron@users.mediawiki.org>
Fri, 9 Jan 2009 18:38:10 +0000 (18:38 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Fri, 9 Jan 2009 18:38:10 +0000 (18:38 +0000)
includes/LogPage.php
includes/RecentChange.php

index d3016c0..80280fb 100644 (file)
@@ -80,13 +80,10 @@ class LogPage {
                }
                # And update recentchanges
                if( $this->updateRecentChanges ) {
-                       # Don't add private logs to RC!
-                       if( !isset($wgLogRestrictions[$this->type]) || $wgLogRestrictions[$this->type]=='*' ) {
-                               $titleObj = SpecialPage::getTitleFor( 'Log', $this->type );
-                               $rcComment = $this->getRcComment();
-                               RecentChange::notifyLog( $now, $titleObj, $this->doer, $rcComment, '',
-                                       $this->type, $this->action, $this->target, $this->comment, $this->params, $newId );
-                       }
+                       $titleObj = SpecialPage::getTitleFor( 'Log', $this->type );
+                       $rcComment = $this->getRcComment();
+                       RecentChange::notifyLog( $now, $titleObj, $this->doer, $rcComment, '', $this->type,
+                               $this->action, $this->target, $this->comment, $this->params, $newId );
                } else if( $this->sendToUDP ) {
                        # Notify external application via UDP.
                        # We send this to IRC but do not want to add it the RC table.
index 4a8fa8f..f5dc14d 100644 (file)
@@ -473,16 +473,22 @@ class RecentChange
                RecentChange::notifyMove( $timestamp, $oldTitle, $newTitle, $user, $comment, $ip, true );
        }
 
-       public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip='',
-          $type, $action, $target, $logComment, $params, $newId=0 )
+       public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip='', $type, 
+               $action, $target, $logComment, $params, $newId=0 )
        {
+               global $wgLogRestrictions;
+               # Don't add private logs to RC!
+               if( isset($wgLogRestrictions[$type]) && !$wgLogRestrictions[$type] == '*' ) {
+                       return false;
+               }
                $rc = self::newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action,
                        $target, $logComment, $params, $newId );
                $rc->save();
+               return true;
        }
 
        public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip='',
-          $type, $action, $target, $logComment, $params, $newId=0 )
+               $type, $action, $target, $logComment, $params, $newId=0 )
        {
                global $wgRequest;