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.
According to #2047951: [META] Remove calls to deprecated global $user and $GLOBALS['user'] we correct this module.
Comments
Comment #1
victor-shelepen CreditAttribution: victor-shelepen commentedFixed. It works by manual testing. I see the language module also has problems with tests.
Comment #2
SpleshkaComment #3
SpleshkaName is not a tag.
Comment #4
Gábor HojtsyThis looks very straightforward and all are in global functions, so global invocation of Drupal::* is appropriate.
Comment #5
webchickThis patch and all of its ilk are postponed on at least a couple of upstream issues right now. See the referenced meta issue.
Comment #6
Gábor Hojtsy#2062151: Create a current user service to ensure that current account is always available landed. This should now use the current_user service.
Comment #7
m1r1k CreditAttribution: m1r1k commentedRerolling after #2062151: Create a current user service to ensure that current account is always available. Also depends on #2076411: Remove the request scope from the current user service
Comment #8
m1r1k CreditAttribution: m1r1k commentedfor easier tracking
Comment #9
Gábor HojtsyIs Drupal::currentUser() the best current way to access this? Also, I think Drupal:: should be \Drupal:: no?
Comment #10
Gábor HojtsyComment #11
m1r1k CreditAttribution: m1r1k commentedDrupal::currentUser() is an official way to get current userSession object now, also \Drupal:: is used on OO code, not in functional as I know. Did I miss something?
Comment #12
Gábor HojtsyRight, superb, let's get this in then!
Comment #13
alexpottLet's postpone this on #2076411: Remove the request scope from the current user service as the patch includes it :)
Comment #14
m1r1k CreditAttribution: m1r1k commentedFor easy tracking
Comment #15
catchComment #16
Gábor Hojtsy#7: language-remove-global-user-from-language-module-2061929-7.patch queued for re-testing.
Comment #18
joelpittet.
Comment #19
robmc CreditAttribution: robmc commentedRe-roll
Comment #20
robmc CreditAttribution: robmc commentedChange status
Comment #21
Gábor HojtsyLooks simple and good.
Comment #22
joelpittetWe should prefix Drupal as \Drupal for this: #2053489: Standardize on \Drupal throughout core ?
Comment #23
webchickYep.
Comment #24
InternetDevels CreditAttribution: InternetDevels commentedComment #25
Gábor HojtsyComment #26
alexpottCommitted f5a948f and pushed to 8.x. Thanks!