function drush_devel_download

A command callback for downloading a project.

File

./devel.drush.inc, line 87

Code

function drush_devel_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 = drupal_get_path('module', 'devel') . '/FirePHPCore';
    }
    // If FirePHP is not installed and libraries module is enabled,
    // try to find FirePHP by its own means.
    if (!is_dir($path)) {
        if (module_exists('libraries')) {
            // Libraries 1.x will return a path even if it doesn't exist
            // while 2.x will return FALSE.
            $path = libraries_get_path('FirePHPCore');
            if (!$path) {
                $path = 'sites/all/libraries/FirePHPCore';
            }
        }
    }
    if (is_dir($path)) {
        drush_log(dt('FirePHP already present at @path. No download required.', array(
            '@path' => $path,
        )), 'ok');
    }
    elseif (drush_shell_exec('svn export http://firephp.googlecode.com/svn/branches/Library-FirePHPCore-0.3 %s', $path)) {
        drush_log(dt('FirePHP has been exported via svn to @path.', array(
            '@path' => $path,
        )), 'success');
    }
    else {
        drush_log(dt('Drush was unable to export FirePHP to @path.', array(
            '@path' => $path,
        )), 'warning');
    }
}