From ea0b42a546dd69f9e666f4e4bb83f7a22f005e62 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sun, 20 Jun 2004 11:55:24 +0000 Subject: [PATCH] Recording whether a page move was over a redirect or to a new location. In principle this allows for automated reverting. --- includes/RecentChange.php | 14 ++++++++++++-- includes/Skin.php | 15 +++++++++------ includes/Title.php | 4 ++-- languages/Language.php | 1 + 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/includes/RecentChange.php b/includes/RecentChange.php index 793cb6b11b..8cce2b6f46 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -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='' ) diff --git a/includes/Skin.php b/includes/Skin.php index 7abcc8de6d..f8f8884e77 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -2058,7 +2058,7 @@ class Skin { $r .= '' ; $r .= '' ; - if ( $rc_type == RC_MOVE ) { + if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { $r .= '  '; } 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 .= '
  • '; - 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 ) { diff --git a/includes/Title.php b/includes/Title.php index 18d932d039..58fcd2cc2e 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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 ); diff --git a/languages/Language.php b/languages/Language.php index 0f0448558d..9b58a7863a 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1228,6 +1228,7 @@ title. Please merge them manually.', 'talkpagemoved' => 'The corresponding talk page was also moved.', 'talkpagenotmoved' => 'The corresponding talk page was not moved.', '1movedto2' => "$1 moved to $2", +'1movedto2_redir' => '$1 moved to $2 over redirect', # Export -- 2.20.1