94a7799444d97a05ad3deebbee7ea418d420639f
[lhc/web/wiklou.git] / includes / RecentChange.php
1 <?php
2 /**
3 *
4 */
5
6 /**
7 * Utility class for creating new RC entries
8 * mAttribs:
9 * rc_id id of the row in the recentchanges table
10 * rc_timestamp time the entry was made
11 * rc_cur_time timestamp on the cur row
12 * rc_namespace namespace #
13 * rc_title non-prefixed db key
14 * rc_type is new entry, used to determine whether updating is necessary
15 * rc_minor is minor
16 * rc_cur_id page_id of associated page entry
17 * rc_user user id who made the entry
18 * rc_user_text user name who made the entry
19 * rc_comment edit summary
20 * rc_this_oldid rev_id associated with this entry (or zero)
21 * rc_last_oldid rev_id associated with the entry before this one (or zero)
22 * rc_bot is bot, hidden
23 * rc_ip IP address of the user in dotted quad notation
24 * rc_new obsolete, use rc_type==RC_NEW
25 * rc_patrolled boolean whether or not someone has marked this edit as patrolled
26 * rc_old_len integer byte length of the text before the edit
27 * rc_new_len the same after the edit
28 * rc_deleted partial deletion
29 * rc_logid the log_id value for this log entry (or zero)
30 * rc_log_type the log type (or null)
31 * rc_log_action the log action (or null)
32 * rc_params log params
33 *
34 * mExtra:
35 * prefixedDBkey prefixed db key, used by external app via msg queue
36 * lastTimestamp timestamp of previous entry, used in WHERE clause during update
37 * lang the interwiki prefix, automatically set in save()
38 * oldSize text size before the change
39 * newSize text size after the change
40 *
41 * temporary: not stored in the database
42 * notificationtimestamp
43 * numberofWatchingusers
44 *
45 * @todo document functions and variables
46 */
47 class RecentChange
48 {
49 var $mAttribs = array(), $mExtra = array();
50 var $mTitle = false, $mMovedToTitle = false;
51 var $numberofWatchingusers = 0 ; # Dummy to prevent error message in SpecialRecentchangeslinked
52
53 # Factory methods
54
55 public static function newFromRow( $row )
56 {
57 $rc = new RecentChange;
58 $rc->loadFromRow( $row );
59 return $rc;
60 }
61
62 public static function newFromCurRow( $row, $rc_this_oldid = 0 )
63 {
64 $rc = new RecentChange;
65 $rc->loadFromCurRow( $row, $rc_this_oldid );
66 $rc->notificationtimestamp = false;
67 $rc->numberofWatchingusers = false;
68 return $rc;
69 }
70
71 /**
72 * Obtain the recent change with a given rc_id value
73 *
74 * @param $rcid rc_id value to retrieve
75 * @return RecentChange
76 */
77 public static function newFromId( $rcid ) {
78 $dbr = wfGetDB( DB_SLAVE );
79 $res = $dbr->select( 'recentchanges', '*', array( 'rc_id' => $rcid ), __METHOD__ );
80 if( $res && $dbr->numRows( $res ) > 0 ) {
81 $row = $dbr->fetchObject( $res );
82 $dbr->freeResult( $res );
83 return self::newFromRow( $row );
84 } else {
85 return NULL;
86 }
87 }
88
89 /**
90 * Find the first recent change matching some specific conditions
91 *
92 * @param array $conds Array of conditions
93 * @param mixed $fname Override the method name in profiling/logs
94 * @return RecentChange
95 */
96 public static function newFromConds( $conds, $fname = false ) {
97 if( $fname === false )
98 $fname = __METHOD__;
99 $dbr = wfGetDB( DB_SLAVE );
100 $res = $dbr->select(
101 'recentchanges',
102 '*',
103 $conds,
104 $fname
105 );
106 if( $res instanceof ResultWrapper && $res->numRows() > 0 ) {
107 $row = $res->fetchObject();
108 $res->free();
109 return self::newFromRow( $row );
110 }
111 return null;
112 }
113
114 # Accessors
115
116 function setAttribs( $attribs )
117 {
118 $this->mAttribs = $attribs;
119 }
120
121 function setExtra( $extra )
122 {
123 $this->mExtra = $extra;
124 }
125
126 function &getTitle()
127 {
128 if ( $this->mTitle === false ) {
129 $this->mTitle = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] );
130 }
131 return $this->mTitle;
132 }
133
134 function getMovedToTitle()
135 {
136 if ( $this->mMovedToTitle === false ) {
137 $this->mMovedToTitle = Title::makeTitle( $this->mAttribs['rc_moved_to_ns'],
138 $this->mAttribs['rc_moved_to_title'] );
139 }
140 return $this->mMovedToTitle;
141 }
142
143 # Writes the data in this object to the database
144 function save()
145 {
146 global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPPort, $wgRC2UDPPrefix;
147 $fname = 'RecentChange::save';
148
149 $dbw = wfGetDB( DB_MASTER );
150 if ( !is_array($this->mExtra) ) {
151 $this->mExtra = array();
152 }
153 $this->mExtra['lang'] = $wgLocalInterwiki;
154
155 if ( !$wgPutIPinRC ) {
156 $this->mAttribs['rc_ip'] = '';
157 }
158
159 ## If our database is strict about IP addresses, use NULL instead of an empty string
160 if ( $dbw->strictIPs() and $this->mAttribs['rc_ip'] == '' ) {
161 unset( $this->mAttribs['rc_ip'] );
162 }
163
164 # Fixup database timestamps
165 $this->mAttribs['rc_timestamp'] = $dbw->timestamp($this->mAttribs['rc_timestamp']);
166 $this->mAttribs['rc_cur_time'] = $dbw->timestamp($this->mAttribs['rc_cur_time']);
167 $this->mAttribs['rc_id'] = $dbw->nextSequenceValue( 'rc_rc_id_seq' );
168
169 ## If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
170 if ( $dbw->cascadingDeletes() and $this->mAttribs['rc_cur_id']==0 ) {
171 unset ( $this->mAttribs['rc_cur_id'] );
172 }
173
174 # Insert new row
175 $dbw->insert( 'recentchanges', $this->mAttribs, $fname );
176
177 # Set the ID
178 $this->mAttribs['rc_id'] = $dbw->insertId();
179
180 # Update old rows, if necessary
181 if ( $this->mAttribs['rc_type'] == RC_EDIT ) {
182 $lastTime = $this->mExtra['lastTimestamp'];
183 #$now = $this->mAttribs['rc_timestamp'];
184 #$curId = $this->mAttribs['rc_cur_id'];
185
186 # Don't bother looking for entries that have probably
187 # been purged, it just locks up the indexes needlessly.
188 global $wgRCMaxAge;
189 $age = time() - wfTimestamp( TS_UNIX, $lastTime );
190 if( $age < $wgRCMaxAge ) {
191 # live hack, will commit once tested - kate
192 # Update rc_this_oldid for the entries which were current
193 #
194 #$oldid = $this->mAttribs['rc_last_oldid'];
195 #$ns = $this->mAttribs['rc_namespace'];
196 #$title = $this->mAttribs['rc_title'];
197 #
198 #$dbw->update( 'recentchanges',
199 # array( /* SET */
200 # 'rc_this_oldid' => $oldid
201 # ), array( /* WHERE */
202 # 'rc_namespace' => $ns,
203 # 'rc_title' => $title,
204 # 'rc_timestamp' => $dbw->timestamp( $lastTime )
205 # ), $fname
206 #);
207 }
208
209 # Update rc_cur_time
210 #$dbw->update( 'recentchanges', array( 'rc_cur_time' => $now ),
211 # array( 'rc_cur_id' => $curId ), $fname );
212 }
213
214 # Notify external application via UDP
215 if ( $wgRC2UDPAddress ) {
216 $conn = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP );
217 if ( $conn ) {
218 $line = $wgRC2UDPPrefix . $this->getIRCLine();
219 socket_sendto( $conn, $line, strlen($line), 0, $wgRC2UDPAddress, $wgRC2UDPPort );
220 socket_close( $conn );
221 }
222 }
223
224 # E-mail notifications
225 global $wgUseEnotif, $wgShowUpdatedMarker, $wgUser;
226 if( $wgUseEnotif || $wgShowUpdatedMarker ) {
227 // Users
228 if( $this->mAttribs['rc_user'] ) {
229 $editor = ($wgUser->getID() == $this->mAttribs['rc_user']) ?
230 $wgUser : User::newFromID( $this->mAttribs['rc_user'] );
231 // Anons
232 } else {
233 $editor = ($wgUser->getName() == $this->mAttribs['rc_user_text']) ?
234 $wgUser : User::newFromName( $this->mAttribs['rc_user_text'], false );
235 }
236 # FIXME: this would be better as an extension hook
237 $enotif = new EmailNotification();
238 $title = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] );
239 $enotif->notifyOnPageChange( $editor, $title,
240 $this->mAttribs['rc_timestamp'],
241 $this->mAttribs['rc_comment'],
242 $this->mAttribs['rc_minor'],
243 $this->mAttribs['rc_last_oldid'] );
244 }
245
246 # Notify extensions
247 wfRunHooks( 'RecentChange_save', array( &$this ) );
248 }
249
250 /**
251 * Mark a given change as patrolled
252 *
253 * @param mixed $change RecentChange or corresponding rc_id
254 * @returns integer number of affected rows
255 */
256 public static function markPatrolled( $change ) {
257 $rcid = $change instanceof RecentChange
258 ? $change->mAttribs['rc_id']
259 : $change;
260 $dbw = wfGetDB( DB_MASTER );
261 $dbw->update(
262 'recentchanges',
263 array(
264 'rc_patrolled' => 1
265 ),
266 array(
267 'rc_id' => $rcid
268 ),
269 __METHOD__
270 );
271 return $dbw->affectedRows();
272 }
273
274 # Makes an entry in the database corresponding to an edit
275 public static function notifyEdit( $timestamp, &$title, $minor, &$user, $comment,
276 $oldId, $lastTimestamp, $bot, $ip = '', $oldSize = 0, $newSize = 0,
277 $newId = 0)
278 {
279 if ( !$ip ) {
280 $ip = wfGetIP();
281 if ( !$ip ) {
282 $ip = '';
283 }
284 }
285
286 $rc = new RecentChange;
287 $rc->mAttribs = array(
288 'rc_timestamp' => $timestamp,
289 'rc_cur_time' => $timestamp,
290 'rc_namespace' => $title->getNamespace(),
291 'rc_title' => $title->getDBkey(),
292 'rc_type' => RC_EDIT,
293 'rc_minor' => $minor ? 1 : 0,
294 'rc_cur_id' => $title->getArticleID(),
295 'rc_user' => $user->getID(),
296 'rc_user_text' => $user->getName(),
297 'rc_comment' => $comment,
298 'rc_this_oldid' => $newId,
299 'rc_last_oldid' => $oldId,
300 'rc_bot' => $bot ? 1 : 0,
301 'rc_moved_to_ns' => 0,
302 'rc_moved_to_title' => '',
303 'rc_ip' => $ip,
304 'rc_patrolled' => 0,
305 'rc_new' => 0, # obsolete
306 'rc_old_len' => $oldSize,
307 'rc_new_len' => $newSize,
308 'rc_deleted' => 0,
309 'rc_logid' => 0,
310 'rc_log_type' => null,
311 'rc_log_action' => '',
312 'rc_params' => ''
313 );
314
315 $rc->mExtra = array(
316 'prefixedDBkey' => $title->getPrefixedDBkey(),
317 'lastTimestamp' => $lastTimestamp,
318 'oldSize' => $oldSize,
319 'newSize' => $newSize,
320 );
321 $rc->save();
322 return( $rc->mAttribs['rc_id'] );
323 }
324
325 /**
326 * Makes an entry in the database corresponding to page creation
327 * Note: the title object must be loaded with the new id using resetArticleID()
328 * @todo Document parameters and return
329 */
330 public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot,
331 $ip='', $size = 0, $newId = 0 )
332 {
333 if ( !$ip ) {
334 $ip = wfGetIP();
335 if ( !$ip ) {
336 $ip = '';
337 }
338 }
339
340 $rc = new RecentChange;
341 $rc->mAttribs = array(
342 'rc_timestamp' => $timestamp,
343 'rc_cur_time' => $timestamp,
344 'rc_namespace' => $title->getNamespace(),
345 'rc_title' => $title->getDBkey(),
346 'rc_type' => RC_NEW,
347 'rc_minor' => $minor ? 1 : 0,
348 'rc_cur_id' => $title->getArticleID(),
349 'rc_user' => $user->getID(),
350 'rc_user_text' => $user->getName(),
351 'rc_comment' => $comment,
352 'rc_this_oldid' => $newId,
353 'rc_last_oldid' => 0,
354 'rc_bot' => $bot ? 1 : 0,
355 'rc_moved_to_ns' => 0,
356 'rc_moved_to_title' => '',
357 'rc_ip' => $ip,
358 'rc_patrolled' => 0,
359 'rc_new' => 1, # obsolete
360 'rc_old_len' => 0,
361 'rc_new_len' => $size,
362 'rc_deleted' => 0,
363 'rc_logid' => 0,
364 'rc_log_type' => null,
365 'rc_log_action' => '',
366 'rc_params' => ''
367 );
368
369 $rc->mExtra = array(
370 'prefixedDBkey' => $title->getPrefixedDBkey(),
371 'lastTimestamp' => 0,
372 'oldSize' => 0,
373 'newSize' => $size
374 );
375 $rc->save();
376 return( $rc->mAttribs['rc_id'] );
377 }
378
379 # Makes an entry in the database corresponding to a rename
380 public static function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false )
381 {
382 global $wgRequest;
383
384 if ( !$ip ) {
385 $ip = wfGetIP();
386 if ( !$ip ) {
387 $ip = '';
388 }
389 }
390
391 $rc = new RecentChange;
392 $rc->mAttribs = array(
393 'rc_timestamp' => $timestamp,
394 'rc_cur_time' => $timestamp,
395 'rc_namespace' => $oldTitle->getNamespace(),
396 'rc_title' => $oldTitle->getDBkey(),
397 'rc_type' => $overRedir ? RC_MOVE_OVER_REDIRECT : RC_MOVE,
398 'rc_minor' => 0,
399 'rc_cur_id' => $oldTitle->getArticleID(),
400 'rc_user' => $user->getID(),
401 'rc_user_text' => $user->getName(),
402 'rc_comment' => $comment,
403 'rc_this_oldid' => 0,
404 'rc_last_oldid' => 0,
405 'rc_bot' => $user->isAllowed( 'bot' ) ? $wgRequest->getBool( 'bot' , true ) : 0,
406 'rc_moved_to_ns' => $newTitle->getNamespace(),
407 'rc_moved_to_title' => $newTitle->getDBkey(),
408 'rc_ip' => $ip,
409 'rc_new' => 0, # obsolete
410 'rc_patrolled' => 1,
411 'rc_old_len' => NULL,
412 'rc_new_len' => NULL,
413 'rc_deleted' => 0,
414 'rc_logid' => 0, # notifyMove not used anymore
415 'rc_log_type' => null,
416 'rc_log_action' => '',
417 'rc_params' => ''
418 );
419
420 $rc->mExtra = array(
421 'prefixedDBkey' => $oldTitle->getPrefixedDBkey(),
422 'lastTimestamp' => 0,
423 'prefixedMoveTo' => $newTitle->getPrefixedDBkey()
424 );
425 $rc->save();
426 }
427
428 public static function notifyMoveToNew( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='' ) {
429 RecentChange::notifyMove( $timestamp, $oldTitle, $newTitle, $user, $comment, $ip, false );
430 }
431
432 public static function notifyMoveOverRedirect( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='' ) {
433 RecentChange::notifyMove( $timestamp, $oldTitle, $newTitle, $user, $comment, $ip, true );
434 }
435
436 # A log entry is different to an edit in that previous revisions are not kept
437 public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip='',
438 $type, $action, $target, $logComment, $params, $newId=0 )
439 {
440 global $wgRequest;
441
442 if ( !$ip ) {
443 $ip = wfGetIP();
444 if ( !$ip ) {
445 $ip = '';
446 }
447 }
448
449 $rc = new RecentChange;
450 $rc->mAttribs = array(
451 'rc_timestamp' => $timestamp,
452 'rc_cur_time' => $timestamp,
453 'rc_namespace' => $target->getNamespace(),
454 'rc_title' => $target->getDBkey(),
455 'rc_type' => RC_LOG,
456 'rc_minor' => 0,
457 'rc_cur_id' => $target->getArticleID(),
458 'rc_user' => $user->getID(),
459 'rc_user_text' => $user->getName(),
460 'rc_comment' => $logComment,
461 'rc_this_oldid' => 0,
462 'rc_last_oldid' => 0,
463 'rc_bot' => $user->isAllowed( 'bot' ) ? $wgRequest->getBool( 'bot' , true ) : 0,
464 'rc_moved_to_ns' => 0,
465 'rc_moved_to_title' => '',
466 'rc_ip' => $ip,
467 'rc_patrolled' => 1,
468 'rc_new' => 0, # obsolete
469 'rc_old_len' => NULL,
470 'rc_new_len' => NULL,
471 'rc_deleted' => 0,
472 'rc_logid' => $newId,
473 'rc_log_type' => $type,
474 'rc_log_action' => $action,
475 'rc_params' => $params
476 );
477 $rc->mExtra = array(
478 'prefixedDBkey' => $title->getPrefixedDBkey(),
479 'lastTimestamp' => 0,
480 'actionComment' => $actionComment, // the comment appended to the action, passed from LogPage
481 );
482 $rc->save();
483 }
484
485 # Initialises the members of this object from a mysql row object
486 function loadFromRow( $row )
487 {
488 $this->mAttribs = get_object_vars( $row );
489 $this->mAttribs["rc_timestamp"] = wfTimestamp(TS_MW, $this->mAttribs["rc_timestamp"]);
490 $this->mExtra = array();
491 }
492
493 # Makes a pseudo-RC entry from a cur row
494 function loadFromCurRow( $row )
495 {
496 $this->mAttribs = array(
497 'rc_timestamp' => wfTimestamp(TS_MW, $row->rev_timestamp),
498 'rc_cur_time' => $row->rev_timestamp,
499 'rc_user' => $row->rev_user,
500 'rc_user_text' => $row->rev_user_text,
501 'rc_namespace' => $row->page_namespace,
502 'rc_title' => $row->page_title,
503 'rc_comment' => $row->rev_comment,
504 'rc_minor' => $row->rev_minor_edit ? 1 : 0,
505 'rc_type' => $row->page_is_new ? RC_NEW : RC_EDIT,
506 'rc_cur_id' => $row->page_id,
507 'rc_this_oldid' => $row->rev_id,
508 'rc_last_oldid' => isset($row->rc_last_oldid) ? $row->rc_last_oldid : 0,
509 'rc_bot' => 0,
510 'rc_moved_to_ns' => 0,
511 'rc_moved_to_title' => '',
512 'rc_ip' => '',
513 'rc_id' => $row->rc_id,
514 'rc_patrolled' => $row->rc_patrolled,
515 'rc_new' => $row->page_is_new, # obsolete
516 'rc_old_len' => $row->rc_old_len,
517 'rc_new_len' => $row->rc_new_len,
518 'rc_params' => isset($row->rc_params) ? $row->rc_params : '',
519 'rc_log_type' => isset($row->rc_log_type) ? $row->rc_log_type : null,
520 'rc_log_action' => isset($row->rc_log_action) ? $row->rc_log_action : null,
521 'rc_log_id' => isset($row->rc_log_id) ? $row->rc_log_id: 0,
522 // this one REALLY should be set...
523 'rc_deleted' => isset($row->rc_deleted) ? $row->rc_deleted: 0,
524 );
525
526 $this->mExtra = array();
527 }
528
529 /**
530 * Get an attribute value
531 *
532 * @param $name Attribute name
533 * @return mixed
534 */
535 public function getAttribute( $name ) {
536 return isset( $this->mAttribs[$name] ) ? $this->mAttribs[$name] : NULL;
537 }
538
539 /**
540 * Gets the end part of the diff URL associated with this object
541 * Blank if no diff link should be displayed
542 */
543 function diffLinkTrail( $forceCur )
544 {
545 if ( $this->mAttribs['rc_type'] == RC_EDIT ) {
546 $trail = "curid=" . (int)($this->mAttribs['rc_cur_id']) .
547 "&oldid=" . (int)($this->mAttribs['rc_last_oldid']);
548 if ( $forceCur ) {
549 $trail .= '&diff=0' ;
550 } else {
551 $trail .= '&diff=' . (int)($this->mAttribs['rc_this_oldid']);
552 }
553 } else {
554 $trail = '';
555 }
556 return $trail;
557 }
558
559 function cleanupForIRC( $text ) {
560 return str_replace(array("\n", "\r"), array("", ""), $text);
561 }
562
563 function getIRCLine() {
564 global $wgUseRCPatrol;
565
566 // FIXME: Would be good to replace these 2 extract() calls with something more explicit
567 // e.g. list ($rc_type, $rc_id) = array_values ($this->mAttribs); [or something like that]
568 extract($this->mAttribs);
569 extract($this->mExtra);
570
571 if ( $rc_type == RC_LOG ) {
572 $titleObj = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
573 } else {
574 $titleObj =& $this->getTitle();
575 }
576 $title = $titleObj->getPrefixedText();
577 $title = $this->cleanupForIRC( $title );
578
579 // FIXME: *HACK* these should be getFullURL(), hacked for SSL madness --brion 2005-12-26
580 if ( $rc_type == RC_LOG ) {
581 $url = '';
582 } elseif ( $rc_new && $wgUseRCPatrol ) {
583 $url = $titleObj->getInternalURL("rcid=$rc_id");
584 } else if ( $rc_new ) {
585 $url = $titleObj->getInternalURL();
586 } else if ( $wgUseRCPatrol ) {
587 $url = $titleObj->getInternalURL("diff=$rc_this_oldid&oldid=$rc_last_oldid&rcid=$rc_id");
588 } else {
589 $url = $titleObj->getInternalURL("diff=$rc_this_oldid&oldid=$rc_last_oldid");
590 }
591
592 if ( isset( $oldSize ) && isset( $newSize ) ) {
593 $szdiff = $newSize - $oldSize;
594 if ($szdiff < -500) {
595 $szdiff = "\002$szdiff\002";
596 } elseif ($szdiff >= 0) {
597 $szdiff = '+' . $szdiff ;
598 }
599 $szdiff = '(' . $szdiff . ')' ;
600 } else {
601 $szdiff = '';
602 }
603
604 $user = $this->cleanupForIRC( $rc_user_text );
605
606 if ( $rc_type == RC_LOG ) {
607 $logTargetText = $this->getTitle()->getPrefixedText();
608 $comment = $this->cleanupForIRC( str_replace($logTargetText,"\00302$logTargetText\00310",$actionComment) );
609 $flag = $rc_log_action;
610 } else {
611 $comment = $this->cleanupForIRC( $rc_comment );
612 $flag = ($rc_minor ? "M" : "") . ($rc_new ? "N" : "");
613 }
614 # see http://www.irssi.org/documentation/formats for some colour codes. prefix is \003,
615 # no colour (\003) switches back to the term default
616 $fullString = "\00314[[\00307$title\00314]]\0034 $flag\00310 " .
617 "\00302$url\003 \0035*\003 \00303$user\003 \0035*\003 $szdiff \00310$comment\003\n";
618 return $fullString;
619 }
620
621 /**
622 * Returns the change size (HTML).
623 * The lengths can be given optionally.
624 */
625 function getCharacterDifference( $old = 0, $new = 0 ) {
626 global $wgRCChangedSizeThreshold, $wgLang;
627
628 if( $old === 0 ) {
629 $old = $this->mAttribs['rc_old_len'];
630 }
631 if( $new === 0 ) {
632 $new = $this->mAttribs['rc_new_len'];
633 }
634
635 if( $old === NULL || $new === NULL ) {
636 return '';
637 }
638
639 $szdiff = $new - $old;
640 $formatedSize = wfMsgExt( 'rc-change-size', array( 'parsemag', 'escape'),
641 $wgLang->formatNum($szdiff) );
642
643 if( $szdiff < $wgRCChangedSizeThreshold ) {
644 return '<strong class=\'mw-plusminus-neg\'>(' . $formatedSize . ')</strong>';
645 } elseif( $szdiff === 0 ) {
646 return '<span class=\'mw-plusminus-null\'>(' . $formatedSize . ')</span>';
647 } elseif( $szdiff > 0 ) {
648 return '<span class=\'mw-plusminus-pos\'>(+' . $formatedSize . ')</span>';
649 } else {
650 return '<span class=\'mw-plusminus-neg\'>(' . $formatedSize . ')</span>';
651 }
652 }
653 }