Problem/Motivation

Cleanup File core module from deprecated functions

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3432882

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

Satane created an issue. See original summary.

satane’s picture

Status: Active » Needs review

Cleanup all deprecated calls, except those in *Test.php files.

Not sure if classes related to "Tests legacy deprecated functions in file.module." should just be totally deleted or left there?

  • FileSaveUploadTest.php
  • FileUploadHandlerTest.php
  • LegacyFileModuleTest.php
  • LegacyFileThemeTest.php
  • LegacyValidateTest.php
  • LegacyValidatorTest.php
satane’s picture

Merging pipeline made obvious we had to clean Test classes and even entirely delete Legacy ones, so there.

That said, there are still some unit testing errors which I can't figure out entirely.

There's still a call to a function isValid() which I removed as it was marked as deprecated.
See core/modules/file/src/Upload/FileUploadHandler.php:195

But now unit testing shows plenty of errors.
I'm stopping here for now, feel free to jump in.

smustgrave’s picture

Status: Needs review » Needs work

Possible the deprecation was tested and those tests would need to be removed too.

But if removing this function breaks things we may need to re-look at if some replacements were missed when it was first deprecated

kim.pepper made their first commit to this issue’s fork.

kim.pepper’s picture

I've cleaned up some the left over deprecation code. However, I think I've hit a bug with the Validatable config job.

Unable to install modules: module 'help_topics' is obsolete.

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

andypost’s picture

Added fix to see if test will pass, probably it needs separate issue (follow-up) after #3433019: Replace deprecated help_topics module with obsolete stub

but still not clear why nobody reported this earlier

kim.pepper’s picture

kim.pepper’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Removal appears complete.

Applied the MR and searched core/module/file folder for deprecated and 11.0 and all instances have been removed.

longwave’s picture

Status: Reviewed & tested by the community » Needs work

Thanks for working on this - looking good, just a couple of missed spots.

kim.pepper’s picture

Status: Needs work » Needs review

Addressed feedback.

Coming back to this after a long while, I am wondering why we didn't deprecate hook_file_validate() at the time?

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Appears feedback from @longwave has been addressed.

kim.pepper’s picture

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

This should remove hook_file_validation from file.api.php .... it is deprecated we do

$errors = array_merge($errors, $this->moduleHandler->invokeAllDeprecated('Use file validation events instead. See https://www.drupal.org/node/3363700', 'file_validate', [$file]));

And this change is removing that line so the hook is no longer trigger so it should remove it from file.api.php.

kim.pepper’s picture

Status: Needs work » Needs review

Removed hook_file_validate() and doc references to calling file_validate()

andypost’s picture

Status: Needs review » Reviewed & tested by the community

back to RTBC

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 08c0efd and pushed to 11.x. Thanks!

  • alexpott committed 08c0efdf on 11.x
    Issue #3432882 by kim.pepper, Satane, andypost, alexpott, longwave:...
alexpott’s picture

Title: Removed deprecated code in File module (core/module/file) » PP-1: Removed deprecated code in File module (core/module/file)
Status: Fixed » Postponed

We need to revert this as the changes made in #3375447: Create an UploadedFile validator and deprecate error checking methods on UploadedFileInterface need a rework prior to 10.3.0 being released.

  • alexpott committed 5ad1751e on 11.x
    Revert "Issue #3432882 by kim.pepper, Satane, andypost, alexpott,...
kim.pepper’s picture

Title: PP-1: Removed deprecated code in File module (core/module/file) » Removed deprecated code in File module (core/module/file)
Status: Postponed » Active
catch’s picture

Status: Active » Needs work
kim.pepper’s picture

Status: Needs work » Needs review

Cleaned up after a few merge conflicts.

quietone’s picture

Title: Removed deprecated code in File module (core/module/file) » Remove deprecated code in File module
longwave’s picture

Status: Needs review » Needs work

Missed one, otherwise this looks good to me:

core/modules/file/src/Plugin/rest/resource/FileUploadResource.php:    @\trigger_error(__METHOD__ . ' is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\file\Upload\FileUploadLocationTrait::getUploadLocation() instead. See https://www.drupal.org/node/3406099', E_USER_DEPRECATED);

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

quietone’s picture

Status: Needs work » Needs review
andypost’s picture

except nitpick (fixed myself) I find it RTBC

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Was about to do the same beat me to it! Tests all green and deprecation appears to be removed here.

  • catch committed d0184496 on 11.x
    Issue #3432882 by kim.pepper, Satane, andypost, alexpott, longwave:...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x, thanks!

kim.pepper’s picture

MR needs to be closed.

Status: Fixed » Closed (fixed)

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

kim.pepper’s picture

We missed a few methods on \Drupal\file\Upload\InputStreamUploadedFile

Created #3446967: [11.x] Remove deprecated methods in InputStreamUploadedFile

claudiu.cristea’s picture

Issue tags: +Needs change record

Any change record here?

kim.pepper’s picture

I don't believe we need change records for removing deprecated code in major version updates.