Merge "Omit RC_EXTERNAL edits from UDP feed"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 29 Mar 2013 02:15:55 +0000 (02:15 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 29 Mar 2013 02:15:56 +0000 (02:15 +0000)
1  2 
includes/RecentChange.php

@@@ -110,7 -110,7 +110,7 @@@ class RecentChange 
        /**
         * Obtain the recent change with a given rc_id value
         *
 -       * @param $rcid Int rc_id value to retrieve
 +       * @param int $rcid rc_id value to retrieve
         * @return RecentChange
         */
        public static function newFromId( $rcid ) {
        /**
         * Find the first recent change matching some specific conditions
         *
 -       * @param $conds Array of conditions
 +       * @param array $conds of conditions
         * @param $fname Mixed: override the method name in profiling/logs
         * @return RecentChange
         */
        public function &getTitle() {
                if ( $this->mTitle === false ) {
                        $this->mTitle = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] );
 -                      # Make sure the correct page ID is process cached
 -                      $this->mTitle->resetArticleID( $this->mAttribs['rc_cur_id'] );
                }
                return $this->mTitle;
        }
        public function notifyRC2UDP() {
                global $wgRC2UDPAddress, $wgRC2UDPOmitBots;
                # Notify external application via UDP
-               if ( $wgRC2UDPAddress && ( !$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots ) ) {
+               # Omit RC_EXTERNAL changes: bots and tools can get these edits from the feed of the external wiki
+               if ( $wgRC2UDPAddress && $this->mAttribs['rc_type'] != RC_EXTERNAL &&
+                       ( !$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots ) ) {
                        self::sendToUDP( $this->getIRCLine() );
                }
        }
        /**
         * Send some text to UDP.
         * @see RecentChange::cleanupForIRC
 -       * @param $line String: text to send
 -       * @param $address String: defaults to $wgRC2UDPAddress.
 -       * @param $prefix String: defaults to $wgRC2UDPPrefix.
 -       * @param $port Int: defaults to $wgRC2UDPPort. (Since 1.17)
 +       * @param string $line text to send
 +       * @param string $address defaults to $wgRC2UDPAddress.
 +       * @param string $prefix defaults to $wgRC2UDPPrefix.
 +       * @param int $port defaults to $wgRC2UDPPort. (Since 1.17)
         * @return Boolean: success
         */
        public static function sendToUDP( $line, $address = '', $prefix = '', $port = '' ) {
        }
  
        /**
 -       * Remove newlines, carriage returns and decode html entites
 +       * Remove newlines, carriage returns and decode html entities
         * @param $text String
         * @return String
         */
                        'rc_params'     => ''
                );
  
 -              $rc->mExtra =  array(
 +              $rc->mExtra = array(
                        'prefixedDBkey' => $title->getPrefixedDBkey(),
                        'lastTimestamp' => $lastTimestamp,
                        'oldSize'       => $oldSize,
                        'rc_params'         => ''
                );
  
 -              $rc->mExtra =  array(
 +              $rc->mExtra = array(
                        'prefixedDBkey' => $title->getPrefixedDBkey(),
                        'lastTimestamp' => 0,
                        'oldSize' => 0,
                        'rc_params'     => $params
                );
  
 -              $rc->mExtra =  array(
 +              $rc->mExtra = array(
                        'prefixedDBkey' => $title->getPrefixedDBkey(),
                        'lastTimestamp' => 0,
                        'actionComment' => $actionComment, // the comment appended to the action, passed from LogPage
        /**
         * Get an attribute value
         *
 -       * @param $name String Attribute name
 +       * @param string $name Attribute name
         * @return mixed
         */
        public function getAttribute( $name ) {