Closed (duplicate)
Project:
Drupal core
Version:
9.1.x-dev
Component:
user.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
4 Sep 2019 at 05:35 UTC
Updated:
10 Jan 2024 at 12:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dpiInterestingly despite the comment in
\user_cancel()claiming third parties (via hooks) can modify the cancel batch......they do not get an opportunity to do cancellation in the batch. Which seems to be the case since the original patch in #8: Let users cancel their accounts. It seems the batching in this system is not particularly useful.
I wonder if it's useful to turn this system into batching or remove it entirely.
Comment #3
kim.pepperComment #4
dpiTesting how things work without batch. I imagine the tests specifically looking for batch UI to appear in browser will fail, of course.
Comment #5
dpiAlright so fails show instead of the original batch being passed around, functions like node_mass_update() are creating extra batches.
Comment #6
jibranYeah, the user module sets up a batch. It then call the cancel hooks who add their own batch sets if they want to and then after calling all the hooks user module adds its own batch set and then batch API black magic kicks in to execute all of them till it hits
_user_cancel_session_regenerate.Comment #7
andypostComment #8
dpiWork is also available as a Github branch for reviews.
Comment #10
dpiComment #11
dpiComment #12
jibranThis is a potential BC break for any implementation of
hook_batch_alterinteracting with this batch.Comment #13
jibranWe don't add
\prefix to global methods in core.Comment #14
dpiBatches are very internal-y, not sure how we handle backwards compatibility for them. I'll leave this up to maintainer to decide, but I'd imagine not serialising a user entity to be a significant advantage. Back when the code was originally written (2009), user objects were much simpler.
Fair enough. Patch addresses request.
Comment #15
jibranThanks, for addressing the feedback.
Drupal only allow UI deletion. CLI app should collect messages if the want to show them or they can ignore them as well. IMO, this new addition is not needed.
Some more
\prefixes.Comment #16
andypostAdditionally to 15.2 deprecation message should use new format https://www.drupal.org/core/deprecation#how-function
Comment #17
dpiThanks for the review!
The service specifically provides a cancelUser method, which is meant to be invoked programmatically. As a developer I expect that calling this method will not emit a series of messages I have no control over, the same as when calling most other services.
Keep in mind that log messages are always emitted, so in the use case of CLI, you can capture and re-route logger output as usual, for eventual output to IO if desirable.
Updated deprecation messages, and reformatted according to #3024461: Adopt consistent deprecation format for core and contrib deprecation messages.
-
Also fixed up deprecated _user_cancel_session_regenerate() function not calling new static callback.
Comment #18
kim.pepperHad a quick scan and had some initial feedback:
I find using verbs for interface names makes it clearer on what it does (and nouns for value objects). '
UserCancellerInterface' maybe?e.g.
$userCanceller->cancelUser()I think the naming should line up more with
cancelUser(). PerhapscancelUserProgressive()?I prefer prophecy but there is no core policy (as far as I know) on this.
Comment #21
andypostThere's another approach in #3043725: Provide a Entity Handler for user cancelation
Probably we could close this one
Comment #22
phenaproximaSince the other issue has committer buy-in on its approach, I agree. I'm going to take the initiative on this and close this out and transfer credit. I hope I'm not stepping on any toes by doing that. (Apologies if I am; my intentions are pure.)
I think we also want to look carefully through this nice patch and merge as much of the good work as we can into the other patch. I will re-post the latest patch into that issue to facilitate that.
Comment #23
phenaproximaI've transferred credit, along with the patch, to the other issue. Closing as a duplicate.
Comment #24
dpiComment #25
joe76@ commentedComment #26
aaronmchaleReverted changes made in #25.