log entries.
* Also fixed it in the javascript recentchanges.
* Moved the value behind the page title to ensure the columns are still lined up
* Merged both sql patches into one.
* Set the default for both columns to NULL to make it work on edits before the db
update.
after the password is reset, for instance by e-mail.
* (bug 6394) Invalidate the password set for "by e-mail" account creations
to avoid accidental empty password creations.
+* Made the show change size function work on page moves, page creations, and
+ log entries. Also fixed it in the javascript recentchanges.
== Languages updated ==
$this->insertDiffHist($s, $rc, $unpatrolled);
- if( $wgRCShowChangedSize ) {
- $s .= $rc->getCharacterDifference() . ' . . ';
- }
-
# M, N, b and ! (minor, new, bot and unpatrolled)
$s .= ' ' . $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', $rc_bot );
$this->insertArticleLink($s, $rc, $unpatrolled, $watched);
wfProfileIn( $fname.'-rest' );
$this->insertTimestamp($s,$rc);
+
+ if( $wgRCShowChangedSize ) {
+ $s .= ( $rc->getCharacterDifference() == '' ? '' : $rc->getCharacterDifference() . ' . . ' );
+ }
+
$this->insertUserRelatedLinks($s,$rc);
$this->insertComment($s, $rc);
* Format a line for enhanced recentchange (aka with javascript and block of lines).
*/
function recentChangesLine( &$baseRC, $watched = false ) {
- global $wgLang, $wgContLang, $wgRCShowChangedSize;
+ global $wgLang, $wgContLang;
# Create a specialised object
$rc = RCCacheEntry::newFromParent( $baseRC );
$clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' );
}
- $time = $wgContLang->time( $rc_timestamp, true, true );
- # Character diff
- if( $wgRCShowChangedSize ) {
- $time .= ' ' . $rc->getCharacterDifference();
- }
- $time .= '</tt> ';
+ $time = $wgContLang->time( $rc_timestamp, true, true ) . '</tt> ';
$rc->watched = $watched;
$rc->link = $clink;
$rc->timestamp = $time;
if( $block[0]->mAttribs['rc_type'] != RC_LOG ) {
# Changes
$r .= ' ('.count($block).' ';
+
if( $isnew ) {
$r .= $this->message['changes'];
} else {
$r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
$this->message['changes'], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
}
- $r .= '; ';
+
+ # Character difference
+ $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'],
+ $block[0]->mAttribs['rc_new_len'] );
+ if( $chardiff == '' ) {
+ $r .= '; ';
+ } else {
+ $r .= '; ' . $chardiff . ' ';
+ }
+
# History
$r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
$r .= $rcObj->curlink;
$r .= '; ';
$r .= $rcObj->lastlink;
- $r .= ') . . '.$rcObj->userlink;
+ $r .= ') . . ';
+
+ # Character diff
+ if( $wgRCShowChangedSize ) {
+ $r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ;
+ }
+
+ $r .= $rcObj->userlink;
$r .= $rcObj->usertalklink;
$r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
$r .= "<br />\n";
* @return string a HTML formated line (generated using $r)
*/
function recentChangesBlockLine( $rcObj ) {
- global $wgContLang;
+ global $wgContLang, $wgRCShowChangedSize;
# Get rc_xxxx variables
extract( $rcObj->mAttribs );
$r .= ' ('. $rcObj->difflink .'; ';
# Hist
- $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' );
+ $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ') . . ';
+
+ # Character diff
+ if( $wgRCShowChangedSize ) {
+ $r .= ( $rcObj->getCharacterDifference() == '' ? '' : ' ' . $rcObj->getCharacterDifference() . ' . . ' ) ;
+ }
# User/talk
- $r .= ') . . '.$rcObj->userlink . $rcObj->usertalklink;
+ $r .= $rcObj->userlink . $rcObj->usertalklink;
# Comment
if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
'rc_moved_to_title' => '',
'rc_ip' => $ip,
'rc_patrolled' => 0,
- 'rc_new' => 1 # obsolete
+ 'rc_new' => 1, # obsolete
+ 'rc_old_len' => 0,
+ 'rc_new_len' => $size
);
$rc->mExtra = array(
'rc_ip' => $ip,
'rc_new' => 0, # obsolete
'rc_patrolled' => 1,
- 'rc_old_len' => 0,
- 'rc_new_len' => 0,
+ 'rc_old_len' => NULL,
+ 'rc_new_len' => NULL,
);
$rc->mExtra = array(
'rc_ip' => $ip,
'rc_patrolled' => 1,
'rc_new' => 0, # obsolete
- 'rc_old_len' => 0,
- 'rc_new_len' => 0,
+ 'rc_old_len' => NULL,
+ 'rc_new_len' => NULL,
);
$rc->mExtra = array(
'prefixedDBkey' => $title->getPrefixedDBkey(),
'rc_id' => $row->rc_id,
'rc_patrolled' => $row->rc_patrolled,
'rc_new' => $row->page_is_new, # obsolete
- 'rc_old_len' => 0, # we can't get the text lengts from a cur row
- 'rc_new_len' => 0,
+ 'rc_old_len' => NULL, # we can't get the text lengts from a cur row
+ 'rc_new_len' => NULL,
);
$this->mExtra = array();
return $fullString;
}
- function getCharacterDifference() {
- global $wgRCChangedSizeThreshold;
- $szdiff = $this->mAttribs['rc_new_len'] - $this->mAttribs['rc_old_len'];
+ /**
+ * Returns the change size (HTML).
+ * The lengths can be given optionally.
+ */
+ function getCharacterDifference( $old = 0, $new = 0 ) {
+ global $wgRCChangedSizeThreshold, $wgLang;
+
+ if( $old === 0 ) {
+ $old = $this->mAttribs['rc_old_len'];
+ }
+ if( $new === 0 ) {
+ $new = $this->mAttribs['rc_new_len'];
+ }
+
+ if( $old === NULL || $new === NULL ) {
+ return '';
+ }
+
+ $szdiff = $new - $old;
if( $szdiff < $wgRCChangedSizeThreshold ) {
- return "<span class='mw-plusminus-bold'>($szdiff)</span>";
+ return '<span class=\'mw-plusminus-bold\'>(' . $wgLang->formatNum( $szdiff ) . '</span>';
} elseif( $szdiff === 0 ) {
- return "<span class='mw-plusminus-null'>($szdiff)</span>";
+ return '<span class=\'mw-plusminus-null\'>(' . $wgLang->formatNum( $szdiff ) . ')</span>';
} elseif( $szdiff > 0 ) {
- return "<span class='mw-plusminus-pos'>(+$szdiff)</span>";
+ return '<span class=\'mw-plusminus-pos\'>(+' . $wgLang->formatNum( $szdiff ) . ')</span>';
} else {
- return "<span class='mw-pluminus-neg'>($szdiff)</span>";
+ return '<span class=\'mw-pluminus-neg\'>(' . $wgLang->formatNum( $szdiff ) . ')</span>';
}
}
}
--- /dev/null
+--
+-- patch-rc_len.sql
+-- Adds two rows to recentchanges to hold the text size befor and after the edit
+-- 2006-12-03
+--
+
+ALTER TABLE /*$wgDBprefix*/recentchanges
+ ADD COLUMN rc_old_len int(10), ADD COLUMN rc_new_len int(10);
+
+++ /dev/null
---
--- patch-rc_new_len.sql
--- Adds a row to recentchanges to hold the text size after the edit
--- 2006-12-03
---
-
-ALTER TABLE /*$wgDBprefix*/recentchanges
- ADD COLUMN rc_new_len int(10) default 0;
-
+++ /dev/null
---
--- patch-rc_old_len.sql
--- Adds a row to recentchanges to hold the text size before the edit
--- 2006-12-03
---
-
-ALTER TABLE /*$wgDBprefix*/recentchanges
- ADD COLUMN rc_old_len int(10) default 0;
-
array( 'recentchanges', 'rc_ip', 'patch-rc_ip.sql' ),
array( 'recentchanges', 'rc_id', 'patch-rc_id.sql' ),
array( 'recentchanges', 'rc_patrolled', 'patch-rc-patrol.sql' ),
- array( 'recentchanges', 'rc_old_len', 'patch-rc_old_len.sql' ),
- array( 'recentchanges', 'rc_new_len', 'patch-rc_new_len.sql' ),
+ array( 'recentchanges', 'rc_old_len', 'patch-rc_len.sql' ),
array( 'user', 'user_real_name', 'patch-user-realname.sql' ),
array( 'user', 'user_token', 'patch-user_token.sql' ),
array( 'user', 'user_email_token', 'patch-user_email_token.sql' ),
CREATE INDEX querycachetwo_titletwo ON querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo);
-- New columns for fancy recentchanges display
-ALTER TABLE recentchanges ADD rc_old_len INT DEFAULT 0;
-ALTER TABLE recentchanges ADD rc_new_len INT DEFAULT 0;
+ALTER TABLE recentchanges ADD rc_old_len INT;
+ALTER TABLE recentchanges ADD rc_new_len INT;
-- Note this upgrade
INSERT INTO mediawiki_version (type,mw_version,notes)