function hacked_download_release in Hacked! 5
Same name and namespace in other branches
- 6 hacked.module \hacked_download_release()
3 calls to hacked_download_release()
- drush_hacked_diff in ./hacked.drush.inc
- Drush command callback that shows the list of changes/unchanged files in a project.
- hacked_hash_project in ./hacked.module
- hacked_reports_hacked_diff in ./hacked.diff.inc
File
- ./hacked.module, line 348
- The Hacked! module, shows which project have been changed since download.
Code
function hacked_download_release($release_url, $type, $short_name, $version) {
$dir = hacked_release_form_path_name($type, $short_name, $version);
if (file_exists($dir)) {
return $dir;
}
$request = drupal_http_request($release_url);
if ($request->code == 200) {
if (!file_check_directory($dir, FILE_CREATE_DIRECTORY) && !mkdir($dir, 0775, TRUE)) {
watchdog('hacked', 'Failed to create temp directory: %dir', array(
'%dir' => $dir,
), WATCHDOG_ERROR);
return FALSE;
}
$project_path = file_create_path($dir . '/' . basename($release_url));
file_save_data($request->data, $project_path);
shell_exec("cd {$dir}; tar -zxf " . basename($project_path));
file_delete($project_path);
return $dir;
}
return FALSE;
}