php drupal-check.phar modules/contrib/easychart/
 15/15 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ --------------------------------------------------------- 
  Line   src/Form/OptionsForm.php                                 
 ------ --------------------------------------------------------- 
  97     Call to deprecated function file_unmanaged_save_data().  
  98     Call to deprecated function drupal_set_message().        
  101    Call to deprecated function drupal_set_message().        
 ------ --------------------------------------------------------- 

 ------ ------------------------------------------------------ 
  Line   src/Form/ResetOptionsConfirmForm.php                  
 ------ ------------------------------------------------------ 
  41     Call to deprecated function file_unmanaged_delete().  
  42     Call to deprecated function drupal_set_message().     
 ------ ------------------------------------------------------ 

 ------ --------------------------------------------------- 
  Line   src/Form/ResetPresetsConfirmForm.php               
 ------ --------------------------------------------------- 
  44     Call to deprecated function drupal_set_message().  
 ------ --------------------------------------------------- 

 ------ --------------------------------------------------- 
  Line   src/Form/ResetTemplatesConfirmForm.php             
 ------ --------------------------------------------------- 
  44     Call to deprecated function drupal_set_message().  
 ------ --------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------ 
  Line   src/Plugin/entity_embed/EntityEmbedDisplay/Easychart.php                                                    
 ------ ------------------------------------------------------------------------------------------------------------ 
         Class Drupal\entity_embed\EntityEmbedDisplay\EntityEmbedDisplayBase not found and could not be autoloaded.  
 ------ ------------------------------------------------------------------------------------------------------------ 

                                                                                                                        
 [ERROR] Found 8 errors  

Comments

Sergiu Stici created an issue. See original summary.

sergiu stici’s picture

Status: Active » Needs review
StatusFileSize
new4.73 KB

Here's the patch, please review.

sharif.elshobkshy’s picture

StatusFileSize
new5.86 KB

Updated previous (#2) patch to include additional Drupal 9 requirements.

niles38’s picture

Looks like the patch in #3 works according to Upgrade Status. Thanks!

There are still some deprecated drush functions that I was able to take care of here (/modules/contrib/easychart/drush/easychart.drush.inc):

<?php

/**
 * @file
 * Easychart drush functions.
 */

/**
 * Implements hook_drush_command().
 */
function easychart_drush_command() {
  $items = array();

  $items['easychart-dependencies'] = array(
    'aliases' => array('ec-dependencies'),
    'callback' => 'easychart_drush_dependencies',
    'description' => dt('Download and install the javascript dependencies for the Easychart module.'),
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
  );
  return $items;
}

/**
 * Implements hook_drush_help().
 */
function easychart_drush_help($section) {
  switch ($section) {
    case 'drush:easychart-plugin':
      return dt('Download and install the Highcharts javascript library and the Easychart plugin from github.com/daemth/easychart, location is in /libraries.');
  }
}

/**
 * Drush callback: download the easychart javascript dependencies.
 */
function easychart_drush_dependencies() {

  // Make sure easychart is enabled.
  if (!\Drupal::moduleHandler()->moduleExists("easychart")) {
    \Drupal::logger("easychart")->alert(dt("Please enable the Easychart module first."));
    return;
  }

  // Path variables.
  $libraries_path = 'libraries';

  // Store the old directory.
  $old_dir = getcwd();

  // Create the libraries folder if it does not exist.
  if (!is_dir($libraries_path)) {
    drush_op('mkdir', $libraries_path);
    \Drupal::logger("easychart")->notice(dt("Directory @path was created", array("@path" => $libraries_path)));
  }

  // Go to libraries path.
  chdir($libraries_path);

  // Install Easychart library.
  $easychart_dir_name = 'easychart';
  $easychart_library = \Drupal::service('library.discovery')->getLibraryByName('easychart', 'lib.easycharts.full');
  if (!empty($easychart_library) && $file_path = drush_download_file($easychart_library['remote'])) {
    $filename = basename($file_path);

    // Remove Easychart library directory.
    if (is_dir($easychart_dir_name)) {
      \Symfony\Component\Filesystem\Filesystem::remove($easychart_dir_name, TRUE);
      \Drupal::logger("easychart")->notice(dt("An existing Easychart plugin was deleted from @libraries_path.", array("@libraries_path" => $libraries_path)));
    }

    drush_tarball_extract($filename);
    drush_move_dir('easychart-master', $easychart_dir_name, TRUE);
  }
  if (is_dir($easychart_dir_name)) {
    \Drupal::logger("easychart")->notice(dt('Easychart library has been installed in /@libraries_path.', array('@libraries_path' => $libraries_path)));
  }
  else {
    \Drupal::logger("easychart")->error(dt('Drush was unable to install the Easychart library in /@libraries_path.', array('@libraries_path' => $libraries_path)));
  }

  // Install Highcharts library.
  $highcharts_dir_name = 'highcharts';
  $highcharts_library = \Drupal::service('library.discovery')->getLibraryByName('easychart', 'lib.highcharts');
  if (!empty($highcharts_library) && $file_path = drush_download_file($highcharts_library['remote'])) {
    $filename = basename($file_path);

    // Remove any existing Highcharts library directory.
    if (is_dir($highcharts_dir_name)) {
      \Symfony\Component\Filesystem\Filesystem::remove($highcharts_dir_name, TRUE);
      
      \Drupal::logger("easychart")->notice(dt('An existing Highcharts plugin was deleted from @libraries_path.', array('@libraries_path' => $libraries_path)));
    }

    drush_tarball_extract($filename, $highcharts_dir_name);
  }
  if (is_dir($highcharts_dir_name)) {
    \Drupal::logger("easychart")->notice(dt('Highcharts library has been installed in /@libraries_path.', array('@libraries_path' => $libraries_path)));
  }
  else {
    \Drupal::logger("easychart")->error(dt('Drush was unable to install the Highcharts library in /@libraries_path', array('@libraries_path' => $libraries_path)));
  }

  // Set working directory back to the previous working directory.
  chdir($old_dir);
}

I'm not sure how to handle the sortable deprecated library. Since that page never worked for us either (see https://www.drupal.org/project/easychart/issues/2979557 ) I'm not sure what we should do about that.

web-beest’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.