What needs to be done to make this module compatible with Drupal 9? There is a drupal-check tool that can help uncover deprecation issues

Here's the output when I run drupal-check against 8.x-1.7 in my Drupal 8.8.5 project root:

$ drupal-check modules/imce/
 26/26 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ---------------------------------------------------------------------- 
  Line   src/Form/ImceProfileDeleteForm.php                                    
 ------ ---------------------------------------------------------------------- 
  40     Call to deprecated function drupal_set_message():                     
         in drupal:8.5.0 and is removed from drupal:9.0.0.                     
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
 ------ ---------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------- 
  Line   src/Form/ImceProfileForm.php                                                                                       
 ------ ------------------------------------------------------------------------------------------------------------------- 
  74     Call to deprecated function file_upload_max_size():                                                                
         in drupal:8.7.0 and is removed from drupal:9.0.0.                                                                  
         Use \Drupal\Component\Utility\Environment::getUploadMaxSize() instead.                                             
  135    Call to deprecated constant FILE_EXISTS_RENAME: Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use   
         \Drupal\Core\File\FileSystemInterface::EXISTS_RENAME.                                                              
  137    Call to deprecated constant FILE_EXISTS_RENAME: Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use   
         \Drupal\Core\File\FileSystemInterface::EXISTS_RENAME.                                                              
  138    Call to deprecated constant FILE_EXISTS_REPLACE: Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use  
         \Drupal\Core\File\FileSystemInterface::EXISTS_REPLACE.                                                             
  139    Call to deprecated constant FILE_EXISTS_ERROR: Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use    
         \Drupal\Core\File\FileSystemInterface::EXISTS_ERROR.                                                               
  242    Call to deprecated function drupal_set_message():                                                                  
         in drupal:8.5.0 and is removed from drupal:9.0.0.                                                                  
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.                                               
  245    Call to deprecated function drupal_set_message():                                                                  
         in drupal:8.5.0 and is removed from drupal:9.0.0.                                                                  
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.                                               
 ------ ------------------------------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   src/Form/ImceSettingsForm.php                                         
 ------ ---------------------------------------------------------------------- 
  80     Call to deprecated function drupal_set_message():                     
         in drupal:8.5.0 and is removed from drupal:9.0.0.                     
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
  101    Call to deprecated function file_default_scheme():                    
         in drupal:8.8.0 and is removed from drupal:9.0.0. Use                 
         \Drupal::config('system.file')->get('default_scheme') instead.        
  121    Call to deprecated function file_default_scheme():                    
         in drupal:8.8.0 and is removed from drupal:9.0.0. Use                 
         \Drupal::config('system.file')->get('default_scheme') instead.        
 ------ ---------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------ 
  Line   src/Imce.php                                                            
 ------ ------------------------------------------------------------------------ 
  42     Call to deprecated function file_default_scheme():                      
         in drupal:8.8.0 and is removed from drupal:9.0.0. Use                   
         \Drupal::config('system.file')->get('default_scheme') instead.          
  74     Call to deprecated function file_default_scheme():                      
         in drupal:8.8.0 and is removed from drupal:9.0.0. Use                   
         \Drupal::config('system.file')->get('default_scheme') instead.          
  91     Call to deprecated function file_upload_max_size():                     
         in drupal:8.7.0 and is removed from drupal:9.0.0.                       
         Use \Drupal\Component\Utility\Environment::getUploadMaxSize() instead.  
 ------ ------------------------------------------------------------------------ 

 ------ ---------------------------------------------------------------------- 
  Line   src/ImceFM.php                                                        
 ------ ---------------------------------------------------------------------- 
  471    Call to deprecated function drupal_get_messages():                    
         in drupal:8.5.0 and is removed from drupal:9.0.0.                     
         Use \Drupal\Core\Messenger\MessengerInterface::all() or               
         \Drupal\Core\Messenger\MessengerInterface::messagesByType() instead.  
 ------ ---------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   src/ImceFileField.php                                                 
 ------ ---------------------------------------------------------------------- 
  145    Call to deprecated function drupal_set_message():                     
         in drupal:8.5.0 and is removed from drupal:9.0.0.                     
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
 ------ ---------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------------------- 
  Line   src/Plugin/BUEditorPlugin/Imce.php                                               
 ------ --------------------------------------------------------------------------------- 
         Class Drupal\bueditor\BUEditorPluginBase not found and could not be autoloaded.  
  20     Class Drupal\bueditor\BUEditorPluginBase not found and could not be autoloaded.  
 ------ --------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   src/Plugin/ImcePlugin/Delete.php                                      
 ------ ---------------------------------------------------------------------- 
  88     Call to deprecated function drupal_set_message():                     
         in drupal:8.5.0 and is removed from drupal:9.0.0.                     
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
  96     Call to deprecated function file_unmanaged_delete():                  
         in drupal:8.7.0 and is removed from drupal:9.0.0.                     
         Use \Drupal\Core\File\FileSystemInterface::delete().                  
  109    Call to deprecated function drupal_set_message():                     
         in drupal:8.5.0 and is removed from drupal:9.0.0.                     
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
 ------ ---------------------------------------------------------------------- 

 ------ -------------------------------------------------------------- 
  Line   src/Plugin/ImcePlugin/Resize.php                              
 ------ -------------------------------------------------------------- 
  84     Call to deprecated function file_create_filename():           
         in drupal:8.7.0 and is removed from drupal:9.0.0.             
         Use \Drupal\Core\File\FileSystemInterface::createFilename().  
  102    Call to deprecated function file_unmanaged_delete():          
         in drupal:8.7.0 and is removed from drupal:9.0.0.             
         Use \Drupal\Core\File\FileSystemInterface::delete().          
 ------ -------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------ 
  Line   src/Plugin/ImcePlugin/Upload.php                                                                                  
 ------ ------------------------------------------------------------------------------------------------------------------ 
  51     Call to deprecated constant FILE_EXISTS_RENAME: Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use  
         \Drupal\Core\File\FileSystemInterface::EXISTS_RENAME.                                                             
 ------ ------------------------------------------------------------------------------------------------------------------ 

                                                                                                                        
 [ERROR] Found 24 errors

Comments

xeM8VfDh created an issue. See original summary.

darchuletajr’s picture

StatusFileSize
new1.5 KB

Hi I ran the upgrade-status tool which told me that in ImceHelpController.php there is a deprecated function: Call to deprecated function system_get_info(). Deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal::service('extension.list.$type')->getExtensionInfo() or \Drupal::service('extension.list.$type')->getAllInstalledInfo() instead.

I made a quick patch.

xem8vfdh’s picture

awesome, thanks for the quick response @darchuletajr. I was hoping to run the drupal-check tool to get a detailed report, but I am stuck with this bug. I'm not familiar with the upgrade-status tool you ran, is it comprehensive? In other words, do you think your patch covers all of our bases here?

I believe there is also a composer.json change that should be made to add the Drupal 9 support badge to the module's main page, as explained here: https://www.drupal.org/project/auto_entitylabel/issues/3111526

darchuletajr’s picture

StatusFileSize
new1.16 KB

Hi @xeM8VfDh
I used the upgrade_status tool here: https://www.drupal.org/project/upgrade_status
I am not 100% sure of the comprehensiveness but it is based on the drupal-check tool. I also was looking at this deprecation status tool from Acquia though I think it is a bit outdated: https://dev.acquia.com/drupal9/deprecation_status/errors?project=imce%201.7

In any case I made another patch to update the composer.json with the Drupal 9 check and I also updated the GPL license to validate with composer validate, related issue here: https://www.drupal.org/project/drupal/issues/2935137

darchuletajr’s picture

StatusFileSize
new86.11 KB

I'm trying to look into the comprehensiveness. There are two other warnings that come up that I'm not sure how to get rid of them or if I can.

salah1’s picture

StatusFileSize
new10.21 KB

Greetings,
I have just run drupal-check (both analysis + deprecation) and attached is the result.
There are only 2 deprecations coming up which are addressed by #4.
However, there are other warnings -see txt file

salah1’s picture

Hi @darchuletajr, about your question on#5 -those warnings also showed up on drupal-check report#6

Line   contrib-modules/imce-8-x-1/src/Plugin/BUEditorPlugin/Imce.php
 ------ ---------------------------------------------------------------------------------
         Class Drupal\bueditor\BUEditorPluginBase not found and could not be autoloaded.
  20     Class Drupal\bueditor\BUEditorPluginBase not found and could not be autoloaded.

I can't find that class either on imce/src so maybe an issue there with....or namespace...

thalles’s picture

The warnings in exist because IMCE allows integration with the bueditor module (another WYSIWYG)

xem8vfdh’s picture

you all are awesome, thanks for working on this!

thalles’s picture

Status: Active » Fixed

Thanks everyone!

thalles’s picture

Fixed on dev branch, but the composer shoul be updated in another issue!

xem8vfdh’s picture

Issue summary: View changes
xem8vfdh’s picture

xem8vfdh’s picture

Issue summary: View changes
xem8vfdh’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

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