http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88402

Revision: 88402
Author:   bawolff
Date:     2011-05-19 05:53:52 +0000 (Thu, 19 May 2011)
Log Message:
-----------
It was suggested I add some wfProfileIn/wfProfileOut to gnsm.

Modified Paths:
--------------
    trunk/extensions/GoogleNewsSitemap/FeedSMItem.php
    trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php
    trunk/extensions/GoogleNewsSitemap/SitemapFeed.php

Modified: trunk/extensions/GoogleNewsSitemap/FeedSMItem.php
===================================================================
--- trunk/extensions/GoogleNewsSitemap/FeedSMItem.php   2011-05-19 02:55:11 UTC 
(rev 88401)
+++ trunk/extensions/GoogleNewsSitemap/FeedSMItem.php   2011-05-19 05:53:52 UTC 
(rev 88402)
@@ -89,6 +89,7 @@
         * @return String
         */
        public function getDescription() {
+               wfProfileIn( __METHOD__ );
                // This is probably rather inefficient to do for several pages
                // but not much worse than the rest of this extension.
                $req = new FauxRequest( array(
@@ -99,13 +100,14 @@
                $main = new ApiMain( $req );
                $main->execute();
                $data = $main->getResultData();
+               $result = '';
                if ( isset( $data['parse']['text']['*'] ) ) {
-                       return $this->xmlEncode(
+                       $result = $this->xmlEncode(
                                $data['parse']['text']['*']
                        );
-               } else {
-                       return '';
                }
+               wfProfileOut( __METHOD__ );
+               return $result;
        }
 }
 

Modified: trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php
===================================================================
--- trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php       
2011-05-19 02:55:11 UTC (rev 88401)
+++ trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php       
2011-05-19 05:53:52 UTC (rev 88402)
@@ -86,6 +86,7 @@
                        echo $cached;
                        echo "<!-- From cache: $cacheKey -->";
                } else {
+                       wfProfileIn( __METHOD__ . '-not-cached' );
                        $res = $this->getCategories( $params, $categories, 
$notCategories );
                        ob_start();
                        $this->makeFeed( $feed, $res );
@@ -96,6 +97,7 @@
                                array( $cacheInvalidationInfo, $output ),
                                $this->maxCacheTime
                        );
+                       wfProfileOut( __METHOD__ . '-not-cached' );
                }
 
        }
@@ -195,6 +197,7 @@
         * @return String All the above info concatenated.
         */
        private function getCacheInvalidationInfo ( $params, $categories, 
$notCategories ) {
+               wfProfileIn( __METHOD__ );
                $dbr = wfGetDB( DB_SLAVE );
                $cacheInfo = '';
                $categoriesKey = array();
@@ -253,6 +256,7 @@
                        $cacheInfo .= $ts . '!';
                }
 
+               wfProfileOut( __METHOD__ );
                return $cacheInfo;
        }
        /**
@@ -497,6 +501,7 @@
         * @return Array of String: list of keywords
         */
        public function getKeywords ( $title ) {
+               wfProfileIn( __METHOD__ );
                $cats = $title->getParentCategories();
                $res = array();
 
@@ -537,6 +542,7 @@
                                }
                        }
                }
+               wfProfileOut( __METHOD__ );
                return $res;
        }
 }

Modified: trunk/extensions/GoogleNewsSitemap/SitemapFeed.php
===================================================================
--- trunk/extensions/GoogleNewsSitemap/SitemapFeed.php  2011-05-19 02:55:11 UTC 
(rev 88401)
+++ trunk/extensions/GoogleNewsSitemap/SitemapFeed.php  2011-05-19 05:53:52 UTC 
(rev 88402)
@@ -61,6 +61,8 @@
                if ( !( $item instanceof FeedItem ) ) {
                        throw new MWException( "Requires a FeedItem or 
subclass." );
                }
+
+               wfProfileIn( __METHOD__ );
                if ( !( $item instanceof FeedSMItem ) ) {
                        $item = FeedSMItem::newFromFeedItem( $item );
                }
@@ -103,6 +105,7 @@
                        $this->writer->endElement();
                }
                $this->writer->endElement(); // end url
+               wfProfileOut( __METHOD__ );
        }
 
        /**


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to