Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Refactor DrupalFiles to remove deprecated system_retrieve_file() #4420

Merged
merged 21 commits into from
Feb 28, 2025

Conversation

dafeder
Copy link
Member

@dafeder dafeder commented Feb 27, 2025

Part of #4368

Continuing work on #4283 by @paul-m

Note that all logic dealing with managed files is removed. In the old DrupalFiles, $managed was always passed as FALSE, so there was no way files would ever be managed.

Describe your changes

Refactors our code to not use system_retrieve_file().

Required for Drupal 11.

Change record: https://www.drupal.org/node/3223362

@dafeder dafeder marked this pull request as ready for review February 27, 2025 19:01
@dafeder dafeder force-pushed the system-retrieve-file2 branch from 5c5fb38 to 846e68d Compare February 27, 2025 19:14
@dafeder dafeder marked this pull request as draft February 27, 2025 19:14
@dafeder dafeder marked this pull request as ready for review February 27, 2025 19:46
@dafeder dafeder marked this pull request as draft February 27, 2025 20:28
@@ -98,7 +123,65 @@ public function retrieveFile($url, $destination) {
return $this->fileCreateUrl("{$destination}/{$filename}");
}
// Handle http(s):// URIs.
return system_retrieve_file($url, $destination, FALSE, FileSystemInterface::EXISTS_REPLACE);
return $this->retrieveRemoteFile($url, $destination);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this is the only call to system_retrieve_file(), and we always pass it false for managed and replace for file exists, we don't need to support parameters for this. Meaning we don't need to have any support at all for managed files in this class.

@dafeder dafeder marked this pull request as ready for review February 27, 2025 23:37
@paul-m paul-m merged commit e273496 into 2.x Feb 28, 2025
11 checks passed
@dafeder dafeder deleted the system-retrieve-file2 branch February 28, 2025 03:46
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants