You are here

function views_infinite_scroll_drush_autopager_download in Views Infinite Scroll 6

Same name and namespace in other branches
  1. 7 drush/views_infinite_scroll.drush.inc \views_infinite_scroll_drush_autopager_download()

Example drush command callback.

This is where the action takes place.

In this function, all of Drupals API is (usually) available, including any functions you have added in your own modules/themes.

To print something to the terminal window, use drush_print().

1 string reference to 'views_infinite_scroll_drush_autopager_download'
views_infinite_scroll_drush_command in drush/views_infinite_scroll.drush.inc
Implementation of hook_drush_command().

File

drush/views_infinite_scroll.drush.inc, line 63
drush integration for views_infinite_scroll.

Code

function views_infinite_scroll_drush_autopager_download() {
  if (module_exists('libraries')) {
    $path = 'sites/all/libraries/autopager';

    // 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');
    }
  }
  else {
    $path = drupal_get_path('module', 'views_infinite_scroll') . '/js';
  }
  drush_op('chdir', $path);

  // Download the plugin.
  if (drush_shell_exec('wget http://jquery-autopager.googlecode.com/files/jquery.autopager-1.0.0.js')) {
    drush_log(dt('jquery.autopager-1.0.0.js has been downloaded to @path', array(
      '@path' => $path,
    )), 'success');
  }
  else {
    drush_log(dt('Drush was unable to download jquery.autopager-1.0.0.js to @path', array(
      '@path' => $path,
    )), 'error');
  }
}