Comments

kim.pepper created an issue. See original summary.

kim.pepper’s picture

Status: Active » Needs review
StatusFileSize
new1.66 KB

Deprecates methods and add a change notice.

kim.pepper’s picture

StatusFileSize
new700 bytes
new1.81 KB

Avoid using the deprecated entity_delete_multiple() function.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

> Avoid using the deprecated entity_delete_multiple() function.

I don't think it's necessary to not skip deprecated calls in function that are themself deprecated, but this is also fine.

Looks good.

andypost’s picture

Probably it needs FileLegacyTest to test that deprecated functions still works and trigger expected deprecation messages

kim.pepper’s picture

FileLegacyTest extends \Drupal\Tests\field\Kernel\FieldKernelTestBase so it seems a bit weird to be putting this stuff there.

If #2244513: Move the unmanaged file APIs to the file_system service (file.inc) gets in before this, we can use Drupal\Tests\Core\File\FileSystemDeprecationTest or we can move all deprecation tests in that issue to \Drupal\Tests\file\Kernel\FileLegacyTest?

andypost’s picture

I think Drupal\Tests\Core\File\FileSystemDeprecationTest is good one, so it could be introduced here and extended in subissues of main conversion

kim.pepper’s picture

Added FileSystemDeprecationTest as per #7

berdir’s picture

Status: Reviewed & tested by the community » Needs work

> FileLegacyTest extends \Drupal\Tests\field\Kernel\FieldKernelTestBase so it seems a bit weird to be putting this stuff there.

I don't think there is a reason for that.

It's a very new test that I copied from \Drupal\Tests\file\Kernel\FileItemTest and didn't update the parent. You can likely just change that, or we can change that elsewhere.

It IMHO makes much more sense there because that's about file entity legacy things. those file functions should never have been in file.inc anyway, they have nothing to do with the FileSystem service.

mile23’s picture

Drupal\Tests\Core\File\FileSystemDeprecationTest already exists as of #3021458: Properly deprecate drupal_move_uploaded_file() but it's in the wrong place since it's a kernel test.

Please move it to a kernel-flavored namespace and update it there...

mile23’s picture

Status: Needs work » Needs review
StatusFileSize
new4.48 KB

Re-rolled and moved the test.

Status: Needs review » Needs work

The last submitted patch, 11: 3021654_11.patch, failed testing. View results

berdir’s picture

FileSystemDeprecationTest is Drupal\Tests\Core, the functions we are deprecating are in file.module, I still think FileLegacyTest is the best place for this, we just have to fix the parent.

mile23’s picture

Status: Needs work » Needs review
StatusFileSize
new3.05 KB
new4.28 KB

Re: #13: Yes indeedy the deprecation favors the file module, and uses its file entity storage to perform deletions. So these tests are moved there.

That leaves the misplaced Drupal\Tests\Core\File\FileSystemDeprecationTest which is still annoying but can't be piggy-backed onto this issue. Sigh. :-)

This patch reverts FileSystemDeprecationTest and moves the tests from #8 to Drupal\Tests\file\Kernel\FileLegacyTest. Also a minor doc fix.

And the follow-up: #3030359: FileSystemDeprecationTest in the wrong place since it's a kernel test

berdir’s picture

Component: file system » file.module
Status: Needs review » Reviewed & tested by the community
Issue tags: -Kill includes, -API clean-up +@deprecated

Looks good, #3028657: Properly deprecate entity_load_multiple() kind of set a standard to deprecate all *_x_multiple() functions at once, not sure if we should do that here as well. many don't exist anymore already, user_delete() (+ multiple) still exists, and quite a few calls to entity_delete_multiple(), so maybe better to them separately.

Setting to RTBC to get feedback on that.

Also removing a bunch of tags as this is not actually about include files.

berdir’s picture

Issue tags: +Kill includes

Oh, but they they actually are in there, just realized again why I specifically suggested to create this issue. That's messed up :)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 14: 3021654_14.patch, failed testing. View results

mile23’s picture

Status: Needs work » Needs review
StatusFileSize
new3.03 KB

Rerolled after #3028657: Properly deprecate entity_load_multiple() and #3030359: FileSystemDeprecationTest in the wrong place since it's a kernel test

Re: #15: If you test all of the deprecated functions at once, then you have to expect multiple deprecations at the same time. It's almost a style thing in these cases, but it's better to have the deprecations isolated per test method.

berdir’s picture

Misunderstanding I think, what I meant is that the other issue deprecated entity_load_multiple(), user_load_multiple(), node_load_multiple() in a single issue, each with its own dedicated legacy/deprecation test. That's what I was wondering, if we should expand this for the other delete functions too.

That said, we we should probably do something similar to \Drupal\Tests\file\Kernel\FileLegacyTest::testEntityLegacyCode() and create an actual file entity that we then delete, e.g. your test would pass if it would not actually pass the correct arguments to $storage->delete()?

mile23’s picture

StatusFileSize
new3.75 KB
new1.81 KB

I see what you mean... There doesn't seem to be any other test of whether these functions actually do the work they say they'll do.

berdir’s picture

Yeah, also #2723593: Properly deprecate entity_load() and friends extends the existing test methods for many entity types, so wondering if this should follow that pattern, then you already have the test entity that you then can delete again.

berdir’s picture

Status: Needs review » Needs work

That issue is in, which likely means this conflicts again on changes there, so I'd suggest to add these two function tests also in there.

mile23’s picture

Status: Needs work » Needs review
StatusFileSize
new3.77 KB

Reroll.

kim.pepper’s picture

+++ b/core/includes/file.inc
@@ -833,14 +839,22 @@ function file_delete($fid) {
+  $controller = \Drupal::entityTypeManager()->getStorage('file');
...
+  $controller->delete($entities);

Why not call this variable 'storage'? Makes it clearer to me.

berdir’s picture

Status: Needs review » Needs work

yes, that's definitely wrong, it was also not merged into the existing entity legacy test method, which I think would make sense with the generic name. it has multiple @expectedDeprecation now already.

mile23’s picture

Status: Needs work » Needs review
StatusFileSize
new4.21 KB
new4.31 KB

Addresses #21 and #24.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Works for me :)

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 8d0bc44 and pushed to 8.7.x. Thanks!

  • catch committed 8d0bc44 on 8.7.x
    Issue #3021654 by Mile23, kim.pepper, Berdir, andypost: Deprecate...

Status: Fixed » Closed (fixed)

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