Call to deprecated function file_scan_directory(): in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\File\FileSystemInterface::scanDirectory() instead.

Comments

edemidenko created an issue. See original summary.

edemidenko’s picture

StatusFileSize
new1.31 KB
edemidenko’s picture

Status: Active » Needs review
amateichuk’s picture

use Drupal\Core\File\FileSystemInterface; - Don't used in file
string: catch (FileException $e) - expect
use Symfony\Component\HttpFoundation\File\Exception\FileException;

edemidenko’s picture

Updated -> changed to use Symfony\Component\HttpFoundation\File\Exception\FileException;

neograph734’s picture

StatusFileSize
new2.7 KB

Thanks for the work so far, but I am not yet entirely happy with the service usage within the class. It should be defined in high_contrast.services.yml instead.

Please review attached patch.

hkirsman’s picture

Sounds like a good idea. Just curious, is there any performance reasons or it's just how it's meant to work if service has been defined?

There is 1 missing space that is bugging me but that's just me https://git.drupalcode.org/project/high_contrast/blob/8.x-1.x/high_contr... :)

hkirsman’s picture

Status: Needs review » Reviewed & tested by the community

  • Neograph734 committed 77bc152 on 8.x-1.x
    Issue #3112746 by edemidenko, Neograph734: Replace deprecated function...
neograph734’s picture

Status: Reviewed & tested by the community » Fixed

Sounds like a good idea. Just curious, is there any performance reasons or it's just how it's meant to work if service has been defined?

I think (but I am far from a Symfony expert) that it helps to reduce the amount of instantiated classes and thus memory usage. By reusing classes and listing all their dependencies they can be loaded in the right order and the same FileSystem class can be reused across all modules. So I think it helps in reducing memory usage. (A 1:1 replacement like this one won't make much of a difference, but it is good to stick to conventions anyway)

I have corrected the space as well :)

pifagor’s picture

pifagor’s picture

neograph734’s picture

Assigned: edemidenko » Unassigned

Unassigning edemidenko. Thanks all for the help.

Status: Fixed » Closed (fixed)

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

avpaderno’s picture

Issue tags: -Drupal 9 compatibility (3105304) +Drupal 9 compatibility