*Clean up deletion of revisions and remove some gaps
[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;
226 if( $wgUseEnotif ) {
227 # this would be better as an extension hook
228 global $wgUser;
229 include_once( "UserMailer.php" );
230 $enotif = new EmailNotification();
231 $title = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] );
232 $enotif->notifyOnPageChange( $wgUser, $title,
233 $this->mAttribs['rc_timestamp'],
234 $this->mAttribs['rc_comment'],
235 $this->mAttribs['rc_minor'],
236 $this->mAttribs['rc_last_oldid'] );
237 }
238
239 # Notify extensions
240 wfRunHooks( 'RecentChange_save', array( &$this ) );
241 }
242
243 /**
244 * Mark a given change as patrolled
245 *
246 * @param mixed $change RecentChange or corresponding rc_id
247 */
248 public static function markPatrolled( $change ) {
249 $rcid = $change instanceof RecentChange
250 ? $change->mAttribs['rc_id']
251 : $change;
252 $dbw = wfGetDB( DB_MASTER );
253 $dbw->update(
254 'recentchanges',
255 array(
256 'rc_patrolled' => 1
257 ),
258 array(
259 'rc_id' => $rcid
260 ),
261 __METHOD__
262 );
263 }
264
265 # Makes an entry in the database corresponding to an edit
266 public static function notifyEdit( $timestamp, &$title, $minor, &$user, $comment,
267 $oldId, $lastTimestamp, $bot = "default", $ip = '', $oldSize = 0, $newSize = 0,
268 $newId = 0)
269 {
270
271 if ( $bot === 'default' ) {
272 $bot = $user->isAllowed( 'bot' );
273 }
274
275 if ( !$ip ) {
276 $ip = wfGetIP();
277 if ( !$ip ) {
278 $ip = '';
279 }
280 }
281
282 $rc = new RecentChange;
283 $rc->mAttribs = array(
284 'rc_timestamp' => $timestamp,
285 'rc_cur_time' => $timestamp,
286 'rc_namespace' => $title->getNamespace(),
287 'rc_title' => $title->getDBkey(),
288 'rc_type' => RC_EDIT,
289 'rc_minor' => $minor ? 1 : 0,
290 'rc_cur_id' => $title->getArticleID(),
291 'rc_user' => $user->getID(),
292 'rc_user_text' => $user->getName(),
293 'rc_comment' => $comment,
294 'rc_this_oldid' => $newId,
295 'rc_last_oldid' => $oldId,
296 'rc_bot' => $bot ? 1 : 0,
297 'rc_moved_to_ns' => 0,
298 'rc_moved_to_title' => '',
299 'rc_ip' => $ip,
300 'rc_patrolled' => 0,
301 'rc_new' => 0, # obsolete
302 'rc_old_len' => $oldSize,
303 'rc_new_len' => $newSize,
304 'rc_deleted' => 0,
305 'rc_logid' => 0,
306 'rc_log_type' => null,
307 'rc_log_action' => '',
308 'rc_params' => ''
309 );
310
311 $rc->mExtra = array(
312 'prefixedDBkey' => $title->getPrefixedDBkey(),
313 'lastTimestamp' => $lastTimestamp,
314 'oldSize' => $oldSize,
315 'newSize' => $newSize,
316 );
317 $rc->save();
318 return( $rc->mAttribs['rc_id'] );
319 }
320
321 /**
322 * Makes an entry in the database corresponding to page creation
323 * Note: the title object must be loaded with the new id using resetArticleID()
324 * @todo Document parameters and return
325 */
326 public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot = 'default',
327 $ip='', $size = 0, $newId = 0 )
328 {
329 if( !$ip ) {
330 $ip = wfGetIP();
331 if( !$ip ) $ip = '';
332 }
333 if ( $bot === 'default' ) {
334 $bot = $user->isAllowed( 'bot' );
335 }
336
337 $rc = new RecentChange;
338 $rc->mAttribs = array(
339 'rc_timestamp' => $timestamp,
340 'rc_cur_time' => $timestamp,
341 'rc_namespace' => $title->getNamespace(),
342 'rc_title' => $title->getDBkey(),
343 'rc_type' => RC_NEW,
344 'rc_minor' => $minor ? 1 : 0,
345 'rc_cur_id' => $title->getArticleID(),
346 'rc_user' => $user->getID(),
347 'rc_user_text' => $user->getName(),
348 'rc_comment' => $comment,
349 'rc_this_oldid' => $newId,
350 'rc_last_oldid' => 0,
351 'rc_bot' => $bot ? 1 : 0,
352 'rc_moved_to_ns' => 0,
353 'rc_moved_to_title' => '',
354 'rc_ip' => $ip,
355 'rc_patrolled' => 0,
356 'rc_new' => 1, # obsolete
357 'rc_old_len' => 0,
358 'rc_new_len' => $size,
359 'rc_deleted' => 0,
360 'rc_logid' => 0,
361 'rc_log_type' => null,
362 'rc_log_action' => '',
363 'rc_params' => ''
364 );
365
366 $rc->mExtra = array(
367 'prefixedDBkey' => $title->getPrefixedDBkey(),
368 'lastTimestamp' => 0,
369 'oldSize' => 0,
370 'newSize' => $size
371 );
372 $rc->save();
373 return( $rc->mAttribs['rc_id'] );
374 }
375
376 # Makes an entry in the database corresponding to a rename
377 public static function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false )
378 {
379 if( !$ip ) {
380 $ip = wfGetIP();
381 if( !$ip ) $ip = '';
382 }
383
384 $rc = new RecentChange;
385 $rc->mAttribs = array(
386 'rc_timestamp' => $timestamp,
387 'rc_cur_time' => $timestamp,
388 'rc_namespace' => $oldTitle->getNamespace(),
389 'rc_title' => $oldTitle->getDBkey(),
390 'rc_type' => $overRedir ? RC_MOVE_OVER_REDIRECT : RC_MOVE,
391 'rc_minor' => 0,
392 'rc_cur_id' => $oldTitle->getArticleID(),
393 'rc_user' => $user->getID(),
394 'rc_user_text' => $user->getName(),
395 'rc_comment' => $comment,
396 'rc_this_oldid' => 0,
397 'rc_last_oldid' => 0,
398 'rc_bot' => $user->isAllowed( 'bot' ) ? 1 : 0,
399 'rc_moved_to_ns' => $newTitle->getNamespace(),
400 'rc_moved_to_title' => $newTitle->getDBkey(),
401 'rc_ip' => $ip,
402 'rc_new' => 0, # obsolete
403 'rc_patrolled' => 1,
404 'rc_old_len' => NULL,
405 'rc_new_len' => NULL,
406 'rc_deleted' => 0,
407 'rc_logid' => 0, # notifyMove not used anymore
408 'rc_log_type' => null,
409 'rc_log_action' => '',
410 'rc_params' => ''
411 );
412
413 $rc->mExtra = array(
414 'prefixedDBkey' => $oldTitle->getPrefixedDBkey(),
415 'lastTimestamp' => 0,
416 'prefixedMoveTo' => $newTitle->getPrefixedDBkey()
417 );
418 $rc->save();
419 }
420
421 public static function notifyMoveToNew( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='' ) {
422 RecentChange::notifyMove( $timestamp, $oldTitle, $newTitle, $user, $comment, $ip, false );
423 }
424
425 public static function notifyMoveOverRedirect( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='' ) {
426 RecentChange::notifyMove( $timestamp, $oldTitle, $newTitle, $user, $comment, $ip, true );
427 }
428
429 # A log entry is different to an edit in that previous revisions are not kept
430 public static function notifyLog( $timestamp, &$title, &$user, $comment, $ip='',
431 $type, $action, $target, $logComment, $params, $newId=0 )
432 {
433 if( !$ip ) {
434 $ip = wfGetIP();
435 if( !$ip ) $ip = '';
436 }
437
438 $rc = new RecentChange;
439 $rc->mAttribs = array(
440 'rc_timestamp' => $timestamp,
441 'rc_cur_time' => $timestamp,
442 'rc_namespace' => $target->getNamespace(),
443 'rc_title' => $target->getDBkey(),
444 'rc_type' => RC_LOG,
445 'rc_minor' => 0,
446 'rc_cur_id' => $target->getArticleID(),
447 'rc_user' => $user->getID(),
448 'rc_user_text' => $user->getName(),
449 'rc_comment' => $logComment,
450 'rc_this_oldid' => 0,
451 'rc_last_oldid' => 0,
452 'rc_bot' => $user->isAllowed( 'bot' ) ? 1 : 0,
453 'rc_moved_to_ns' => 0,
454 'rc_moved_to_title' => '',
455 'rc_ip' => $ip,
456 'rc_patrolled' => 1,
457 'rc_new' => 0, # obsolete
458 'rc_old_len' => NULL,
459 'rc_new_len' => NULL,
460 'rc_deleted' => 0,
461 'rc_logid' => $newId,
462 'rc_log_type' => $type,
463 'rc_log_action' => $action,
464 'rc_params' => $params
465 );
466 $rc->mExtra = array(
467 'prefixedDBkey' => $title->getPrefixedDBkey(),
468 'lastTimestamp' => 0,
469 'logType' => $type,
470 'logAction' => $action,
471 'logComment' => $logComment,
472 'logTarget' => $target,
473 'logParams' => $params
474 );
475 $rc->save();
476 }
477
478 # Initialises the members of this object from a mysql row object
479 function loadFromRow( $row )
480 {
481 $this->mAttribs = get_object_vars( $row );
482 $this->mAttribs["rc_timestamp"] = wfTimestamp(TS_MW, $this->mAttribs["rc_timestamp"]);
483 $this->mExtra = array();
484 }
485
486 # Makes a pseudo-RC entry from a cur row
487 function loadFromCurRow( $row )
488 {
489 $this->mAttribs = array(
490 'rc_timestamp' => wfTimestamp(TS_MW, $row->rev_timestamp),
491 'rc_cur_time' => $row->rev_timestamp,
492 'rc_user' => $row->rev_user,
493 'rc_user_text' => $row->rev_user_text,
494 'rc_namespace' => $row->page_namespace,
495 'rc_title' => $row->page_title,
496 'rc_comment' => $row->rev_comment,
497 'rc_minor' => $row->rev_minor_edit ? 1 : 0,
498 'rc_type' => $row->page_is_new ? RC_NEW : RC_EDIT,
499 'rc_cur_id' => $row->page_id,
500 'rc_this_oldid' => $row->rev_id,
501 'rc_last_oldid' => isset($row->rc_last_oldid) ? $row->rc_last_oldid : 0,
502 'rc_bot' => 0,
503 'rc_moved_to_ns' => 0,
504 'rc_moved_to_title' => '',
505 'rc_ip' => '',
506 'rc_id' => $row->rc_id,
507 'rc_patrolled' => $row->rc_patrolled,
508 'rc_new' => $row->page_is_new, # obsolete
509 'rc_old_len' => $row->rc_old_len,
510 'rc_new_len' => $row->rc_new_len,
511 'rc_deleted' => $row->rc_deleted,
512 'rc_logid' => $row->rc_logid,
513 'rc_log_type' => $row->rc_log_type,
514 'rc_log_action' => $row->rc_log_action,
515 'rc_params' => $row->rc_params
516 );
517
518 $this->mExtra = array();
519 }
520
521 /**
522 * Get an attribute value
523 *
524 * @param $name Attribute name
525 * @return mixed
526 */
527 public function getAttribute( $name ) {
528 return isset( $this->mAttribs[$name] ) ? $this->mAttribs[$name] : NULL;
529 }
530
531 /**
532 * Gets the end part of the diff URL associated with this object
533 * Blank if no diff link should be displayed
534 */
535 function diffLinkTrail( $forceCur )
536 {
537 if ( $this->mAttribs['rc_type'] == RC_EDIT ) {
538 $trail = "curid=" . (int)($this->mAttribs['rc_cur_id']) .
539 "&oldid=" . (int)($this->mAttribs['rc_last_oldid']);
540 if ( $forceCur ) {
541 $trail .= '&diff=0' ;
542 } else {
543 $trail .= '&diff=' . (int)($this->mAttribs['rc_this_oldid']);
544 }
545 } else {
546 $trail = '';
547 }
548 return $trail;
549 }
550
551 function cleanupForIRC( $text ) {
552 return str_replace(array("\n", "\r"), array("", ""), $text);
553 }
554
555 function getIRCLine() {
556 global $wgUseRCPatrol;
557
558 // FIXME: Would be good to replace these 2 extract() calls with something more explicit
559 // e.g. list ($rc_type, $rc_id) = array_values ($this->mAttribs); [or something like that]
560 extract($this->mAttribs);
561 extract($this->mExtra);
562
563 $titleObj =& $this->getTitle();
564 if ( $rc_type == RC_LOG ) {
565 $title = Namespace::getCanonicalName( $titleObj->getNamespace() ) . $titleObj->getText();
566 } else {
567 $title = $titleObj->getPrefixedText();
568 }
569 $title = $this->cleanupForIRC( $title );
570
571 $bad = array("\n", "\r");
572 $empty = array("", "");
573 $title = $titleObj->getPrefixedText();
574 $title = str_replace($bad, $empty, $title);
575
576 // FIXME: *HACK* these should be getFullURL(), hacked for SSL madness --brion 2005-12-26
577 if ( $rc_type == RC_LOG ) {
578 $url = '';
579 } elseif ( $rc_new && $wgUseRCPatrol ) {
580 $url = $titleObj->getInternalURL("rcid=$rc_id");
581 } else if ( $rc_new ) {
582 $url = $titleObj->getInternalURL();
583 } else if ( $wgUseRCPatrol ) {
584 $url = $titleObj->getInternalURL("diff=$rc_this_oldid&oldid=$rc_last_oldid&rcid=$rc_id");
585 } else {
586 $url = $titleObj->getInternalURL("diff=$rc_this_oldid&oldid=$rc_last_oldid");
587 }
588
589 if ( isset( $oldSize ) && isset( $newSize ) ) {
590 $szdiff = $newSize - $oldSize;
591 if ($szdiff < -500) {
592 $szdiff = "\002$szdiff\002";
593 } elseif ($szdiff >= 0) {
594 $szdiff = '+' . $szdiff ;
595 }
596 $szdiff = '(' . $szdiff . ')' ;
597 } else {
598 $szdiff = '';
599 }
600
601 $user = $this->cleanupForIRC( $rc_user_text );
602
603 if ( $rc_type == RC_LOG ) {
604 $logTargetText = $logTarget->getPrefixedText();
605 $comment = $this->cleanupForIRC( str_replace( $logTargetText, "\00302$logTargetText\00310", $rc_comment ) );
606 $flag = $logAction;
607 } else {
608 $comment = $this->cleanupForIRC( $rc_comment );
609 $flag = ($rc_minor ? "M" : "") . ($rc_new ? "N" : "");
610 }
611 # see http://www.irssi.org/documentation/formats for some colour codes. prefix is \003,
612 # no colour (\003) switches back to the term default
613 $fullString = "\00314[[\00307$title\00314]]\0034 $flag\00310 " .
614 "\00302$url\003 \0035*\003 \00303$user\003 \0035*\003 $szdiff \00310$comment\003\n";
615 return $fullString;
616 }
617
618 /**
619 * Returns the change size (HTML).
620 * The lengths can be given optionally.
621 */
622 function getCharacterDifference( $old = 0, $new = 0 ) {
623 global $wgRCChangedSizeThreshold, $wgLang;
624
625 if( $old === 0 ) {
626 $old = $this->mAttribs['rc_old_len'];
627 }
628 if( $new === 0 ) {
629 $new = $this->mAttribs['rc_new_len'];
630 }
631
632 if( $old === NULL || $new === NULL ) {
633 return '';
634 }
635
636 $szdiff = $new - $old;
637 $formatedSize = wfMsgExt( 'rc-change-size', array( 'parsemag', 'escape'),
638 $wgLang->formatNum($szdiff) );
639
640 if( $szdiff < $wgRCChangedSizeThreshold ) {
641 return '<strong class=\'mw-plusminus-neg\'>(' . $formatedSize . ')</strong>';
642 } elseif( $szdiff === 0 ) {
643 return '<span class=\'mw-plusminus-null\'>(' . $formatedSize . ')</span>';
644 } elseif( $szdiff > 0 ) {
645 return '<span class=\'mw-plusminus-pos\'>(+' . $formatedSize . ')</span>';
646 } else {
647 return '<span class=\'mw-plusminus-neg\'>(' . $formatedSize . ')</span>';
648 }
649 }
650 }
651