function drush_getlocations_markers in Get Locations 7
Same name and namespace in other branches
- 7.2 drush/getlocations.drush.inc \drush_getlocations_markers()
Command to download the basic Getlocations markers.
1 string reference to 'drush_getlocations_markers'
- getlocations_drush_command in drush/
getlocations.drush.inc - Implements hook_drush_command().
File
- drush/
getlocations.drush.inc, line 119 - getlocations.drush.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function drush_getlocations_markers() {
$args = func_get_args();
if (!empty($args[0])) {
$path = $args[0];
}
else {
$path = 'sites/all/libraries';
}
// Create the path if it does not exist.
if (!is_dir($path)) {
drush_op('mkdir', $path);
drush_log(dt('Directory @path was created', array(
'@path' => $path,
)), 'notice');
}
// Set the directory to the download location.
$olddir = getcwd();
chdir($path);
$zip = GETLOCATIONS_MARKERS_DOWNLOAD_URI;
$dirname = 'getlocations';
// Getlocations markers directory exists, bailing out
if (is_dir($dirname)) {
drush_log(dt('An existing Getlocations markerset was found in @path, not continuing.', array(
'@path' => $path,
)), 'notice');
return;
}
// Download the zip archive
if ($filepath = drush_download_file($zip)) {
$filename = basename($filepath);
// Decompress the zip archive
drush_tarball_extract($filename);
}
if (is_dir($dirname)) {
drush_log(dt('Getlocations markers have been installed in @path', array(
'@path' => $path,
)), 'success');
}
else {
drush_log(dt('Drush was unable to install the Getlocations markers to @path', array(
'@path' => $path,
)), 'error');
}
// Set working directory back to the previous working directory.
chdir($olddir);
}