diff --git a/core/lib/Drupal/Component/Datetime/TimeInterface.php b/core/lib/Drupal/Component/Datetime/TimeInterface.php index cedea4fe80dae87722bf3d16d49e78ec93f69b54..9941208a48b90398463f76fd8bbff212daacfe6d 100644 --- a/core/lib/Drupal/Component/Datetime/TimeInterface.php +++ b/core/lib/Drupal/Component/Datetime/TimeInterface.php @@ -20,7 +20,6 @@ interface TimeInterface { * This method can replace instances of * @code * $request_time = $_SERVER['REQUEST_TIME']; - * $request_time = REQUEST_TIME; * $request_time = $requestStack->getCurrentRequest()->server->get('REQUEST_TIME'); * $request_time = $request->server->get('REQUEST_TIME'); * @endcode diff --git a/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php b/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php index d5b2191aa8c52434b4b6b305240f16107c56c7a3..6c1ec18a4b0114f823182ae61d994dd9b4013cf0 100644 --- a/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php +++ b/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php @@ -76,7 +76,7 @@ public function render(array $js_assets) { // A dummy query-string is added to filenames, to gain control over // browser-caching. The string changes on every update or full cache // flush, forcing browsers to load a new copy of the files, as the - // URL changed. Files that should not be cached get REQUEST_TIME as + // URL changed. Files that should not be cached get the request time as a // query-string instead, to enforce reload on every page request. $default_query_string = $this->assetQueryString->get(); diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php index c6c3ec872b8121c71651406f2ec2579373c3d188..f3c6e1ae9c4fd1ee4989db66020fed8253fd0861 100644 --- a/core/lib/Drupal/Core/Entity/entity.api.php +++ b/core/lib/Drupal/Core/Entity/entity.api.php @@ -572,7 +572,7 @@ * @code * $fids = Drupal::entityQuery('file') * ->condition('status', \Drupal\file\FileInterface::STATUS_PERMANENT, '<>') - * ->condition('changed', REQUEST_TIME - $age, '<') + * ->condition('changed', \Drupal::time()->getRequestTime() - $age, '<') * ->range(0, 100) * ->execute(); * $files = $storage->loadMultiple($fids); @@ -1176,8 +1176,8 @@ function hook_entity_insert(\Drupal\Core\Entity\EntityInterface $entity) { ->fields([ 'type' => $entity->getEntityTypeId(), 'id' => $entity->id(), - 'created' => REQUEST_TIME, - 'updated' => REQUEST_TIME, + 'created' => \Drupal::time()->getRequestTime(), + 'updated' => \Drupal::time()->getRequestTime(), ]) ->execute(); } @@ -1199,8 +1199,8 @@ function hook_ENTITY_TYPE_insert(\Drupal\Core\Entity\EntityInterface $entity) { \Drupal::database()->insert('example_entity') ->fields([ 'id' => $entity->id(), - 'created' => REQUEST_TIME, - 'updated' => REQUEST_TIME, + 'created' => \Drupal::time()->getRequestTime(), + 'updated' => \Drupal::time()->getRequestTime(), ]) ->execute(); } @@ -1222,7 +1222,7 @@ function hook_entity_update(\Drupal\Core\Entity\EntityInterface $entity) { // Update the entity's entry in a fictional table of all entities. \Drupal::database()->update('example_entity') ->fields([ - 'updated' => REQUEST_TIME, + 'updated' => \Drupal::time()->getRequestTime(), ]) ->condition('type', $entity->getEntityTypeId()) ->condition('id', $entity->id()) @@ -1246,7 +1246,7 @@ function hook_ENTITY_TYPE_update(\Drupal\Core\Entity\EntityInterface $entity) { // Update the entity's entry in a fictional table of this type of entity. \Drupal::database()->update('example_entity') ->fields([ - 'updated' => REQUEST_TIME, + 'updated' => \Drupal::time()->getRequestTime(), ]) ->condition('id', $entity->id()) ->execute(); diff --git a/core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php b/core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php index 16bf30be17680ebf0ee3bc90c8e6568ff163fe0b..9813c41e3ab91b028b7473b375cc8f5a127020ec 100644 --- a/core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php +++ b/core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php @@ -42,7 +42,8 @@ public function testUpdateDeleteFileIfStale() { $this->assertFalse($deleted); $this->assertFileExists($file_path); - // Set the maximum age to a number smaller than REQUEST_TIME - $filectime. + // Set the maximum age to a number smaller than + // \Drupal::time()->getRequestTime() - $filectime. $this->config('system.file') ->set('temporary_maximum_age', -100000) ->save();