- Issue created by @kim.pepper
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
This feels like a good first step and is compatible with π [META] Modernise file upload logic Active
- Merge request !4639Issue #3375423: Deprecate file_managed_file_save_upload and _file_save_upload_from_form and replace with a service β (Open) created by kim.pepper
- last update
about 1 year ago Custom Commands Failed - Status changed to Needs review
about 1 year ago 2:00am 25 August 2023 - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
This deprecates:
file_managed_file_save_upload()
_file_save_upload_from_form()
- and
file_save_upload()
and replaces them with a few new services.
\Drupal\file\Upload\FileElementHelper::saveFileUploads(array $element, FormStateInterface $formState)
replacesfile_managed_file_save_upload($element, FormStateInterface $form_state)
and_file_save_upload_from_form()
. The intention is to separate all the form api and user-facing messaging into this service.\Drupal\file\Upload\FormFileUploadHandler::saveFileUploads(string $uploadKey, array $validators, callable $errorHandler, ?string $destination = 'temporary://', string $replace = FileSystemInterface::EXISTS_RENAME)
replacesfile_save_upload($form_field_name, $validators = [], $destination = FALSE, $delta = NULL, $replace = FileSystemInterface::EXISTS_RENAME)
.callable $errorHandler
that accept three arguments:\Drupal\file\Upload\UploadedFileInterface $uploadedFile
string $destination
\Exception $e
We then have a
\Drupal\file\Upload\MessageCollectingErrorCallback
which we pass to collect any errors and allows us to remove a load of the messy message deleting, and re-adding that we had in_file_save_upload_from_form()
\Drupal\file\Upload\FormUploadedFileRetriever
removes the duplicated code of retrieving the uploaded files from the request, and is injected intoFileElementHelper
andFormFileUploadHandler
.Lastly, in order to not have to add a message for each file rename in our API-level code, instead we dispatch a
\Drupal\file\Upload\FileUploadedEvent
and added aMessengerFileUploadedSubscriber
to add a status message if a file was renamed. - last update
about 1 year ago Custom Commands Failed - last update
about 1 year ago Custom Commands Failed - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
I'm confused by the phpstan failure.
First it says its comparing against 10.2.x where the MR is for 11.x. Then its showing an error about a variable
$file_upload
which I couldn't find anywhere infile.module
.Running PHPStan on *all* files. ------ -------------------------------------------------------------------- Line core/modules/file/file.module ------ -------------------------------------------------------------------- Ignored error pattern #^Variable \$file_upload in empty\(\) always exists and is not falsy\.$# in path /var/www/html/core/modules/file/file.module was not matched in reported errors
- last update
about 1 year ago Build Successful - last update
about 1 year ago 29,942 pass, 26 fail - last update
about 1 year ago 29,952 pass, 17 fail - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Looks like I have an issue somewhere with setting the form errors and them being double-escaped:
One or more files could not be uploaded.<ul><li>The file is <em class="placeholder">1.25 MB</em> exceeding the maximum file size of <em class="placeholder">1 MB</em>.</li></ul>
- last update
about 1 year ago 29,966 pass, 13 fail - last update
about 1 year ago 30,007 pass, 9 fail - Status changed to Needs work
about 1 year ago 3:20pm 25 August 2023 - πΊπΈUnited States smustgrave
Seems to have some test failures.
@larowlan as a committer do you agree with the task being done?
57:30 56:38 Running- last update
about 1 year ago 30,009 pass, 9 fail - last update
about 1 year ago 30,035 pass, 5 fail - last update
about 1 year ago 30,021 pass, 5 fail - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Updating title and remaining tasks:
- Add tests for new services
- Add legacy tests for deprecated functions
- Update mermain diagrams with current architecture
- Update issue summary
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
The image test fail is due to changes in the messages being displayed:
Old:
The specified file image-test.jpg could not be uploaded. The image is too small. The minimum dimensions are 50x50 pixels and the image size is 40x20 pixels.
New:
One or more files could not be uploaded. The image is too small. The minimum dimensions are 50x50 pixels and the image size is 40x20 pixels.
- last update
about 1 year ago 30,023 pass, 4 fail - last update
about 1 year ago 30,032 pass, 3 fail - last update
about 1 year ago 30,056 pass, 2 fail - last update
about 1 year ago 30,062 pass - Status changed to Needs review
about 1 year ago 9:58am 29 August 2023 - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Finally, tests passing! π
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Updated the mermaid diagram to match the current MR.
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Updated IS and CR
- last update
about 1 year ago 30,100 pass - π¬π§United Kingdom joachim
One or more files could not be uploaded.
The image is too small. The minimum dimensions are 50x50 pixels and the image size is 40x20 pixels.
This no longer tells you the filename of the problem file. If you uploaded several, how are you supposed to know which one to fix?
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
I fixed that. There is no difference between HEAD and this MR now as to what is output.
- Status changed to Needs work
about 1 year ago 1:22am 4 September 2023 The Needs Review Queue Bot β tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide β to find step-by-step guides for working with issues.
15:08 14:21 Running- Status changed to Needs review
about 1 year ago 1:29am 4 September 2023 - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Rebase with 11.x
- Status changed to Needs work
about 1 year ago 5:32pm 3 October 2023 The Needs Review Queue Bot β tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide β to find step-by-step guides for working with issues.
- last update
about 1 year ago 30,373 pass - Status changed to Needs review
about 1 year ago 10:52pm 3 October 2023 - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Merge with 11.x
- last update
about 1 year ago 30,386 pass - last update
about 1 year ago 30,394 pass - Status changed to Postponed
about 1 year ago 9:38pm 11 October 2023 - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Postponed on π Create an UploadedFile validator and deprecate error checking methods on UploadedFileInterface RTBC since we can remove some of the exception handling once that is in.
- last update
about 1 year ago 30,411 pass, 2 fail - last update
about 1 year ago 30,415 pass - Status changed to Needs work
about 1 year ago 10:43pm 23 October 2023 - last update
about 1 year ago 30,266 pass, 43 fail - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Going to try and avoid the whole 'message collector' business, and just return a new
FileResults
(plural) object that has aConstraintViolationList
. Might be a nice utility to write violations toDrupal::addMessage()
or something like that. - Status changed to Needs review
6 months ago 5:08am 21 May 2024 - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Finally tests back to green. β Ready for reviews again.
- Status changed to Needs work
6 months ago 2:06pm 21 May 2024 - πΊπΈUnited States smustgrave
Hiding files from the bot.
Removing tests tag as coverage appears to be there for the deprecations here https://git.drupalcode.org/issue/drupal-3375423/-/jobs/1646261
Did leave a few comments on the MR.
- π«π·France andypost
btw deprecations should be updated to 11.0.0 for removal in 12.0.0
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
According to @larowlan we should be deprecating in 10.4.0 for removal in 12.0.0. https://drupal.slack.com/archives/C1BMUQ9U6/p1716324332447859?thread_ts=...
- Status changed to Needs review
6 months ago 9:03pm 21 May 2024 - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Updated all deprecation versions to
drupal:10.4.0 and is removed from drupal:12.0.0
- Status changed to RTBC
6 months ago 9:22am 22 May 2024 - Status changed to Needs review
6 months ago 10:16pm 28 May 2024 - π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Couple of questions on the MR, nice work!
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Updated IS
- Status changed to RTBC
5 months ago 2:23pm 5 June 2024 - πΊπΈUnited States smustgrave
Re-reviewing and appears all feedback has been addressed.
CR is straight forward too.
- Status changed to Needs review
5 months ago 9:38am 8 June 2024 - π¬π§United Kingdom alexpott πͺπΊπ
This change feels like it is doing more that it should. It is added typehints which mean we have to consider multiple angles of BC. It is changing logic deep in security focussed code. This should not be necessary to achieve the aims of the issue.
- Status changed to Needs work
5 months ago 10:02am 20 June 2024 The Needs Review Queue Bot β tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide β to find step-by-step guides for working with issues.