Recording whether a page move was over a redirect or to a new location. In principle...
authorTim Starling <tstarling@users.mediawiki.org>
Sun, 20 Jun 2004 11:55:24 +0000 (11:55 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sun, 20 Jun 2004 11:55:24 +0000 (11:55 +0000)
includes/RecentChange.php
includes/Skin.php
includes/Title.php
languages/Language.php

index 793cb6b..8cce2b6 100644 (file)
@@ -5,6 +5,8 @@ define( "RC_EDIT", 0);
 define( "RC_NEW", 1);
 define( "RC_MOVE", 2);
 define( "RC_LOG", 3);
+define( "RC_MOVE_OVER_REDIRECT", 4);
+
 
 /*
 mAttributes:
@@ -211,7 +213,7 @@ class RecentChange
        }
        
        # Makes an entry in the database corresponding to a rename
-       /*static*/ function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='' )
+       /*static*/ function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false )
        {
                if ( !$ip ) {
                        global $wgIP;
@@ -223,7 +225,7 @@ class RecentChange
                        'rc_cur_time'   => $timestamp,
                        'rc_namespace'  => $oldTitle->getNamespace(),
                        'rc_title'      => $oldTitle->getDBkey(),
-                       'rc_type'       => RC_MOVE,
+                       'rc_type'       => $overRedir ? RC_MOVE_OVER_REDIRECT : RC_MOVE,
                        'rc_minor'      => 0,
                        'rc_cur_id'     => $oldTitle->getArticleID(),
                        'rc_user'       => $user->getID(),
@@ -246,6 +248,14 @@ class RecentChange
                $rc->save();
        }
        
+       /* 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='' ) {
+               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='' )
index 7abcc8d..f8f8884 100644 (file)
@@ -2058,7 +2058,7 @@ class Skin {
                $r .= '<img src="'.$wgStylePath.'/images/Arr_.png" width="12" height="12" border="0" />' ;
                $r .= '<tt>' ;
 
-               if ( $rc_type == RC_MOVE ) {
+               if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
                        $r .= '&nbsp;&nbsp;';
                } else {
                        # M & N (minor & new)
@@ -2099,7 +2099,7 @@ class Skin {
                $r .= $rcObj->usertalklink ;
 
                # Comment
-               if ( $rc_comment != '' && $rc_type != RC_MOVE ) {
+                if ( $rc_comment != '' && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
                        $rc_comment=$this->formatComment($rc_comment);
                        $r .= $wgLang->emphasize( ' ('.$rc_comment.')' );
                }
@@ -2276,7 +2276,7 @@ class Skin {
                }
                $s .= '<li> ';
 
-               if ( $rc_type == RC_MOVE ) {
+               if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
                        # Diff
                        $s .= '(' . wfMsg( 'diff' ) . ') (';
                        # Hist
@@ -2284,10 +2284,13 @@ class Skin {
                                ') . . ';
                        
                        # "[[x]] moved to [[y]]"
-
-                       $s .= wfMsg( '1movedto2', $this->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
+                       if ( $rc_type == RC_MOVE ) {
+                               $msg = '1movedto2';
+                       } else {
+                               $msg = '1movedto2_redir';
+                       }
+                       $s .= wfMsg( $msg, $this->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
                                $this->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
-
                } else {
                        # Diff link
                        if ( $rc_type == RC_NEW || $rc_type == RC_LOG ) {
index 18d932d..58fcd2c 100644 (file)
@@ -940,7 +940,7 @@ class Title {
                        $fname
                );
                
-               RecentChange::notifyMove( $now, $this, $nt, $wgUser, $comment );
+               RecentChange::notifyMoveOverRedirect( $now, $this, $nt, $wgUser, $comment );
 
                # Swap links
                
@@ -1060,7 +1060,7 @@ class Title {
                );
                
                # Record in RC
-               RecentChange::notifyMove( $now, $this, $nt, $wgUser, $comment );
+               RecentChange::notifyMoveToNew( $now, $this, $nt, $wgUser, $comment );
 
                # Purge squid and linkscc as per article creation
                Article::onArticleCreate( $nt );
index 0f04485..9b58a78 100644 (file)
@@ -1228,6 +1228,7 @@ title. Please merge them manually.',
 'talkpagemoved' => 'The corresponding talk page was also moved.',
 'talkpagenotmoved' => 'The corresponding talk page was <strong>not</strong> moved.',
 '1movedto2'            => "$1 moved to $2",
+'1movedto2_redir' => '$1 moved to $2 over redirect',
 
 # Export