Deprecated Code Report

Created on 30 September 2019, over 4 years ago
Updated 9 August 2023, 11 months ago
php drupal-check.phar modules/contrib/drupalchat/
 4/4 [â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“] 100%

 ------ ---------------------------------------------------- 
  Line   drupalchat.install                                  
 ------ ---------------------------------------------------- 
  16     Call to deprecated function drupal_set_message().   
  115    Call to deprecated function db_drop_index().        
  116    Call to deprecated function db_drop_index().        
  117    Call to deprecated function db_drop_primary_key().  
  118    Call to deprecated function db_change_field().      
  125    Call to deprecated function db_change_field().      
  132    Call to deprecated function db_index_exists().      
  133    Call to deprecated function db_add_index().         
  135    Call to deprecated function db_index_exists().      
  136    Call to deprecated function db_add_index().         
  138    Call to deprecated function db_index_exists().      
  139    Call to deprecated function db_add_index().         
  141    Call to deprecated function db_index_exists().      
  142    Call to deprecated function db_add_index().         
  147    Call to deprecated function db_field_exists().      
  148    Call to deprecated function db_add_field().         
 ------ ---------------------------------------------------- 

 ------ ------------------------------------------------- 
  Line   drupalchat.module                                
 ------ ------------------------------------------------- 
  149    Call to deprecated function user_load().         
  150    Call to deprecated function user_format_name().  
  167    Call to deprecated function db_update().         
  185    Call to deprecated function db_query().          
  205    Call to deprecated function db_update().         
  220    Call to deprecated function db_query().          
  376    Call to deprecated function db_delete().         
  379    Call to deprecated function db_delete().         
  385    Call to deprecated function db_delete().         
 ------ ------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------- 
  Line   src/Controller/drupalchatController.php                                            
 ------ ----------------------------------------------------------------------------------- 
  39     Call to deprecated method strtolower() of class Drupal\Component\Utility\Unicode.  
  47     Call to deprecated method strtolower() of class Drupal\Component\Utility\Unicode.  
  201    Call to deprecated function db_query().                                            
  207    Call to deprecated function db_query().                                            
  218    Call to deprecated function db_query().                                            
  221    Call to deprecated function db_query().                                            
  229    Call to deprecated method entityManager() of class Drupal.                         
  230    Call to deprecated function user_format_name().                                    
  239    Call to deprecated function db_query().                                            
  242    Call to deprecated method entityManager() of class Drupal.                         
  249    Call to deprecated method entityManager() of class Drupal.                         
  250    Call to deprecated function user_format_name().                                    
  259    Call to deprecated function db_query().                                            
  262    Call to deprecated method entityManager() of class Drupal.                         
  325    Call to deprecated function db_query().                                            
  357    Call to deprecated function db_query().                                            
  416    Call to deprecated method entityManager() of class Drupal.                         
  417    Call to deprecated function user_format_name().                                    
  419    Call to deprecated method entityManager() of class Drupal.                         
  425    Call to deprecated method entityManager() of class Drupal.                         
  468    Call to deprecated function drupal_render().                                       
  509    Call to deprecated function db_query().                                            
  612    Call to deprecated function db_select().                                           
  618    Call to deprecated function db_or().                                               
  619    Call to deprecated function db_and().                                              
  620    Call to deprecated function db_and().                                              
  629    Call to deprecated function format_date().                                         
  658    Call to deprecated function db_query().                                            
  661    Call to deprecated function db_query().                                            
  668    Call to deprecated function user_load().                                           
  669    Call to deprecated function user_format_name().                                    
  679    Call to deprecated function db_query().                                            
  683    Call to deprecated function user_load().                                           
  690    Call to deprecated function user_load().                                           
  691    Call to deprecated function user_format_name().                                    
  702    Call to deprecated function db_query().                                            
  706    Call to deprecated function user_load().                                           
  876    Call to deprecated function user_format_name().                                    
  1024   Call to deprecated method getUsername() of class Drupal\user\Entity\User.          
  1038   Call to deprecated method getUsername() of class Drupal\user\Entity\User.          
  1103   Call to deprecated method l() of class Drupal.                                     
  1144   Call to deprecated method strtolower() of class Drupal\Component\Utility\Unicode.  
  1146   Call to deprecated function db_select().                                           
  1150   Call to deprecated function db_like().                                             
 ------ ----------------------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------------- 
  Line   src/Form/drupalchatSettingsForm.php                                        
 ------ --------------------------------------------------------------------------- 
  53     Call to deprecated function drupal_set_message().                          
  116    Call to deprecated method l() of class Drupal.                             
  268    Call to deprecated method getUsername() of class Drupal\user\Entity\User.  
  309    Call to deprecated function db_query().                                    
 ------ --------------------------------------------------------------------------- 

                                                                                                                        
 [ERROR] Found 73 errors 
📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇲🇩Moldova Sergiu Stici

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The patch could apply, but its changes are not correct.

    +  \Drupal::database()->schema()->changeField('drupalchat_msg', 'uid1', 'uid1',
         array(
             'description' => 'Uid of the sender.',
             'type' => 'varchar',
             'length' => 32,
             'not null' => TRUE,
         ));

    Since that code is changed, the indentation of the array lines must be corrected too.

    -  if (!db_index_exists('drupalchat_msg','uid1')) {
    -    db_add_index('drupalchat_msg','uid1',array('uid1'));
    +  if (!\Drupal::database()->schema()->indexExists('drupalchat_msg','uid1')) {
    +    \Drupal::database()->schema()->indexExists('drupalchat_msg','uid1',array('uid1'));
       }

    The existing code is adding an index if it does not exist. The changed code is checking twice if the index exist.
    Also, per Drupal coding standards, there must be a space after the commas between function/method arguments.

    -  if (!db_index_exists('drupalchat_msg','uid2')) {
    -    db_add_index('drupalchat_msg','uid2',array('uid2'));
    +  if (!\Drupal::database()->schema()->indexExists('drupalchat_msg','uid2')) {
    +    \Drupal::database()->schema()->addIndex('drupalchat_msg','uid2',array('uid2'));
       }
    -  if (!db_index_exists('drupalchat_users','uid')) {
    -    db_add_index('drupalchat_users','uid',array('uid'));
    +  if (!\Drupal::database()->schema()->indexExists('drupalchat_users','uid')) {
    +    \Drupal::database()->schema()->addIndex('drupalchat_users','uid',array('uid'));
       }
    -  if (!db_index_exists('drupalchat_users','session')) {
    -    db_add_index('drupalchat_users','session',array('session'));
    +  if (!\Drupal::database()->schema()->indexExists('drupalchat_users','session')) {
    +    \Drupal::database()->schema()->addIndex('drupalchat_users','session',array('session'));

    There are missing spaces after commas.

    +  if(!\Drupal::database()->schema()->fieldExists('drupalchat_msg', 'message_id')) {
    +    \Drupal::database()->schema()->addField('drupalchat_msg', 'message_id', array(
             'type' => 'varchar',
             'length' => 50,
             'not null' => TRUE,

    Since that code is changed, the last lines must be correctly indented too.

    -  			$attachments['#attached']['library'][] = 'drupalchat/drupalchat-popup';	
    +  			$attachments['#attached']['library'][] = 'drupalchat/drupalchat-popup';
       		}else if($drupalchat_path_visibility == 1 && !(\Drupal::service('router.admin_context')->isAdminRoute())){
    -  			$attachments['#attached']['library'][] = 'drupalchat/drupalchat-popup';	
    +  			$attachments['#attached']['library'][] = 'drupalchat/drupalchat-popup';

    Since the purpose of this issue removing calls to functions that have been removed, those changes are off-topic. If the lines that call deprecated functions are also correctly formatted, that is correct, but it is not correct to re-format all the existing lines, or this issue would become Fix the warnings/errors reported by PHP_CodeSniffer, for which there is already an open issue.

  • Status changed to Needs review 11 months ago
  • 🇮🇳India sidharth_soman Bangalore

    Made changes according to #7.

    Please review.

Production build 0.69.0 2024