Commit 06b44611 authored by Alexander Hass's avatar Alexander Hass
Browse files

Issue #3026907 by thalles: Replace deprecated REQUEST_TIME

parent 6153d659
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -443,11 +443,12 @@ function google_analytics_user_profile_form_submit($form, FormStateInterface $fo
 */
function google_analytics_cron() {
  $config = \Drupal::config('google_analytics.settings');
  $request_time = \Drupal::time()->getRequestTime();

  // Regenerate the tracking code file every day.
  if (REQUEST_TIME - \Drupal::state()->get('google_analytics.last_cache') >= 86400 && $config->get('cache')) {
  if ($request_time - \Drupal::state()->get('google_analytics.last_cache') >= 86400 && $config->get('cache')) {
    _google_analytics_cache('https://www.google-analytics.com/analytics.js', TRUE);
    \Drupal::state()->set('google_analytics.last_cache', REQUEST_TIME);
    \Drupal::state()->set('google_analytics.last_cache', $request_time);
  }
}