From ce27044fba0c00e7023da0f4c2bf77dc847c8557 Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Fri, 1 Jul 2005 20:36:04 +0000 Subject: [PATCH] update rc_this_oldid correctly --- includes/Article.php | 15 ++++++++------- includes/ChangesList.php | 20 ++++++++++---------- includes/RecentChange.php | 33 +++++++++++++++++---------------- 3 files changed, 35 insertions(+), 33 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 939b8ea936..9af2d9a4bf 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -490,7 +490,7 @@ class Article { return 0; } } - + /** * Returns true if this article exists in the database. * @return bool @@ -551,7 +551,7 @@ class Article { isset( $this->mRevision ) && $this->mRevision->isCurrent(); } - + /** * Loads everything except the text * This isn't necessary for all uses, so it's only done if needed. @@ -771,13 +771,13 @@ class Article { $wgOut->addPrimaryWikiText( $text, $this ); } else { # Display content, don't attempt to save to parser cache - + # Don't show section-edit links on old revisions... this way lies madness. if( !$this->isCurrent() ) { $oldEditSectionSetting = $wgOut->mParserOptions->setEditSection( false ); } $wgOut->addWikiText( $text ); - + if( !$this->isCurrent() ) { $wgOut->mParserOptions->setEditSection( $oldEditSectionSetting ); } @@ -968,8 +968,8 @@ class Article { Article::onArticleCreate( $this->mTitle ); if(!$suppressRC) { - RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary, 'default', - '', strlen( $text ) ); + RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary, 'default', + '', strlen( $text ), $revisionId ); } if ($watchthis) { @@ -1150,7 +1150,8 @@ class Article { # Update recentchanges and purge cache and whatnot $bot = (int)($wgUser->isBot() || $forceBot); RecentChange::notifyEdit( $now, $this->mTitle, $isminor, $wgUser, $summary, - $lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize ); + $lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize, + $revisionId ); Article::onArticleEdit( $this->mTitle ); } } diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 6524d087e9..a3f6923a00 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -14,7 +14,7 @@ class ChangesList { function ChangesList( &$skin ) { $this->skin =& $skin; } - + /** * Returns the appropiate flags for new page, minor change and patrolling */ @@ -28,7 +28,7 @@ class ChangesList { } - /** + /** * Returns text for the start of the tabular part of RC */ function beginRecentChangesList() { @@ -276,15 +276,15 @@ class ChangesList { $message[$msg] = wfMsg( $msg ); } } - + # Extract DB fields into local scope extract( $rc->mAttribs ); $curIdEq = 'curid=' . $rc_cur_id; # Should patrol-related stuff be shown? - $unpatrolled = $wgUseRCPatrol && $wgUser->isLoggedIn() && + $unpatrolled = $wgUseRCPatrol && $wgUser->isLoggedIn() && ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') ) && $rc_patrolled == 0; - + # Make date header if necessary $date = $wgLang->date( $rc_timestamp, true, true ); $s = ''; @@ -409,14 +409,14 @@ class ChangesList { function recentChangesLineNew( &$baseRC, $watched = false ) { global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgUseRCPatrol, $wgOnlySysopsCanPatrol, $wgSysopUserBans; - + static $message; if( !isset( $message ) ) { foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last blocklink' ) as $msg ) { $message[$msg] = wfMsg( $msg ); } } - + # Create a specialised object $rc = RCCacheEntry::newFromParent( $baseRC ) ; @@ -434,15 +434,15 @@ class ChangesList { $ret .= "

{$date}

\n"; $this->lastdate = $date; } - + # Should patrol-related stuff be shown? - if ( $wgUseRCPatrol && $wgUser->isLoggedIn() && + if ( $wgUseRCPatrol && $wgUser->isLoggedIn() && ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') )) { $rc->unpatrolled = !$rc_patrolled; } else { $rc->unpatrolled = false; } - + # Make article link if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir"; diff --git a/includes/RecentChange.php b/includes/RecentChange.php index 09195c12c6..9495057c9c 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -137,18 +137,18 @@ class RecentChange # been purged, it just locks up the indexes needlessly. global $wgRCMaxAge; $age = time() - wfTimestamp( TS_UNIX, $lastTime ); - if( $age < $wgRCMaxAge ) { - # Update rc_this_oldid for the entries which were current - $dbw->update( 'recentchanges', - array( /* SET */ - 'rc_this_oldid' => $oldid - ), array( /* WHERE */ - 'rc_namespace' => $ns, - 'rc_title' => $title, - 'rc_timestamp' => $dbw->timestamp( $lastTime ) - ), $fname - ); - } +# if( $age < $wgRCMaxAge ) { +# # Update rc_this_oldid for the entries which were current +# $dbw->update( 'recentchanges', +# array( /* SET */ +# 'rc_this_oldid' => $oldid +# ), array( /* WHERE */ +# 'rc_namespace' => $ns, +# 'rc_title' => $title, +# 'rc_timestamp' => $dbw->timestamp( $lastTime ) +# ), $fname +# ); +# } # Update rc_cur_time $dbw->update( 'recentchanges', array( 'rc_cur_time' => $now ), @@ -184,7 +184,8 @@ class RecentChange # Makes an entry in the database corresponding to an edit /*static*/ function notifyEdit( $timestamp, &$title, $minor, &$user, $comment, - $oldId, $lastTimestamp, $bot = "default", $ip = '', $oldSize = 0, $newSize = 0 ) + $oldId, $lastTimestamp, $bot = "default", $ip = '', $oldSize = 0, $newSize = 0, + $newId = 0) { if ( $bot == 'default ' ) { $bot = $user->isBot(); @@ -207,7 +208,7 @@ class RecentChange 'rc_user' => $user->getID(), 'rc_user_text' => $user->getName(), 'rc_comment' => $comment, - 'rc_this_oldid' => $title->getLatestRevID(), + 'rc_this_oldid' => $newId, 'rc_last_oldid' => $oldId, 'rc_bot' => $bot ? 1 : 0, 'rc_moved_to_ns' => 0, @@ -229,7 +230,7 @@ class RecentChange # Makes an entry in the database corresponding to page creation # Note: the title object must be loaded with the new id using resetArticleID() /*static*/ function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot = "default", - $ip='', $size = 0 ) + $ip='', $size = 0, $newId = 0 ) { if ( !$ip ) { global $wgIP; @@ -251,7 +252,7 @@ class RecentChange 'rc_user' => $user->getID(), 'rc_user_text' => $user->getName(), 'rc_comment' => $comment, - 'rc_this_oldid' => 0, + 'rc_this_oldid' => $newId, 'rc_last_oldid' => 0, 'rc_bot' => $bot ? 1 : 0, 'rc_moved_to_ns' => 0, -- 2.20.1