r88402 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88401‎ | r88402 | r88403 >
Date:05:53, 19 May 2011
Author:bawolff
Status:ok
Tags:
Comment:
It was suggested I add some wfProfileIn/wfProfileOut to gnsm.
Modified paths:
  • /trunk/extensions/GoogleNewsSitemap/FeedSMItem.php (modified) (history)
  • /trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php (modified) (history)
  • /trunk/extensions/GoogleNewsSitemap/SitemapFeed.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php
@@ -86,6 +86,7 @@
8787 echo $cached;
8888 echo "<!-- From cache: $cacheKey -->";
8989 } else {
 90+ wfProfileIn( __METHOD__ . '-not-cached' );
9091 $res = $this->getCategories( $params, $categories, $notCategories );
9192 ob_start();
9293 $this->makeFeed( $feed, $res );
@@ -96,6 +97,7 @@
9798 array( $cacheInvalidationInfo, $output ),
9899 $this->maxCacheTime
99100 );
 101+ wfProfileOut( __METHOD__ . '-not-cached' );
100102 }
101103
102104 }
@@ -195,6 +197,7 @@
196198 * @return String All the above info concatenated.
197199 */
198200 private function getCacheInvalidationInfo ( $params, $categories, $notCategories ) {
 201+ wfProfileIn( __METHOD__ );
199202 $dbr = wfGetDB( DB_SLAVE );
200203 $cacheInfo = '';
201204 $categoriesKey = array();
@@ -253,6 +256,7 @@
254257 $cacheInfo .= $ts . '!';
255258 }
256259
 260+ wfProfileOut( __METHOD__ );
257261 return $cacheInfo;
258262 }
259263 /**
@@ -497,6 +501,7 @@
498502 * @return Array of String: list of keywords
499503 */
500504 public function getKeywords ( $title ) {
 505+ wfProfileIn( __METHOD__ );
501506 $cats = $title->getParentCategories();
502507 $res = array();
503508
@@ -537,6 +542,7 @@
538543 }
539544 }
540545 }
 546+ wfProfileOut( __METHOD__ );
541547 return $res;
542548 }
543549 }
Index: trunk/extensions/GoogleNewsSitemap/FeedSMItem.php
@@ -89,6 +89,7 @@
9090 * @return String
9191 */
9292 public function getDescription() {
 93+ wfProfileIn( __METHOD__ );
9394 // This is probably rather inefficient to do for several pages
9495 // but not much worse than the rest of this extension.
9596 $req = new FauxRequest( array(
@@ -99,13 +100,14 @@
100101 $main = new ApiMain( $req );
101102 $main->execute();
102103 $data = $main->getResultData();
 104+ $result = '';
103105 if ( isset( $data['parse']['text']['*'] ) ) {
104 - return $this->xmlEncode(
 106+ $result = $this->xmlEncode(
105107 $data['parse']['text']['*']
106108 );
107 - } else {
108 - return '';
109109 }
 110+ wfProfileOut( __METHOD__ );
 111+ return $result;
110112 }
111113 }
112114
Index: trunk/extensions/GoogleNewsSitemap/SitemapFeed.php
@@ -61,6 +61,8 @@
6262 if ( !( $item instanceof FeedItem ) ) {
6363 throw new MWException( "Requires a FeedItem or subclass." );
6464 }
 65+
 66+ wfProfileIn( __METHOD__ );
6567 if ( !( $item instanceof FeedSMItem ) ) {
6668 $item = FeedSMItem::newFromFeedItem( $item );
6769 }
@@ -103,6 +105,7 @@
104106 $this->writer->endElement();
105107 }
106108 $this->writer->endElement(); // end url
 109+ wfProfileOut( __METHOD__ );
107110 }
108111
109112 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r88640MFT r88402: profilingdemon14:29, 23 May 2011

Status & tagging log