Problem/Motivation

REQUEST_TIME constant was deprecated in #2717207: Add a time service to provide consistent interaction with time()/microtime() and superglobals, but there are 6 (5 in cron_example and 1 in render_example) usages in examples module.

Proposed resolution

Replace the constant with \Drupal::time()->getRequestTime()

Remaining tasks

- Write the patch

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

valthebald created an issue. See original summary.

Lal_’s picture

Status: Active » Needs review
FileSize
3.05 KB
andypost’s picture

Status: Needs review » Needs work

Controller and form class should use to inject this service

adadykina’s picture

FileSize
6.07 KB

Added dependency injections

andypost’s picture

Status: Needs work » Needs review
FileSize
6.31 KB
5.38 KB

Here's a clean-up for last patch, I'd say RTBC
- do not call for time inside of loops
- RenderExampleController using static method for lazy builder so no way to use DI here
- fix docs

@adadykina thanks for the patch, confirmed your account

jungle’s picture

Status: Needs review » Postponed (maintainer needs more info)

I guess this is fixed already

jungle’s picture

Version: 8.x-1.x-dev » 3.x-dev

The default branch is 3.x-dev now

crifi’s picture

Status: Postponed (maintainer needs more info) » Needs review

The REQUEST_TIME constants are still in the 3.x branch.

valthebald’s picture

Rerolled the patch from #5, given that now modules are in a subfolder

  • valthebald committed d340009 on 3.x
    Issue #3067769 by andypost, valthebald, Lal_, adadykina: Replace usage...
valthebald’s picture

Status: Needs review » Fixed

Committed to 3.x, thanks everyone!

Status: Fixed » Closed (fixed)

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