You are here

function ckeditor_drush_download in CKEditor - WYSIWYG HTML editor 7

Same name and namespace in other branches
  1. 6 includes/ckeditor.drush.inc \ckeditor_drush_download()

Downloads.

1 call to ckeditor_drush_download()
drush_ckeditor_post_enable in includes/ckeditor.drush.inc
Implements drush_MODULE_post_COMMAND().
1 string reference to 'ckeditor_drush_download'
ckeditor_drush_command in includes/ckeditor.drush.inc
Implements hook_drush_command().

File

includes/ckeditor.drush.inc, line 44
CKEditor - The text editor for the Internet - http://ckeditor.com Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.

Code

function ckeditor_drush_download() {
  $args = func_get_args();
  $path = !empty($args[0]) ? $args[0] : drush_get_context('DRUSH_DRUPAL_ROOT') . '/sites/all/libraries/ckeditor';
  $zip_url = 'https://download.cksource.com/CKEditor/CKEditor/CKEditor%20' . CKEDITOR_LATEST . '/';
  $file_name = 'ckeditor_' . CKEDITOR_LATEST . '_full.zip';
  $file = drush_download_file($zip_url . $file_name, $file_name, 3600);
  if (empty($file)) {
    drush_log(dt('Drush was unable to download CKEditor !version to !path from the !url', array(
      '!version' => CKEDITOR_LATEST,
      '!path' => $path,
      '!url' => $zip_url . $file_name,
    )), 'error');
    return FALSE;
  }
  $tmp = drush_tempdir();
  if (!drush_tarball_extract($file, $tmp)) {
    drush_log(dt('CKEditor was not extracted to !path.', array(
      '!path' => $path,
    )), 'error');
    return FALSE;
  }
  drush_move_dir($tmp . '/ckeditor', $path, TRUE);
  drush_log(dt('CKEditor !version was downloaded to !path.', array(
    '!version' => CKEDITOR_LATEST,
    '!path' => $path,
  )), 'success');
  return TRUE;
}