Merge "API: Remove no-op wfProfile(In|Out) calls"

This commit is contained in:
jenkins-bot 2015-10-29 01:49:06 +00:00 committed by Gerrit Code Review
commit e174fdf91b

View file

@ -22,7 +22,6 @@ class ApiEchoNotifications extends ApiQueryBase {
if ( in_array( 'list', $prop ) ) {
// Group notification results by section
if ( $params['groupbysection'] ) {
wfProfileIn( __METHOD__ . '-group-by-section' );
foreach ( $params['sections'] as $section ) {
$result[$section] = $this->getSectionPropList(
$user, $section, $params['limit'],
@ -35,9 +34,7 @@ class ApiEchoNotifications extends ApiQueryBase {
$this->getResult()->setIndexedTagName( $result[$section]['index'], 'id' );
}
}
wfProfileOut( __METHOD__ . '-group-by-section' );
} else {
wfProfileIn( __METHOD__ . '-group-by-none' );
$attributeManager = EchoAttributeManager::newFromGlobalVars();
$result = $this->getPropList(
$user,
@ -50,17 +47,14 @@ class ApiEchoNotifications extends ApiQueryBase {
$result['index'] = $this->getPropIndex( $result['list'] );
$this->getResult()->setIndexedTagName( $result['index'], 'id' );
}
wfProfileOut( __METHOD__ . '-group-by-none' );
}
}
if ( in_array( 'count', $prop ) ) {
wfProfileIn( __METHOD__ . '-count' );
$result = array_merge_recursive(
$result,
$this->getPropcount( $user, $params['sections'], $params['groupbysection'] )
);
wfProfileOut( __METHOD__ . '-count' );
}
$this->getResult()->setIndexedTagName( $result, 'notification' );
@ -117,7 +111,6 @@ class ApiEchoNotifications extends ApiQueryBase {
// Prefer unread notifications. We don't care about next offset in this case
if ( $unreadFirst ) {
wfProfileIn( __METHOD__ . '-fetch-data-unread-first' );
$notifs = $notifMapper->fetchUnreadByUser( $user, $limit, $eventTypes );
// If there are less unread notifications than we requested,
// then fill the result with some read notifications
@ -136,21 +129,16 @@ class ApiEchoNotifications extends ApiQueryBase {
$notifs[$notif->getEvent()->getId()] = $notif;
}
}
wfProfileOut( __METHOD__ . '-fetch-data-unread-first' );
} else {
wfProfileIn( __METHOD__ . '-fetch-data' );
$notifs = $notifMapper->fetchByUser( $user, $limit + 1, $continue, $eventTypes );
wfProfileOut( __METHOD__ . '-fetch-data' );
}
wfProfileIn( __METHOD__ . '-formatting' );
foreach ( $notifs as $notif ) {
$output = EchoDataOutputFormatter::formatOutput( $notif, $format, $user, $this->getLanguage() );
if ( $output !== false ) {
$result['list'][$notif->getEvent()->getID()] = $output;
}
}
wfProfileOut( __METHOD__ . '-formatting' );
// Generate offset if necessary
if ( !$unreadFirst ) {