mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-23 23:44:53 +00:00
Merge "API: Remove no-op wfProfile(In|Out) calls"
This commit is contained in:
commit
e174fdf91b
|
@ -22,7 +22,6 @@ class ApiEchoNotifications extends ApiQueryBase {
|
||||||
if ( in_array( 'list', $prop ) ) {
|
if ( in_array( 'list', $prop ) ) {
|
||||||
// Group notification results by section
|
// Group notification results by section
|
||||||
if ( $params['groupbysection'] ) {
|
if ( $params['groupbysection'] ) {
|
||||||
wfProfileIn( __METHOD__ . '-group-by-section' );
|
|
||||||
foreach ( $params['sections'] as $section ) {
|
foreach ( $params['sections'] as $section ) {
|
||||||
$result[$section] = $this->getSectionPropList(
|
$result[$section] = $this->getSectionPropList(
|
||||||
$user, $section, $params['limit'],
|
$user, $section, $params['limit'],
|
||||||
|
@ -35,9 +34,7 @@ class ApiEchoNotifications extends ApiQueryBase {
|
||||||
$this->getResult()->setIndexedTagName( $result[$section]['index'], 'id' );
|
$this->getResult()->setIndexedTagName( $result[$section]['index'], 'id' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wfProfileOut( __METHOD__ . '-group-by-section' );
|
|
||||||
} else {
|
} else {
|
||||||
wfProfileIn( __METHOD__ . '-group-by-none' );
|
|
||||||
$attributeManager = EchoAttributeManager::newFromGlobalVars();
|
$attributeManager = EchoAttributeManager::newFromGlobalVars();
|
||||||
$result = $this->getPropList(
|
$result = $this->getPropList(
|
||||||
$user,
|
$user,
|
||||||
|
@ -50,17 +47,14 @@ class ApiEchoNotifications extends ApiQueryBase {
|
||||||
$result['index'] = $this->getPropIndex( $result['list'] );
|
$result['index'] = $this->getPropIndex( $result['list'] );
|
||||||
$this->getResult()->setIndexedTagName( $result['index'], 'id' );
|
$this->getResult()->setIndexedTagName( $result['index'], 'id' );
|
||||||
}
|
}
|
||||||
wfProfileOut( __METHOD__ . '-group-by-none' );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( 'count', $prop ) ) {
|
if ( in_array( 'count', $prop ) ) {
|
||||||
wfProfileIn( __METHOD__ . '-count' );
|
|
||||||
$result = array_merge_recursive(
|
$result = array_merge_recursive(
|
||||||
$result,
|
$result,
|
||||||
$this->getPropcount( $user, $params['sections'], $params['groupbysection'] )
|
$this->getPropcount( $user, $params['sections'], $params['groupbysection'] )
|
||||||
);
|
);
|
||||||
wfProfileOut( __METHOD__ . '-count' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getResult()->setIndexedTagName( $result, 'notification' );
|
$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
|
// Prefer unread notifications. We don't care about next offset in this case
|
||||||
if ( $unreadFirst ) {
|
if ( $unreadFirst ) {
|
||||||
wfProfileIn( __METHOD__ . '-fetch-data-unread-first' );
|
|
||||||
$notifs = $notifMapper->fetchUnreadByUser( $user, $limit, $eventTypes );
|
$notifs = $notifMapper->fetchUnreadByUser( $user, $limit, $eventTypes );
|
||||||
// If there are less unread notifications than we requested,
|
// If there are less unread notifications than we requested,
|
||||||
// then fill the result with some read notifications
|
// then fill the result with some read notifications
|
||||||
|
@ -136,21 +129,16 @@ class ApiEchoNotifications extends ApiQueryBase {
|
||||||
$notifs[$notif->getEvent()->getId()] = $notif;
|
$notifs[$notif->getEvent()->getId()] = $notif;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wfProfileOut( __METHOD__ . '-fetch-data-unread-first' );
|
|
||||||
} else {
|
} else {
|
||||||
wfProfileIn( __METHOD__ . '-fetch-data' );
|
|
||||||
$notifs = $notifMapper->fetchByUser( $user, $limit + 1, $continue, $eventTypes );
|
$notifs = $notifMapper->fetchByUser( $user, $limit + 1, $continue, $eventTypes );
|
||||||
wfProfileOut( __METHOD__ . '-fetch-data' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wfProfileIn( __METHOD__ . '-formatting' );
|
|
||||||
foreach ( $notifs as $notif ) {
|
foreach ( $notifs as $notif ) {
|
||||||
$output = EchoDataOutputFormatter::formatOutput( $notif, $format, $user, $this->getLanguage() );
|
$output = EchoDataOutputFormatter::formatOutput( $notif, $format, $user, $this->getLanguage() );
|
||||||
if ( $output !== false ) {
|
if ( $output !== false ) {
|
||||||
$result['list'][$notif->getEvent()->getID()] = $output;
|
$result['list'][$notif->getEvent()->getID()] = $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wfProfileOut( __METHOD__ . '-formatting' );
|
|
||||||
|
|
||||||
// Generate offset if necessary
|
// Generate offset if necessary
|
||||||
if ( !$unreadFirst ) {
|
if ( !$unreadFirst ) {
|
||||||
|
|
Loading…
Reference in a new issue