Skip to content

Commit

Permalink
Return the total number of results.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Oct 7, 2013
1 parent 923c200 commit e85b4af
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions framework/Core/lib/Horde/Core/ActiveSync/Driver.php
Expand Up @@ -2656,7 +2656,8 @@ protected function _searchGal(array $query)
ob_start();
$return = array(
'rows' => array(),
'status' => Horde_ActiveSync_Request_Search::STORE_STATUS_SUCCESS
'status' => Horde_ActiveSync_Request_Search::STORE_STATUS_SUCCESS,
'total' => 0
);
try {
$results = $this->_connector->contacts_search(
Expand All @@ -2669,11 +2670,13 @@ protected function _searchGal(array $query)
}

// Honor range, and don't bother if no results
$results = array_pop($results);
$count = count($results);
if (!$count) {
$this->_endBuffer();
return $return;
}
$return['total'] = $count;
$this->_logger->info(sprintf(
"[%s] Horde_Core_ActiveSync_Driver::_searchGal() found %d matches.",
$this->_pid,
Expand All @@ -2683,9 +2686,6 @@ protected function _searchGal(array $query)
preg_match('/(.*)\-(.*)/', $query['range'], $matches);
$return_count = $matches[2] - $matches[1];
$rows = array_slice($results, $matches[1], $return_count + 1, true);
$rows = array_pop($rows);
} else {
$rows = array_pop($results);
}

$picture_count = 0;
Expand Down

0 comments on commit e85b4af

Please sign in to comment.