Verified Commit a15d0efd authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3112290 by Spokje, mondrake, mpdonadio, daffie, andypost, Kristen Pol,...

Issue #3112290 by Spokje, mondrake, mpdonadio, daffie, andypost, Kristen Pol, quietone, mallezie, alexpott: Replace REQUEST_TIME in procedural code
parent e2943656
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -163,12 +163,13 @@ function aggregator_entity_extra_field_info() {
 */
function aggregator_cron() {
  $queue = \Drupal::queue('aggregator_feeds');
  $request_time = \Drupal::time()->getRequestTime();

  $ids = \Drupal::entityTypeManager()->getStorage('aggregator_feed')->getFeedIdsToRefresh();
  foreach (Feed::loadMultiple($ids) as $feed) {
    if ($queue->createItem($feed)) {
      // Add timestamp to avoid queueing item more than once.
      $feed->setQueuedTime(REQUEST_TIME);
      $feed->setQueuedTime($request_time);
      $feed->save();
    }
  }
@@ -176,7 +177,7 @@ function aggregator_cron() {
  // Delete queued timestamp after 6 hours assuming the update has failed.
  $ids = \Drupal::entityQuery('aggregator_feed')
    ->accessCheck(FALSE)
    ->condition('queued', REQUEST_TIME - (3600 * 6), '<')
    ->condition('queued', $request_time - (3600 * 6), '<')
    ->execute();

  if ($ids) {
+2 −2
Original line number Diff line number Diff line
@@ -35,9 +35,9 @@
 * Comments changed after this time may be marked new, updated, or read,
 * depending on their state for the current user. Defaults to 30 days ago.
 *
 * @todo Remove when https://www.drupal.org/node/1029708 lands.
 * @todo Remove when https://www.drupal.org/node/2006632 lands.
 */
define('COMMENT_NEW_LIMIT', REQUEST_TIME - 30 * 24 * 60 * 60);
define('COMMENT_NEW_LIMIT', ((int) $_SERVER['REQUEST_TIME']) - 30 * 24 * 60 * 60);

/**
 * Implements hook_help().
+1 −1
Original line number Diff line number Diff line
@@ -648,7 +648,7 @@ function file_cron() {
    $fids = Drupal::entityQuery('file')
      ->accessCheck(FALSE)
      ->condition('status', FileInterface::STATUS_PERMANENT, '<>')
      ->condition('changed', REQUEST_TIME - $age, '<')
      ->condition('changed', \Drupal::time()->getRequestTime() - $age, '<')
      ->range(0, 100)
      ->execute();
    $files = $file_storage->loadMultiple($fids);
+6 −3
Original line number Diff line number Diff line
@@ -20,8 +20,10 @@
 *
 * Entities changed within this time may be marked as new, updated, or read,
 * depending on their state for the current user. Defaults to 30 days ago.
 *
 * @todo Remove when https://www.drupal.org/node/2006632 lands.
 */
define('HISTORY_READ_LIMIT', REQUEST_TIME - 30 * 24 * 60 * 60);
define('HISTORY_READ_LIMIT', ((int) $_SERVER['REQUEST_TIME']) - 30 * 24 * 60 * 60);

/**
 * Implements hook_help().
@@ -109,16 +111,17 @@ function history_write($nid, $account = NULL) {
  }

  if ($account->isAuthenticated()) {
    $request_time = \Drupal::time()->getRequestTime();
    \Drupal::database()->merge('history')
      ->keys([
        'uid' => $account->id(),
        'nid' => $nid,
      ])
      ->fields(['timestamp' => REQUEST_TIME])
      ->fields(['timestamp' => $request_time])
      ->execute();
    // Update static cache.
    $history = &drupal_static('history_read_multiple', []);
    $history[$nid] = REQUEST_TIME;
    $history[$nid] = $request_time;
  }
}

+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ function template_preprocess_image_style_preview(&$variables) {
  $variables['style_name'] = $style->label();

  // Cache bypass token.
  $variables['cache_bypass'] = REQUEST_TIME;
  $variables['cache_bypass'] = \Drupal::time()->getRequestTime();

  // Sample image info.
  $sample_width = 160;
Loading