Running drupal-check in version 8.x-3.x returns the following issues

------ ------------------------------------------------- 
  Line   s3fs/drush/s3fs.drush8.inc                       
 ------ ------------------------------------------------- 
  72     Call to deprecated function drush_get_option().  
  73     Call to deprecated function drush_log().         
  74     Call to deprecated function drush_log().         
  75     Call to deprecated function drush_print().       
  93     Call to deprecated function drush_log().         
  99     Call to deprecated function drush_log().         
  103    Call to deprecated function drush_log().         
 ------ ------------------------------------------------- 

 ------ ----------------------------------------------------------------------------- 
  Line   s3fs/src/S3fsService.php                                                     
 ------ ----------------------------------------------------------------------------- 
  374    Call to deprecated constant REQUEST_TIME: Deprecated in drupal:8.3.0 and is  
         removed from drupal:9.0.0. Use \Drupal::time()->getRequestTime();            
 ------ ----------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------- 
  Line   s3fs/src/StreamWrapper/S3fsStream.php                                     
 ------ -------------------------------------------------------------------------- 
  361    Call to deprecated function file_uri_target():                            
         in drupal:8.8.0 and is removed from drupal:9.0.0. Use                     
         \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::getTarget()     
         instead.                                                                  
  733    Call to deprecated function file_uri_target():                            
         in drupal:8.8.0 and is removed from drupal:9.0.0. Use                     
         \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::getTarget()     
         instead.                                                                  
  781    Call to deprecated function file_uri_target():                            
         in drupal:8.8.0 and is removed from drupal:9.0.0. Use                     
         \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::getTarget()     
         instead.                                                                  
  1044   Call to deprecated function file_uri_target():                            
         in drupal:8.8.0 and is removed from drupal:9.0.0. Use                     
         \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::getTarget()     
         instead.                                                                  
  1078   Call to deprecated function file_stream_wrapper_uri_normalize():          
         in drupal:8.8.0 and is removed from drupal:9.0.0. Use                     
         \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::normalizeUri()  
         instead.                                                                  
  1126   Call to deprecated function file_stream_wrapper_uri_normalize():          
         in drupal:8.8.0 and is removed from drupal:9.0.0. Use                     
         \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::normalizeUri()  
         instead.                                                                  
  1142   Call to deprecated function file_uri_target():                            
         in drupal:8.8.0 and is removed from drupal:9.0.0. Use                     
         \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::getTarget()     
         instead.                                                                  
  1332   Call to deprecated function file_uri_target():                            
         in drupal:8.8.0 and is removed from drupal:9.0.0. Use                     
         \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::getTarget()     
         instead.                                                                  
 ------ -------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------- 
  Line   s3fs/src/Tests/S3fsConfigFormTest.php                                        
 ------ ----------------------------------------------------------------------------- 
  14     Class Drupal\s3fs\Tests\S3fsConfigFormTest extends deprecated class          
         Drupal\simpletest\WebTestBase:                                               
         in drupal:8.8.0 and is removed from drupal:9.0.0. Instead,                   
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.  
  29     Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:    
         in drupal:8.8.0 and is removed from drupal:9.0.0. Instead,                   
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.  
 ------ -----------------------------------------------------------------------------

Comments

montesajudy created an issue. See original summary.

sidharthap’s picture

Status: Active » Needs review
StatusFileSize
new10.47 KB

first patch. it includes
removed drush8 files as drush 9 service and Commands are in place.
removed deprecated functions with D9 one.
removed WebTestBase and added BrowserTestBase

jkswoods’s picture

+++ b/src/S3fsService.php
@@ -371,7 +371,7 @@ class S3fsService implements S3fsServiceInterface {
     $metadata = [
       'uri' => $uri,
       'filesize' => 0,
-      'timestamp' => REQUEST_TIME,
+      'timestamp' => \Drupal::time()->getRequestTime(),
       'dir' => 0,
       'version' => '',
     ];
diff --git a/src/StreamWrapper/S3fsStream.php b/src/StreamWrapper/S3fsStream.php

"\Drupal::" calls should be avoided in classes, we can use dependency injection for this.

Drupal 9 compatibility should also be specified in the info.yml: core_version_requirement: ^8.8 || ^9

jkswoods’s picture

StatusFileSize
new2.35 KB
new12.4 KB

Patch to address #3

ankush_03’s picture

Status: Needs review » Needs work

@jkswoods core: 8.x key has to be there if the module can work with versions prior to 8.7.7

"drupal/core": "^8 || ^9"

core_version_requirement: ^8 || ^9

See https://www.drupal.org/node/3070687

jkswoods’s picture

@ankushgautam76@gmail.com Changes within the patch are not compatible with a core version earlier than 8.8.0. The removal of file_uri_target() and file_stream_wrapper_uri_normalize() are deprecations that were introduced in 8.8.0 in favour of using the new static methods within StreamWrapperManagerInterface that were also introduced in 8.8.0: https://www.drupal.org/node/3035273

Taking a second look at the patch, the uses of StreamWrapperManagerInterface will need to be replaced with dependency injection to load StreamWrapperManager, as StreamWrapperManagerInterface is just an interface.

jkswoods’s picture

StatusFileSize
new5.62 KB
new13.57 KB

Patch to address #7, introduces dependency injection to S3fsStream to load the StreamWrapperManager.

jkswoods’s picture

Status: Needs work » Needs review
jansete’s picture

Nice work guys, i'm going to commit this with a little modification.

We can't inject dependecies in S3fsStream, I don't know the reason yet, I added a @todo to review soon.

  • jansete committed 7af6dd8 on 8.x-3.x authored by jkswoods
    Issue #3106533 by jkswoods, sidharthap, jansete: Drupal 9 Deprecated...
jansete’s picture

Status: Needs review » Reviewed & tested by the community
jansete’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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