You are here

protected function CliCommandWrapper::downloadCKEditorFull in CKEditor Media Embed Plugin 8

1 call to CliCommandWrapper::downloadCKEditorFull()
CliCommandWrapper::overwritePluginFiles in src/Command/CliCommandWrapper.php
Overwrite the plugin files.

File

src/Command/CliCommandWrapper.php, line 148

Class

CliCommandWrapper
Class CLICommands.

Namespace

Drupal\ckeditor_media_embed\Command

Code

protected function downloadCKEditorFull(CKEditorCliCommandInterface $command) {
  $command
    ->comment(sprintf($command
    ->getMessage('comment-downloading-package'), $this->packageVersion));
  $package_name = AssetManager::getCKEditorDevFullPackageName($this->packageVersion);
  $package_url = AssetManager::getCKEditorDevFullPackageUrl($this->packageVersion);
  $package_directory = sys_get_temp_dir() . '/' . $package_name;
  $package_archive = sys_get_temp_dir() . "/{$package_name}.zip";
  try {
    $this
      ->downloadFile($package_url, $package_archive);
    if (is_file($package_archive)) {
      $archive = new Zip($package_archive);
      $archive
        ->extract(sys_get_temp_dir());
      $command
        ->getIo()
        ->success(sprintf($command
        ->getMessage('success-downloading-package'), $this->packageVersion));
    }
  } catch (\Exception $e) {
    $command
      ->getIo()
      ->error($e
      ->getMessage());
  }
  return $package_directory;
}