'ckeditor_drush_download',
'description' => dt('Downloads the required CKEditor library from svn.ckeditor.com.'),
'arguments' => array(
'path' => dt('Optional. The path to the download folder. If omitted, Drush will use the default location (sites/all/libraries/ckeditor
).'),
),
);
return $items;
}
/**
* Downloads
*/
function ckeditor_drush_download() {
$args = func_get_args();
if ($args[0]) {
$path = $args[0];
}
else {
$path = drush_get_context('DRUSH_DRUPAL_ROOT') . '/sites/all/libraries/ckeditor';
}
$svn_cmd = 'svn checkout http://svn.ckeditor.com/CKEditor/releases/stable/ ' . $path;
if (drush_shell_exec($svn_cmd)) {
drush_log(dt('CKEditor was downloaded to !path.', array('!path' => '' . $path . '
')), 'success');
}
else {
drush_log(dt('Drush was unable to download CKEditor to !path.', array('!path' => '' . $path . '
')) . '
' . dt('Attempted command: !svn_cmd.', array('!svn_cmd' => '' . $svn_cmd . '
')), 'error');
}
}
/**
* Implements drush_MODULE_post_COMMAND().
*/
function drush_ckeditor_post_enable() {
$modules = func_get_args();
if (in_array('ckeditor', $modules) && !drush_get_option('skip')) {
ckeditor_drush_download();
}
}