Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Part of meta-issue #2002650: [meta, no patch] improve maintainability by removing unused local variables
File /core/modules/system/lib/Drupal/system/SystemConfigSubscriber.php
Line 33: Unused local variable $importList
Comment | File | Size | Author |
---|---|---|---|
#27 | 2056445.27.patch | 3.35 KB | alexpott |
#27 | 22-27-interdiff.txt | 977 bytes | alexpott |
#22 | 2056445.22.patch | 3.23 KB | alexpott |
#22 | 17-22-interdiff.patch | 521 bytes | alexpott |
#17 | 2056445.17.patch | 3.24 KB | alexpott |
Comments
Comment #1
Marcus Maihoff CreditAttribution: Marcus Maihoff commentedComment #2
Marcus Maihoff CreditAttribution: Marcus Maihoff commentedthe last update is corrupt i fixed it with interdiff...
sry it was just my fault.
Comment #3
tstoecklerLooks great, thanks for providing the interdiff. I like!
Comment #5
Marcus Maihoff CreditAttribution: Marcus Maihoff commented#2: 2056445_unuse_variables-2.patch queued for re-testing.
Comment #6
tstoecklerThat was just a bot hickup, still RTBC.
Comment #7
alexpottWe shouldn't be changing the file mode
This looks slightly more complex since $importerList is not defined.
We need to is actually fix this code :)
Comment #8
tstoecklerHmm, yeah that makes sense.
So $importList should not be removed, and instead in the if() it should be called $importList as well. This also means, however, that we're missing a test on this. Removing the Novice tag for that.
Comment #9
rahul.shindeComment #10
rahul.shindeThe variable
$importList
is required and will resolve the purpose of getting all Configuration stuff for delete. So renamed$importerList
to$importList
.Comment #11
xjmPlease combine this patch with #2080343: Remove Unused local variables from system module.Comment #12
xjmActually, looks like this one has an actual bug associated with it? If so let's add tests. Sorry for closing pre-emptively; trying to update too many issues at once. :)
Comment #13
rahul.shinde@xjm what will be the next step?
Comment #14
rahul.shinde@xjim, Can we close this as i have added changes for this in https://drupal.org/node/2080343?
Comment #15
lokapujyarahul.shinde, we should keep this separate, since this fixes a bug. The bug fix should get reviewed here before merging it in with the other unused variables.
Comment #16
lokapujyaSo, I was trying to see what test needs to be written for this. However, I don't know if this event ever gets injected. SystemConfigSubscriber has a getSubscribedEvents() function. But, I don't think the function ever gets called. Anyone know why?
Comment #17
alexpottThere is already a test for this - but it was very broken and yep the event is never fired because it is not registered.
Comment #19
farfanfelipe CreditAttribution: farfanfelipe commentedI tried to give you a hand on this one but I do not get why if the function was created to fail and it actually fails, what is the change that needs to be done here?
Comment #20
lokapujyaThis patch looks good to me. onConfigImporterValidate() now gets called and the test validates that it throws an exception when the importList is empty.
Comment #21
swentel CreditAttribution: swentel commentedWut ? :)
Comment #22
alexpott@swentel thanks for the review!
Comment #23
swentel CreditAttribution: swentel commentedGreat, RTBC if green.
Comment #25
catchIf it's bailing out now, then it's not actually going to delete all the active configuration. Could we say something like 'This import is empty and if applied would delete all of your configuration, so has been rejected.' or similar?
Comment #26
catchComment #27
alexpottMakes sense.
Comment #28
swentel CreditAttribution: swentel commentedComment #29
catchOK I still feel like that message doesn't quite cover it, but can't think of anything better either and presumably this won't happen often, so committed/pushed to 8.x, thanks!