Drupal-Check is providing errors. I am adding patch for resolving this errors on the existing patch: deprecated-code-report-3123971-16.patch

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

suresh prabhu parkala’s picture

Status: Active » Needs review
StatusFileSize
new3.68 KB

Please review the patch.

mistrae’s picture

Status: Needs review » Needs work

Still having errors after applying the patch

web/modules/contrib/filebrowser/src/Presentation.php Line 115

Call to deprecated function tablesort_init(). Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Utility\TableSort::getContextFromRequest() instead.

web/modules/contrib/filebrowser/modules/filebrowser_extra.info.yml

Add core_version_requirement: ^8 || ^9 to modules/contrib/filebrowser/modules/filebrowser_extra.info.yml to designate that the module is compatible with Drupal 9. See https://drupal.org/node/3070687.

suresh prabhu parkala’s picture

Assigned: Unassigned » suresh prabhu parkala
mistrae’s picture

Status: Needs work » Needs review
StatusFileSize
new4.57 KB

Edit : Was working on a patch, didn't saw you assigned it to you

mistrae’s picture

StatusFileSize
new5.12 KB

Forgot the services.yml file

suresh prabhu parkala’s picture

Assigned: suresh prabhu parkala » Unassigned
smrutha’s picture

Patch #6 works good.

drupal-check -d web/modules/contrib/filebrowser
41/41 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

[OK] No errors

smrutha’s picture

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

Thanks for this. Let me review it and come back shortly.

sispro’s picture

Ok

sker101’s picture

StatusFileSize
new6.72 KB

Thanks for the patch but it doesn't seem to be work for me due to the missing use statements in file src/Presentation.php from line 114 to 118.

I created an updated patch with following changes:

  1. Add use statements for the classes "Request" and "TableSort" in Presentation.php
  2. Move "\Drupal::service('file.mime_type.guesser')" call out of foreach loop from line 79 in ServerFileList.php
sker101’s picture

Status: Reviewed & tested by the community » Needs review

Move back to "Needs Review" since the last reviewed patch wasn't working.

sker101’s picture

Another thing I noticed is I tried to upgrade to Drupal 9 using Composer after applying this patch but it still won't allow me to do so due to the following conflict error.

drupal/filebrowser 2.2.0 requires drupal/core ^8.7.0 

When I look at my `composer.lock` and I saw the module does requires core version of `^8.7.0`.

"name": "drupal/filebrowser",
"version": "2.2.0",
"require": {
  "drupal/core": "^8.7.0"
 },

Since there is no `composer.json` in this module, I'm guessing it's using the "composer.json" served from "git.drupalcode.org" and will be addressed once this patch is committed?

jasonluttrell’s picture

I am using Filebrowser 2.2-dev on Drupal 9.0.6. I have applied both patches, #6 and #12 above. In both cases, when saving a new Directory Listing (/node/add/dir_listing) I get the following error message:

The website encountered an unexpected error. Please try again later.
Error: Call to undefined method Drupal\Core\File\FileSystem::uriScheme() in Drupal\filebrowser\FilebrowserManager::validateFolderPath() (line 401 of modules/contrib/filebrowser/src/FilebrowserManager.php).
Drupal\filebrowser\FilebrowserManager::validateFolderPath(Array, Object, Array)
call_user_func_array(Array, Array) (Line: 280)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 236)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 236)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'node_dir_listing_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('node_dir_listing_form', Array, Object) (Line: 589)
Drupal\Core\Form\FormBuilder->processForm('node_dir_listing_form', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
(Truncated)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

sker101’s picture

StatusFileSize
new11.78 KB

@jasonluttrell

Good catch! this patch should fix the error.

I also tested it myself on Drupal 9.

The patch also removes the following warnings when creating folders.

Warning: Illegal offset type in Symfony\Component\HttpFoundation\Session\Flash\FlashBag->add() (line 59 of /var/www/mint/vendor/symfony/http-foundation/Session/Flash/FlashBag.php)
Warning: array_key_exists(): The first argument should be either a string or an integer in Symfony\Component\HttpFoundation\Session\Flash\FlashBag->has()
jasonluttrell’s picture

@sker101 the patch in #16 works beautifully. I did not get the error this time. Thanks! This should be RTBC.

devdesagar’s picture

Hello Team,
Patch #16 is working for me tested on Drupal 8 and Drupal 9

devdesagar’s picture

Status: Needs review » Reviewed & tested by the community

wizonesolutions made their first commit to this issue’s fork.

wizonesolutions’s picture

Issue summary: View changes
wizonesolutions’s picture

Issue summary: View changes

Oops! Issue summary reverted.

I made an issue fork that applies the patch and adds a compatible composer.json so that the project will work as a Composer repository in a Drupal 9 project. The composer.json part should probably not be committed to this project; the packaging system defaults are probably fine.

But hopefully this will be useful for anyone needing this now.

jcisio’s picture

Title: Deprecated Code Report » Compatibility with Drupal 9

@wizonesolutions I'd like to know why an issue fork with extra composer.json is needed. Couldn't we just use a composer patch above or from an issue fork (for maintainability) without composer.json?

wizonesolutions’s picture

@jcisio It’s just like I wrote in my comment: so that it will work as a Composer repository in a Drupal 9 project (a custom repository in the root composer.json).

Without that, it has to be added as a Git submodule or downloaded and patched manually because Composer will refuse to clone it normally (because of the composer.json version).

As mentioned, it was basically for me to use in a project, not intended to replace the patch as the solution.

jcisio’s picture

Thank you. Got that. The current (automatically generated) composer.json does not even allow to add this project in Drupal 9, so can not patch it.

kuhikar’s picture

Issue summary: View changes
StatusFileSize
new12.85 KB

I have done following steps:
1. git clone --branch '8.x-2.x' https://git.drupalcode.org/project/filebrowser.git
2. goto root directory
3. drupal-check 'web/modules/contrib/filebrowser'
It was providing errors.
4. After that, I executed command: curl -O https://www.drupal.org/files/issues/2020-10-13/deprecated-code-report-31... in 'web/modules/contrib/filebrowser' directory and apply git apply patch deprecated-code-report-3123971-16.patch

5. Then I again executed below command. It is providing below errors.

drupal-check "web\modules\contrib\filebrowser"
41/41 [============================] 100%

------ --------------------------------------------------------------------------
Line src\Events\MetadataEvent.php
------ --------------------------------------------------------------------------
7 Class Drupal\filebrowser\Events\MetadataEvent extends deprecated class
Symfony\Component\EventDispatcher\Event:
since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead
------ --------------------------------------------------------------------------

------ --------------------------------------------------------------------------
Line src\Events\MetadataInfo.php
------ --------------------------------------------------------------------------
7 Class Drupal\filebrowser\Events\MetadataInfo extends deprecated class
Symfony\Component\EventDispatcher\Event:
since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead
------ --------------------------------------------------------------------------

------ ---------------------------------------------------------------------------
Line src\Events\UserActionsEvent.php
------ ---------------------------------------------------------------------------
7 Class Drupal\filebrowser\Events\UserActionsEvent extends deprecated class
Symfony\Component\EventDispatcher\Event:
since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead
------ ---------------------------------------------------------------------------
[ERROR] Found 3 errors

6. I have added patch file: drupal9_deprecated_report-26.patch This file also including the changes of deprecated-code-report-3123971-16.patch.

7. Please download drupal9_deprecated_report-26.patch in the filebrowser directory and run: git apply drupal9_deprecated_report-26.patch in the module directory

8. Please run again below command, it is providing below output with No Errors.

drupal-check "web\modules\contrib\filebrowser"
41/41 [============================] 100%

[OK] No errors

9. Please review patch : drupal9_deprecated_report-26.patch

Currently, we are creating D9 compatible website and this module is in D8 compatible only. Please allow us to maintain this module.

jcisio’s picture

Status: Reviewed & tested by the community » Needs work

Wouldn't patch #16 make this module incompatible with Drupal 8, because of dependency on Symfony 4?

kuhikar’s picture

@clivesj

#16 : It is Drupal 8 and Drupal 9 Compatible.

#26: It is Drupal 9 compatible.

Can we consider #16 as RTBC for Drupal 8? But, it do not resolve drupal-check error.

Can we release Drupal 8 and Drupal 9 release version separately for this module.

jcisio’s picture

I don't think #16 is compatible Drupal 9. Because Drupal is shipped with Symfony 4, the event dispatcher has changed. So I think we should either create two releases (but it's harder for maintenance) or check Symfony version in code to use the correct argument for the event dispatcher.

Edit: in #27 of course I meant #26, sorry. #26 is not compatible with D8, and #16 is not compatible with D9.

AalokAtre’s picture

@jcisio Symfony 4 still has "Symfony\Component\EventDispatcher\Event' class (marked as deprecated) as well as "Symfony\Contracts\EventDispatcher\Event" . Patch #16 should be RTBC as it is indeed compatible with D8 and D9.

While patch 26 can be released in a new 3.x branch as it will D8 incompatible.

clivesj’s picture

So it sounds like we do require 3.x branch for D9 (based on #16) and apply #16 to the current branch. Correct?

jcisio’s picture

@AalokAtre https://www.drupal.org/node/3159012 we would need the bridge for Drupal 9.1, but it would be a bit more complicated.

So I think the way to go is patch #16. Has anyone tested it in Drupal 9.1 and 9.2?

Patch #26 would be D10 material.

kuhikar’s picture

@jcisio:

I have followed below steps for #16:

For 9.1.0:

For 9.2.0:

The problem with #16 is only with drupal-check. When we are running drupal-check, it is providing us warning. That I have resolved in #26. Kindly check #26 for the same.

@clivesj: Please we require 3.x branch for D9 (based on #26) and apply #16 patch to current branch.

  • clivesj committed 588b71f on 8.x-2.x authored by kuhikar
    Issue #3123971 by wizonesolutions, sker101, Mistrae, Suresh Prabhu...
kuhikar’s picture

@clivesj:

#16: sker101 is actually the author of the patch.

#26: kuhikar is author of this patch.

Can you please give credit to sker101 for #16.

clivesj’s picture

Status: Needs work » Fixed

Committed #16 to 8.x-2.3 (D8 only)
Committed #26 to 3.0.0 (D9 only)
Thanks to all.

Status: Fixed » Closed (fixed)

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

hotwebmatter made their first commit to this issue’s fork.

hotwebmatter’s picture

I have created an updated issue fork to use as a transitional package while testing Drupal 9 compatibility in Drupal 8.9.18.

I didn't want to use the issue fork created by @wizonesolutions in https://www.drupal.org/project/filebrowser/issues/3123971#comment-13910338, because it needed to be rebased off the latest D8 version.

This issue fork is only useful if you need to install a Drupal 9 compatible version of the project in Drupal 8, as a transitional package during an upgrade. If you are starting a Drupal 9 project from scratch, just use version 3.0.0 (D9 only).

I've been making Merge Requests of these D9 compatibility issue forks, with installation instructions. But in this case, the code should not be merged, so I won't bother with the MR.