Problem/Motivation

drupal-check results on commit hash:
source : [git] https://git.drupal.org/project/file_entity bedef1b99cc0d4cafc3f3aa73e2c167e0851c993
source : http://cgit.drupalcode.org/file_entity


 

 ------ ------------------------------------------------------------------- 
  Line   file_entity.module                                                 
 ------ ------------------------------------------------------------------- 
  236    Call to deprecated method url() of class                           
         Drupal\Core\Entity\EntityInterface.                                
  296    Call to deprecated method entityManager() of class Drupal.         
  361    Calls to function fnmatch should not exist.                        
  361    Calls to function fnmatch should not exist.                        
  466    Call to deprecated function entity_load_multiple_by_properties().  
 ------ ------------------------------------------------------------------- 

 ------ ------------------------------------------------- 
  Line   file_entity.tokens.inc                           
 ------ ------------------------------------------------- 
  87     Call to deprecated method checkPlain() of class  
         Drupal\Component\Utility\SafeMarkup.             
  87     Call to method checkPlain() of deprecated class  
         Drupal\Component\Utility\SafeMarkup.             
  114    Call to deprecated method checkPlain() of class  
         Drupal\Component\Utility\SafeMarkup.             
  114    Call to method checkPlain() of deprecated class  
         Drupal\Component\Utility\SafeMarkup.             
  123    Call to deprecated function db_select().         
 ------ ------------------------------------------------- 

 ------ ---------------------------------------------------- 
  Line   src/Controller/FileController.php                   
 ------ ---------------------------------------------------- 
  63     Call to deprecated function drupal_basename().      
  97     Call to deprecated method entityManager() of class  
         Drupal\Core\Controller\ControllerBase.              
 ------ ---------------------------------------------------- 

 ------ ---------------------------------------------------- 
  Line   src/Entity/FileEntity.php                           
 ------ ---------------------------------------------------- 
  42     Call to deprecated function db_query().             
  203    Call to deprecated function db_delete().            
  207    Call to deprecated function db_insert().            
  300    Call to deprecated function db_delete().            
  397    Call to deprecated function file_uri_scheme().      
  410    Call to deprecated function file_uri_scheme().      
  434    Call to deprecated function file_uri_scheme().      
  518    Call to deprecated method entityManager() of class  
         Drupal\Core\Entity\Entity.                          
 ------ ---------------------------------------------------- 

 ------ ------------------------------------------------------------ 
  Line   src/Entity/FileEntityViewBuilder.php                        
 ------ ------------------------------------------------------------ 
  30     Call to deprecated method entityManager() of class Drupal.  
 ------ ------------------------------------------------------------ 

 ------ ------------------------------------------------ 
  Line   src/FileEntityAccessControlHandler.php          
 ------ ------------------------------------------------ 
  53     Call to deprecated function file_uri_scheme().  
 ------ ------------------------------------------------ 

 ------ ----------------------------------------------- 
  Line   src/FileTypeListBuilder.php                    
 ------ ----------------------------------------------- 
  35     Call to deprecated method getLabel() of class  
         Drupal\Core\Entity\EntityListBuilder.          
 ------ ----------------------------------------------- 

 ------ --------------------------------------------------- 
  Line   src/Form/FileAddArchiveForm.php                    
 ------ --------------------------------------------------- 
  97     Call to deprecated function drupal_unlink().       
  100    Call to deprecated function drupal_set_message().  
  102    Call to deprecated function drupal_set_message().  
 ------ --------------------------------------------------- 

 ------ ------------------------------------------------------------ 
  Line   src/Form/FileAddForm.php                                    
 ------ ------------------------------------------------------------ 
  92     Call to deprecated function drupal_render().                
  184    Call to deprecated method entityManager() of class Drupal.  
  204    Call to deprecated method checkPlain() of class             
         Drupal\Component\Utility\SafeMarkup.                        
  204    Call to method checkPlain() of deprecated class             
         Drupal\Component\Utility\SafeMarkup.                        
  336    Call to deprecated function file_uri_scheme().              
  391    Call to deprecated function file_uri_scheme().              
  410    Call to deprecated function drupal_set_message().           
 ------ ------------------------------------------------------------ 

 ------ ------------------------------------------------- 
  Line   src/Form/FileDeleteMultipleForm.php              
 ------ ------------------------------------------------- 
  110    Call to deprecated method checkPlain() of class  
         Drupal\Component\Utility\SafeMarkup.             
  110    Call to method checkPlain() of deprecated class  
         Drupal\Component\Utility\SafeMarkup.             
 ------ ------------------------------------------------- 

 ------ --------------------------------------------------- 
  Line   src/Form/FileEditForm.php                          
 ------ --------------------------------------------------- 
  68     Call to deprecated function drupal_render().       
  86     Call to deprecated function drupal_set_message().  
  89     Call to deprecated function drupal_set_message().  
  94     Call to deprecated method urlInfo() of class       
         Drupal\Core\Entity\EntityInterface.                
  99     Call to deprecated function drupal_set_message().  
 ------ --------------------------------------------------- 

 ------ --------------------------------------------------- 
  Line   src/Form/FileSettingsForm.php                      
 ------ --------------------------------------------------- 
  137    Call to deprecated function drupal_set_message().  
 ------ --------------------------------------------------- 

 ------ --------------------------------------------------- 
  Line   src/Form/FileTypeDisableForm.php                   
 ------ --------------------------------------------------- 
  39     Call to deprecated function drupal_set_message().  
 ------ --------------------------------------------------- 

 ------ --------------------------------------------------- 
  Line   src/Form/FileTypeEnableForm.php                    
 ------ --------------------------------------------------- 
  39     Call to deprecated function drupal_set_message().  
 ------ --------------------------------------------------- 

 ------ --------------------------------------------------- 
  Line   src/Form/FileTypeForm.php                          
 ------ --------------------------------------------------- 
  112    Call to deprecated function drupal_set_message().  
  115    Call to deprecated function drupal_set_message().  
 ------ --------------------------------------------------- 

 ------ ----------------------------------------------- 
  Line   src/Normalizer/FileEntityNormalizer.php        
 ------ ----------------------------------------------- 
  43     Call to deprecated function drupal_dirname().  
  49     Call to deprecated method format() of class    
         Drupal\Component\Utility\SafeMarkup.           
  49     Call to method format() of deprecated class    
         Drupal\Component\Utility\SafeMarkup.           
 ------ ----------------------------------------------- 

 ------ ------------------------------------------------------- 
  Line   src/Plugin/views/field/LinkDelete.php                  
 ------ ------------------------------------------------------- 
  34     Call to deprecated function drupal_get_destination().  
 ------ ------------------------------------------------------- 

 ------ ------------------------------------------------------- 
  Line   src/Plugin/views/field/LinkEdit.php                    
 ------ ------------------------------------------------------- 
  34     Call to deprecated function drupal_get_destination().  
 ------ ------------------------------------------------------- 

 ------ ---------------------------------------- 
  Line   src/Plugin/views/filter/SchemeType.php  
 ------ ---------------------------------------- 
  48     Call to deprecated function db_like().  
 ------ ---------------------------------------- 

 ------ -------------------------------------------------- 
  Line   src/Tests/FileEntityAccessTest.php                
 ------ -------------------------------------------------- 
  205    Call to deprecated method getUsername() of class  
         Drupal\user\Entity\User.                          
  217    Call to deprecated function format_string().      
  219    Call to deprecated function format_string().      
 ------ -------------------------------------------------- 

 ------ ------------------------------------------------------------ 
  Line   src/Tests/FileEntityAdminTest.php                           
 ------ ------------------------------------------------------------ 
  178    Call to deprecated method url() of class                    
         Drupalile_entity\Entity\FileEntity.                       
  180    Call to deprecated method url() of class                    
         Drupalile_entity\Entity\FileEntity.                       
  182    Call to deprecated method url() of class                    
         Drupalile_entity\Entity\FileEntity.                       
  186    Call to deprecated method url() of class                    
         Drupalile_entity\Entity\FileEntity.                       
  187    Call to deprecated method url() of class                    
         Drupalile_entity\Entity\FileEntity.                       
  188    Call to deprecated method url() of class                    
         Drupalile_entity\Entity\FileEntity.                       
  263    Call to deprecated method entityManager() of class Drupal.  
  277    Call to deprecated method entityManager() of class Drupal.  
  295    Call to deprecated method entityManager() of class Drupal.  
  346    Call to deprecated method entityManager() of class Drupal.  
  347    Call to deprecated method entityManager() of class Drupal.  
 ------ ------------------------------------------------------------ 

 ------ ------------------------------------------------------------------ 
  Line   src/Tests/FileEntityCacheTagsTest.php                             
 ------ ------------------------------------------------------------------ 
  20     Usage of deprecated trait                                         
         Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait in  
         class Drupalile_entity\Tests\FileEntityCacheTagsTest.           
  154    Call to deprecated method format() of class                       
         Drupal\Component\Utility\SafeMarkup.                              
  154    Call to method format() of deprecated class                       
         Drupal\Component\Utility\SafeMarkup.                              
 ------ ------------------------------------------------------------------ 

 ------ ------------------------------------------------ 
  Line   src/Tests/FileEntityCreationTest.php            
 ------ ------------------------------------------------ 
  49     Call to deprecated function drupal_realpath().  
  71     Call to deprecated function drupal_realpath().  
  109    Call to deprecated function drupal_realpath().  
 ------ ------------------------------------------------ 

 ------ ------------------------------------------------------------ 
  Line   src/Tests/FileEntityEditTest.php                            
 ------ ------------------------------------------------------------ 
  39     Call to deprecated function drupal_realpath().              
  51     Call to deprecated method url() of class                    
         Drupal\Core\Entity\EntityInterface.                         
  84     Call to deprecated function drupal_realpath().              
  102    Call to deprecated method entityManager() of class Drupal.  
  111    Call to deprecated method entityManager() of class Drupal.  
 ------ ------------------------------------------------------------ 

 ------ ---------------------------------------------------- 
  Line   src/Tests/FileEntityFileTypeClassificationTest.php  
 ------ ---------------------------------------------------- 
  32     Call to deprecated function db_select().            
 ------ ---------------------------------------------------- 

 ------ ------------------------------------------------- 
  Line   src/Tests/FileEntityPathautoTest.php             
 ------ ------------------------------------------------- 
  29     Call to deprecated method strtolower() of class  
         Drupal\Component\Utility\Unicode.                
  38     Call to deprecated method urlInfo() of class     
         Drupal\Core\Entity\Entity.                       
 ------ ------------------------------------------------- 

 ------ ------------------------------------------------ 
  Line   src/Tests/FileEntityReplaceTest.php             
 ------ ------------------------------------------------ 
  48     Call to deprecated function drupal_realpath().  
  65     Call to deprecated function drupal_realpath().  
  76     Call to deprecated function drupal_realpath().  
  86     Call to deprecated function drupal_basename().  
 ------ ------------------------------------------------ 

 ------ --------------------------------------------------------------- 
  Line   src/Tests/FileEntityServicesTest.php                           
 ------ --------------------------------------------------------------- 
  18     Class Drupalile_entity\Tests\FileEntityServicesTest extends  
         deprecated class Drupal
est\Tests\RESTTestBase.               
  79     Call to deprecated method urlInfo() of class                   
         Drupal\Core\Entity\Entity.                                     
  85     Call to deprecated method urlInfo() of class                   
         Drupal\Core\Entity\Entity.                                     
  89     Call to deprecated method urlInfo() of class                   
         Drupal\Core\Entity\Entity.                                     
 ------ --------------------------------------------------------------- 

 ------ ------------------------------------------------------------------- 
  Line   src/Tests/FileEntityTestBase.php                                   
 ------ ------------------------------------------------------------------- 
  158    Call to deprecated function entity_load_multiple_by_properties().  
 ------ ------------------------------------------------------------------- 

 ------ -------------------------------------------------------- 
  Line   src/Tests/FileEntityTypeTest.php                        
 ------ -------------------------------------------------------- 
  59     Call to deprecated method strtolower() of class         
         Drupal\Component\Utility\Unicode.                       
  72     Call to deprecated function entity_get_form_display().  
  86     Call to deprecated function drupal_realpath().          
  123    Call to deprecated method strtolower() of class         
         Drupal\Component\Utility\Unicode.                       
  136    Call to deprecated function entity_get_form_display().  
  149    Call to deprecated function drupal_realpath().          
 ------ -------------------------------------------------------- 

 ------ ------------------------------------------------------------ 
  Line   src/Tests/FileEntityUnitTest.php                            
 ------ ------------------------------------------------------------ 
  81     Call to deprecated method entityManager() of class Drupal.  
  82     Call to deprecated function file_load_multiple().           
  102    Call to deprecated function file_load_multiple().           
  132    Call to deprecated method entityManager() of class Drupal.  
  148    Call to deprecated function db_query().                     
 ------ ------------------------------------------------------------ 

 ------ -------------------------------------------------- 
  Line   tests/src/Kernel/FileEntityNormalizerTest.php     
 ------ -------------------------------------------------- 
  110    Call to deprecated method assertEqual() of class  
         Drupal\KernelTests\KernelTestBase.                
  153    Call to deprecated method assertEqual() of class  
         Drupal\KernelTests\KernelTestBase.                
  155    Call to deprecated method assertEqual() of class  
         Drupal\KernelTests\KernelTestBase.                
  156    Call to deprecated method assertEqual() of class  
         Drupal\KernelTests\KernelTestBase.                
  211    Call to deprecated method assertEqual() of class  
         Drupal\KernelTests\KernelTestBase.                
 ------ -------------------------------------------------- 

 ------ -------------------------------------------------------------------- 
  Line   views/views_handler_field_file_rendered.inc                         
 ------ -------------------------------------------------------------------- 
         Class views_handler_field_file_rendered was not found while trying  
         to analyse it - autoloading is probably not configured properly.    
 ------ -------------------------------------------------------------------- 

 ------ --------------------------------------------------------------- 
  Line   views/views_plugin_row_file_rss.inc                            
 ------ --------------------------------------------------------------- 
         Class views_plugin_row_file_rss was not found while trying to  
         analyse it - autoloading is probably not configured properly.  
 ------ --------------------------------------------------------------- 

 [ERROR] Found 106 errors                                                   
 

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

mcdwayne created an issue. See original summary.

sergiu stici’s picture

Status: Active » Needs review
StatusFileSize
new52.58 KB

Here is the patch, please review.

joseph.olstad’s picture

Hi Sergiu, great work on this, not sure if it'll pass tests though.

For now I parked this in a new branch called 9.x-2.x

berdir’s picture

We don't know yet how 9.x versions will look like exactly, but changes are that there will *not* be 9.x branches, deprecations are meant to be committed to 8.x, but there's no urgency to that and shouldn't be done while tests are as broken as they are now.

joseph.olstad’s picture

I retriggered tests of this patch on the 8.x branch, it might (probably) need(s) a reroll?

joseph.olstad’s picture

Status: Needs review » Active

I merged this into the 8.x branch

however it seems there was a fatal error, I will try revert

joseph.olstad’s picture

might be testbot issue, but...

joseph.olstad’s picture

retriggering tests on patch

joseph.olstad’s picture

StatusFileSize
new52.55 KB

not sure why the patch isn't applying, it applies in my dev

joseph.olstad’s picture

head has 3 fails

berdir’s picture

Status: Active » Needs work
+++ b/file_entity.tokens.inc
@@ -84,7 +84,7 @@ function file_entity_tokens($type, $tokens, array $data, array $options, Bubblea
           if ($file_type = FileType::load($file->bundle())) {
             $bubbleable_metadata->addCacheableDependency($file_type);
-            $replacements[$original] = $sanitize ? SafeMarkup::checkPlain($file_type->label()) : $file_type->label();
+            $replacements[$original] = $sanitize ? Html::escape($file_type->label()) : $file_type->label();

the concept of sanitizing tokens has been removed long ago, this option doesn't exist anymore and doesn't need to be considered.

joseph.olstad’s picture

ok so remove the sanitization then? reroll the patch.
Sounds easy enough, any takers?

anmolgoyal74’s picture

Status: Needs work » Needs review
StatusFileSize
new52.5 KB
new4.33 KB

Ro-rolled and removed token sanitizing.

jenlampton’s picture

I believe that if you add drupal 9 as an option to the composer.json file in this project you can get a nice little Compatible with Drupal 9 badge in the Project information section on the module page.

Screenshot of the Project information section with Compatible with Drupal 9 highlighted

Below is a code sample from a module that has the badge.

"require": {
        "php": "^7.1",
       "drupal/core": "^8 || ^9"
  },

It also looks like it may possible to get the badge by adding the 'core_version_requirement' key in the modules info.yml file, which, in turn, will add the version to the require section of composer.json. Example follows.

core_version_requirement: ^8 || ^9

Do you want to include the change in this Patch or open a separate issue?

berdir’s picture

@jenlampton: That "badge" on the project page is just a text field where the maintainer can add some text, it's not coupled to the module actually being compatible.

That said, yes, this patch should definitely include the .info.yml change.

primsi’s picture

StatusFileSize
new111.63 KB

Some additional work done here. I did most of the WebTestBase > BrowserTestBase migration. This resulted in a bunch of test fails. Resolved most of them, I think 2 are missing.

Another thing that is missing is to fix FileEntityServicesTest. This should either properly extend ResourceTestBase or - per discussion with @berdir - extend BrowserTestBase with some ResourceTestBase addition.

And finally, there are a bunch of deprecation notices reported by test runs.

End note: interdiff might not be 100% accurate, because I apparently had phpstorm option to commit deletions on. Sry for that.

primsi’s picture

... and the interdiff with the patch again.

primsi’s picture

StatusFileSize
new28.54 KB
new75.83 KB

Nope, still not ok.

berdir’s picture

Assigned: Unassigned » berdir
berdir’s picture

Fixed some tests including the REST one and lots of deprecate replacements, should be pretty much done.

Status: Needs review » Needs work

The last submitted patch, 23: drupal_9_deprecated_code-3042763-23.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new105.02 KB
new2.02 KB

Some more fixes/improvements.

berdir’s picture

And the .info.yml change.

berdir’s picture

Status: Needs review » Fixed

Committed.

  • Berdir committed a84ad1f on 8.x-2.x
    Issue #3042763 by Berdir, Primsi, anmolgoyal74, joseph.olstad, Sergiu...

Status: Fixed » Closed (fixed)

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

luca_loguercio’s picture

StatusFileSize
new101.13 KB

For anyone looking to apply it to beta 7

sharif.elshobkshy’s picture

StatusFileSize
new5.17 KB

Beta 8 (8.x-2.0-beta8) has fewer D9 requirements.

New patch to address the following D9 requirements in Beta8 version.

 ------ ----------------------------------------------------------- 
  Line   views/views_plugin_row_file_rss.inc                        
 ------ ----------------------------------------------------------- 
  85     Call to deprecated function file_load_multiple():          
         in drupal:8.0.0 and is removed from drupal:9.0.0. Use      
           \Drupal\file\Entity\File::loadMultiple().                
  112    Call to deprecated function user_load():                   
         in drupal:8.0.0 and is removed from drupal:9.0.0. Use      
           Drupal\user\Entity\User::load().                         
  160    Call to deprecated function drupal_render():               
         in drupal:8.0.0 and is removed from drupal:9.0.0. Use the  
           'renderer' service instead.                              
 ------ -----------------------------------------------------------

Also added some coding standards.

berdir’s picture

That file is dead Drupal 7 code, that's going to require a lot more to make sense again. Just ignore it, no need to bother patching that. If anything, create a new issue to figure out if it can safely be removed or if there's anything worth porting over properly.