- Issue created by @Project Update Bot
This is an automated patch generated by Drupal Rector. Please see the issue summary for more details.
It is important that any automated tests available are run with this patch and that you manually test this patch.
Drupal 10 Compatibility
According to the Upgrade Status module → , even with this patch, this module is not yet compatible with Drupal 10.
Currently Drupal Rector, version 0.15.1, cannot fix all Drupal 10 compatibility problems.
Therefore this patch does not update the
info.yml
file for Drupal 10 compatibility.Leaving this issue open, even after committing the current patch, will allow the Project Update Bot → to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.
Debug info
Bot run #12554This patch was created using these packages:
- mglaman/phpstan-drupal: 1.1.35
- palantirnet/drupal-rector: 0.15.1
- Status changed to Needs work
over 1 year ago 11:07am 8 August 2023 - 🇮🇹Italy apaderno Brescia, 🇮🇹
if (((int) \Drupal::VERSION) < 9) { - $file = file_load($fid); + $file = \Drupal::service('entity_type.manager')->getStorage('file')->load($fid); } else {
Since the code first check the Drupal version, this is not the correct change.
- Assigned to Chandreshgiri Gauswami
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 3:09pm 8 August 2023 - Status changed to Needs work
over 1 year ago 6:44pm 8 August 2023 - 🇮🇹Italy apaderno Brescia, 🇮🇹
+ $file = File::load($fid); $path = 'public://inline-images/' . date('Y-m', time()) . '/' . time() . '/'; - if (((int) \Drupal::VERSION) < 9) { - if (file_prepare_directory($path, FILE_CREATE_DIRECTORY) && !file_exists($path)) { - file_copy($file, $path); - } - $images = file_scan_directory($themeLink . '/content/images', '/.*\.jpg|jpeg|gif|png|pdf|doc|zip|rar|docx|7zip|txt|rtf|odt|7z|ods$/'); - $videos = file_scan_directory($themeLink . '/video', '/.*\.mp4$/'); - } else { - if (\Drupal::service('file_system')->prepareDirectory($path, FileSystemInterface::CREATE_DIRECTORY) && !file_exists($path)) { - file_copy($file, $path); - } - $images_dir = $themeLink . '/content/images'; - if (is_dir($images_dir)) { - $images = \Drupal::service('file_system')->scanDirectory($images_dir, '/.*\.jpg|jpeg|gif|png$/'); - } - $videos_dir = $themeLink . '/video'; - if (is_dir($videos_dir)) { - $videos = \Drupal::service('file_system')->scanDirectory($videos_dir, '/.*\.mp4$/'); - } + if (\Drupal::service('file_system')->prepareDirectory($path, FileSystemInterface::CREATE_DIRECTORY) && !file_exists($path)) { + \Drupal::service('file.repository')->copy($file, $path); + } + $images_dir = $themeLink . '/content/images'; + if (is_dir($images_dir)) { + $images = \Drupal::service('file_system')->scanDirectory($images_dir, '/.*\.jpg|jpeg|gif|png$/'); + }
This change is not correct either, since that code would not work on Drupal 8, which is included in the core_version_requirement value used by the theme.