r47544 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47543‎ | r47544 | r47545 >
Date:13:00, 20 February 2009
Author:ialex
Status:ok
Tags:
Comment:
* Add some profiling
* Set the title for the revision created in ChangesList::insertRollback() so that it doesn't need an extra query to fecth it
Modified paths:
  • /trunk/phase3/includes/ChangesList.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ChangesList.php
@@ -334,9 +334,10 @@
335335 'user' => $rc->mAttribs['rc_user'],
336336 'user_text' => $rc->mAttribs['rc_user_text']
337337 ) );
 338+ $rev->setTitle( $page );
338339 $s .= ' '.$this->skin->generateRollback( $rev );
339340 }
340 - }
 341+ }
341342 }
342343
343344 protected function insertTags( &$s, &$rc, &$classes ) {
@@ -467,8 +468,9 @@
468469 * Format a line for enhanced recentchange (aka with javascript and block of lines).
469470 */
470471 public function recentChangesLine( &$baseRC, $watched = false ) {
471 -
472472 global $wgLang, $wgContLang, $wgUser;
 473+
 474+ wfProfileIn( __METHOD__ );
473475
474476 # Create a specialised object
475477 $rc = RCCacheEntry::newFromParent( $baseRC );
@@ -608,6 +610,9 @@
609611
610612 array_push( $this->rc_cache[$secureName], $rc );
611613 }
 614+
 615+ wfProfileOut( __METHOD__ );
 616+
612617 return $ret;
613618 }
614619
@@ -616,6 +621,9 @@
617622 */
618623 protected function recentChangesBlockGroup( $block ) {
619624 global $wgLang, $wgContLang, $wgRCShowChangedSize;
 625+
 626+ wfProfileIn( __METHOD__ );
 627+
620628 $r = '<table cellpadding="0" cellspacing="0" border="0" style="background: none"><tr>';
621629
622630 # Collate list of users
@@ -836,6 +844,9 @@
837845 $r .= "</table></div>\n";
838846
839847 $this->rcCacheIndex++;
 848+
 849+ wfProfileOut( __METHOD__ );
 850+
840851 return $r;
841852 }
842853
@@ -896,6 +907,9 @@
897908 */
898909 protected function recentChangesBlockLine( $rcObj ) {
899910 global $wgContLang, $wgRCShowChangedSize;
 911+
 912+ wfProfileIn( __METHOD__ );
 913+
900914 # Extract fields from DB into the function scope (rc_xxxx variables)
901915 // FIXME: Would be good to replace this extract() call with something
902916 // that explicitly initializes variables.
@@ -950,6 +964,9 @@
951965 $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
952966
953967 $r .= "</td></tr></table>\n";
 968+
 969+ wfProfileOut( __METHOD__ );
 970+
954971 return $r;
955972 }
956973
@@ -961,6 +978,9 @@
962979 if( count ( $this->rc_cache ) == 0 ) {
963980 return '';
964981 }
 982+
 983+ wfProfileIn( __METHOD__ );
 984+
965985 $blockOut = '';
966986 foreach( $this->rc_cache as $block ) {
967987 if( count( $block ) < 2 ) {
@@ -969,6 +989,9 @@
970990 $blockOut .= $this->recentChangesBlockGroup( $block );
971991 }
972992 }
 993+
 994+ wfProfileOut( __METHOD__ );
 995+
973996 return '<div>'.$blockOut.'</div>';
974997 }
975998

Status & tagging log