All places in core/modules/system.module should be fixed.
Replace all global $user and $GLOBALS['user']. All places in system module should be fixed (except tests see #2150869: Remove calls to deprecated global $user in system module Tests).

Files: 
CommentFileSizeAuthor
#16 system-remove-global-user-first-part-2062211-16.patch1.87 KBrych
PASSED: [[SimpleTest]]: [MySQL] 59,073 pass(es).
[ View ]
#14 system-remove-global-user-first-part-2062211-14.patch6.19 KBrych
FAILED: [[SimpleTest]]: [MySQL] 59,080 pass(es), 14 fail(s), and 0 exception(s).
[ View ]
#6 2062211-6-global-user-system.patch8.33 KBjoelpittet
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2062211-6-global-user-system.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#6 interdiff.txt6.59 KBjoelpittet
#4 system-remove-global-user-first-part-2062211-4.patch2.66 KBm1r1k
PASSED: [[SimpleTest]]: [MySQL] 58,961 pass(es).
[ View ]
#4 interdiff.txt1.89 KBm1r1k
#3 system-remove-global-user-first-part-2062211-3.patch2.65 KBm1r1k
PASSED: [[SimpleTest]]: [MySQL] 58,445 pass(es).
[ View ]
#1 system.module-2062211.patch1.44 KBdstorozhuk
FAILED: [[SimpleTest]]: [MySQL] 1,120 pass(es), 257 fail(s), and 10 exception(s).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new1.44 KB
FAILED: [[SimpleTest]]: [MySQL] 1,120 pass(es), 257 fail(s), and 10 exception(s).
[ View ]

Removed calls in functions:

  1. system_help()
  2. system_user_timezone()

Status:Needs review» Needs work

The last submitted patch, system.module-2062211.patch, failed testing.

Title:Remove calls to deprecated global $user in system moduleRemove calls to deprecated global $user in system module (first part)
Assigned:dstorozhuk» m1r1k
Status:Needs work» Needs review
StatusFileSize
new2.65 KB
PASSED: [[SimpleTest]]: [MySQL] 58,445 pass(es).
[ View ]

Here is a patch. It includes only part of changes, because almost all tests include session usages, that is not ready for current_user yet:

StatusFileSize
new1.89 KB
new2.66 KB
PASSED: [[SimpleTest]]: [MySQL] 58,961 pass(es).
[ View ]

Status:Needs review» Needs work

+++ b/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php
@@ -32,7 +32,7 @@ function testTokenReplacement() {
+    $user = $this->container->get('current_user');

Shouldn't this be $user = \Drupal::currentUser(); as well? I could be totally wrong, in that case this is ready.

Assigned:m1r1k» Unassigned
Status:Needs work» Needs review
Issue tags:-CodeSprintCIS
StatusFileSize
new6.59 KB
new8.33 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2062211-6-global-user-system.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Seems to work locally for that so i'm posting. Also there was a few more spots needing attention.

Status:Needs review» Needs work

The last submitted patch, 2062211-6-global-user-system.patch, failed testing.

Status:Needs work» Needs review

#6: 2062211-6-global-user-system.patch queued for re-testing.

Status:Needs review» Needs work

The last submitted patch, 2062211-6-global-user-system.patch, failed testing.

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, 6: 2062211-6-global-user-system.patch, failed testing.

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, 6: 2062211-6-global-user-system.patch, failed testing.

Issue summary:View changes
Status:Needs work» Needs review
StatusFileSize
new6.19 KB
FAILED: [[SimpleTest]]: [MySQL] 59,080 pass(es), 14 fail(s), and 0 exception(s).
[ View ]

The code has changed since #6 patch.

Status:Needs review» Needs work

The last submitted patch, 14: system-remove-global-user-first-part-2062211-14.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new1.87 KB
PASSED: [[SimpleTest]]: [MySQL] 59,073 pass(es).
[ View ]

Test files need global $user variable: "NOTE: The global $user variable still exists as it is necessary for certain portions of the installer and simpletest..."

Modified files:

  • system.module
  • system.api.php

@rych cool you got it green!

For the ones in test files, what can we do with them? Do they need a follow-up issue to swing around once the rest are complete or do they need to be rewritten somehow?

Issue summary:View changes
Status:Needs review» Reviewed & tested by the community
Related issues:+#2150869: Remove calls to deprecated global $user in system module Tests

Ok moved the tests conversion task to it's own issue so this one is ready to go #2150869: Remove calls to deprecated global $user in system module Tests

Status:Reviewed & tested by the community» Fixed

Committed/pushed to 8.x, thanks!

Status:Fixed» Closed (fixed)

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