1.20.x installer.browser.inc | _installer_browser_execute_query($server, $filters, $ipp) |
Helper function to execute queries for projects. Connects once to get the total count of projects, and then a second time to get all the projects in a repository.
Parameters
array $server: An array describing the server.
array $filters: An array of filters for the query.
int $ipp: The number of items to retrieve.
Return value
An array of projects on the server or NULL on error.:
File
- modules/
installer/ installer.browser.inc, line 290 - Various functions that are required by the Installer browse pages.
Code
function _installer_browser_execute_query($server, $filters, $ipp) {
$filters = array_merge($filters, array('items_per_page' => $ipp));
$query_url = $server['url'] . '/query/' . $filters['type'] . '/1?' . http_build_query($filters, FALSE, '&');
$response = backdrop_http_request($query_url);
if ($response->code == '200') {
return backdrop_json_decode($response->data);
}
else {
watchdog('installer', t("Encountered an error when trying to fetch results from @name. Error @code : @message",
array('@name' => $server['name'], '@code' => $response->code, '@message' => $response->error)), WATCHDOG_WARNING);
return NULL;
}
}