jenkins-bot has submitted this change and it was merged.

Change subject: Add Profiling to Special:UserProfile
......................................................................


Add Profiling to Special:UserProfile

Change-Id: I970033c4538b504b02fdb437a10ec0dfa38e6341
---
M includes/specials/SpecialUserProfile.php
1 file changed, 17 insertions(+), 2 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialUserProfile.php 
b/includes/specials/SpecialUserProfile.php
index c461745..ffa9406 100644
--- a/includes/specials/SpecialUserProfile.php
+++ b/includes/specials/SpecialUserProfile.php
@@ -32,6 +32,7 @@
         * @return Integer the amount of edits
         */
        protected function countRecentEdits( $user, $fromDate ) {
+               wfProfileIn( __METHOD__ );
                $dbr = wfGetDB( DB_SLAVE );
                $where = array(
                        'rc_user_text' => $user->getName(),
@@ -41,7 +42,9 @@
                        'limit' => self::LIMIT + 1,
                );
                $res = $dbr->select( 'recentchanges', 'rc_timestamp', $where, 
__METHOD__, $constraints );
-               return $res->numRows();
+               $res = $res->numRows();
+               wfProfileOut( __METHOD__ );
+               return $res;
        }
 
        /**
@@ -54,6 +57,7 @@
        protected function countRecentUploads( $user, $fromDate ) {
                global $wgMFPhotoUploadWiki, $wgConf;
 
+               wfProfileIn( __METHOD__ );
                if ( !$wgMFPhotoUploadWiki ) {
                        $dbr = wfGetDB( DB_SLAVE );
                } elseif (
@@ -61,6 +65,7 @@
                                !in_array( $wgMFPhotoUploadWiki, 
$wgConf->getLocalDatabases() )
                        ) {
                        // early return if the database is invalid
+                       wfProfileOut( __METHOD__ );
                        return false;
                } else {
                        $dbr = wfGetDB( DB_SLAVE, array(), $wgMFPhotoUploadWiki 
);
@@ -72,7 +77,9 @@
                        'limit' => self::LIMIT + 1,
                );
                $res = $dbr->select( 'image', 'img_timestamp', $where, 
__METHOD__, $constraints );
-               return $res->numRows();
+               $res = $res->numRows();
+               wfProfileOut( __METHOD__ );
+               return $res;
        }
 
        /**
@@ -84,6 +91,7 @@
        protected function getLastUpload( $user ) {
                global $wgMFPhotoUploadWiki, $wgConf;
 
+               wfProfileIn( __METHOD__ );
                if ( !$wgMFPhotoUploadWiki ) {
                        $dbr = wfGetDB( DB_SLAVE );
                } elseif (
@@ -91,6 +99,7 @@
                                !in_array( $wgMFPhotoUploadWiki, 
$wgConf->getLocalDatabases() )
                        ) {
                        // early return if the database is invalid
+                       wfProfileOut( __METHOD__ );
                        return false;
                } else {
                        $dbr = wfGetDB( DB_SLAVE, array(), $wgMFPhotoUploadWiki 
);
@@ -114,8 +123,10 @@
                                Html::closeElement( 'div' ) .
                                Html::closeElement( 'a' ) .
                                Html::closeElement( 'div' );
+                       wfProfileOut( __METHOD__ );
                        return $img;
                }
+               wfProfileOut( __METHOD__ );
                return '';
        }
 
@@ -139,6 +150,7 @@
        }
 
        protected function getRecentActivityHtml( User $user ) {
+               wfProfileIn( __METHOD__ );
                // render
                $fromDate = time() - ( 3600 * 24 * 30 );
                $count = $this->countRecentEdits( $user, $fromDate );
@@ -161,6 +173,7 @@
 
                $html = Html::element( 'h2', array(), $this->msg( 
'mobile-frontend-profile-heading-recent' ) ) .
                        $this->getListHtml( 'ul', array( 'class' => 
'statements' ), $statsRecent );
+               wfProfileOut( __METHOD__ );
 
                return $html;
        }
@@ -202,6 +215,7 @@
        }
 
        public function execute( $par = '' ) {
+               wfProfileIn( __METHOD__ );
                $out = $this->getOutput();
                $this->addModules();
                $out->setPageTitle( $this->msg( 'mobile-frontend-profile-title' 
) );
@@ -221,6 +235,7 @@
                } else {
                        $html = $this->getHtmlNoArg();
                }
+               wfProfileOut( __METHOD__ );
                $out->addHtml( $html );
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/86720
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I970033c4538b504b02fdb437a10ec0dfa38e6341
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to