function quickupdate_get_project in Quick update 7
Same name and namespace in other branches
- 8 quickupdate.module \quickupdate_get_project()
Gets a project's information.
Parameters
string $project_name: The short name of the project to download.
Return value
array An array that contains the project's short name, title, download link, project type, and version.
1 call to quickupdate_get_project()
- quickupdate_manager_batch_project_get in ./
quickupdate.module - Batch callback: Downloads, unpacks, and verifies a project.
File
- ./
quickupdate.module, line 492 - Primarily Drupal hooks and global API functions.
Code
function quickupdate_get_project($project_name = '') {
module_load_include('inc', 'update', 'update.fetch');
$xml = drupal_http_request(UPDATE_DEFAULT_URL . '/' . $project_name . '/' . DRUPAL_CORE_COMPATIBILITY);
$array = array();
if (!isset($xml->error) && isset($xml->data) && !empty($xml->data)) {
$array = update_parse_xml($xml->data);
}
if (count($array) > 0 && isset($array['releases'])) {
$downloaded_major = isset($array['recommended_major']) ? $array['recommended_major'] : $array['default_major'];
foreach ($array['releases'] as $item) {
if ($item['status'] == 'published' && $item['version_major'] == $downloaded_major) {
$return = array();
$return['title'] = check_plain($array['title']);
$return['short_name'] = $array['short_name'];
$return['download_link'] = $item['download_link'];
$return['version'] = $item['version'];
return $return;
}
}
}
return array();
}