Fix grammar in 'mimesearch-summary'
[lhc/web/wiklou.git] / includes / PatrolLog.php
index 9566888..5727853 100644 (file)
@@ -11,8 +11,8 @@ class PatrolLog {
        /**
         * Record a log event for a change being patrolled
         *
-        * @param mixed $change Change identifier or RecentChange object
-        * @param bool $auto Was this patrol event automatic?
+        * @param $rc Mixed: change identifier or RecentChange object
+        * @param $auto Boolean: was this patrol event automatic?
         */
        public static function record( $rc, $auto = false ) {
                if( !( $rc instanceof RecentChange ) ) {
@@ -23,14 +23,8 @@ class PatrolLog {
                $title = Title::makeTitleSafe( $rc->getAttribute( 'rc_namespace' ), $rc->getAttribute( 'rc_title' ) );
                if( is_object( $title ) ) {
                        $params = self::buildParams( $rc, $auto );
-                       $log = new LogPage( 'patrol', false ); # False suppresses RC entries
+                       $log = new LogPage( 'patrol', false, $auto ? "skipUDP" : "UDP" ); # False suppresses RC entries
                        $log->addEntry( 'patrol', $title, '', $params );
-                       # Notify external application via UDP.
-                       # We send this to IRC but do not want to add it the RC table.
-                       global $wgRC2UDPAddress, $wgRC2UDPOmitBots;
-                       if( $wgRC2UDPAddress && ( !$rc->getAttribute('rc_bot') || !$wgRC2UDPOmitBots ) ) {
-                               self::sendToUDP( $rc->getIRCLine() );
-                       }
                        return true;
                }
                return false;
@@ -39,26 +33,30 @@ class PatrolLog {
        /**
         * Generate the log action text corresponding to a patrol log item
         *
-        * @param Title $title Title of the page that was patrolled
-        * @param array $params Log parameters (from logging.log_params)
-        * @param Skin $skin Skin to use for building links, etc.
-        * @return string
+        * @param $title Title of the page that was patrolled
+        * @param $params Array: log parameters (from logging.log_params)
+        * @param $skin Skin to use for building links, etc.
+        * @return String
         */
        public static function makeActionText( $title, $params, $skin ) {
-               # This is a bit of a hack, but...if $skin is not a Skin, then *do nothing*
-               # -- this is fine, because the action text we would be queried for under
-               # these conditions would have gone into recentchanges, which we aren't
-               # supposed to be updating
+               list( $cur, /* $prev */, $auto ) = $params;
                if( is_object( $skin ) ) {
-                       list( $cur, /* $prev */, $auto ) = $params;
                        # Standard link to the page in question
-                       $link = $skin->makeLinkObj( $title );
+                       $link = $skin->link( $title );
                        if( $title->exists() ) {
                                # Generate a diff link
-                               $bits[] = 'oldid=' . urlencode( $cur );
-                               $bits[] = 'diff=prev';
-                               $bits = implode( '&', $bits );
-                               $diff = $skin->makeKnownLinkObj( $title, htmlspecialchars( wfMsg( 'patrol-log-diff', $cur ) ), $bits );
+                               $query = array(
+                                       'oldid' => $cur,
+                                       'diff' => 'prev'
+                               );
+
+                               $diff = $skin->link(
+                                       $title,
+                                       htmlspecialchars( wfMsg( 'patrol-log-diff', $cur ) ),
+                                       array(),
+                                       $query,
+                                       array( 'known', 'noclasses' )
+                               );
                        } else {
                                # Don't bother with a diff link, it's useless
                                $diff = htmlspecialchars( wfMsg( 'patrol-log-diff', $cur ) );
@@ -68,16 +66,17 @@ class PatrolLog {
                        # Put it all together
                        return wfMsgHtml( 'patrol-log-line', $diff, $link, $auto );
                } else {
-                       return '';
+                       $text = $title->getPrefixedText();
+                       return wfMsgForContent( 'patrol-log-line', wfMsgHtml('patrol-log-diff',$cur), "[[$text]]", '' );
                }
        }
 
        /**
         * Prepare log parameters for a patrolled change
         *
-        * @param RecentChange $change RecentChange to represent
-        * @param bool $auto Whether the patrol event was automatic
-        * @return array
+        * @param $change RecentChange to represent
+        * @param $auto Boolean: whether the patrol event was automatic
+        * @return Array
         */
        private static function buildParams( $change, $auto ) {
                return array(