update rc_this_oldid correctly
This commit is contained in:
parent
f4c77ef080
commit
ce27044fba
3 changed files with 35 additions and 33 deletions
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 .= "<h4>{$date}</h4>\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";
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue