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