You are here

function drush_mobile_number_libphonenumber_download in Mobile Number 7

A command callback.

File

./mobile_number.drush.inc, line 24
Drush integration for Mobile Number module.

Code

function drush_mobile_number_libphonenumber_download($path = NULL) {

  // If no path is provided by the user, set our default path.
  if (is_null($path)) {

    // We use devel folder for legacy reason.
    $path = 'sites/all/libraries/libphonenumber';
  }
  if (is_dir($path)) {
    drush_log(dt('libphonenumber already present at @path. No download required.', array(
      '@path' => $path,
    )), 'ok');
  }
  elseif (drush_shell_exec('wget https://github.com/giggsey/libphonenumber-for-php/archive/8.0.tar.gz && tar xvzf 8.0.tar.gz && rm 8.0.tar.gz && mv libphonenumber-for-php-8.0 %s', $path)) {
    drush_log(dt('libphonenumber has been downloaded via wget to @path.', array(
      '@path' => $path,
    )), 'success');
  }
  else {
    drush_log(dt('Drush was unable to export libphonenumber to @path.', array(
      '@path' => $path,
    )), 'warning');
  }
}