Skip to content
Snippets Groups Projects
Commit 985b057b authored by catch's avatar catch
Browse files

Issue #3422973 by acbramley, dww, andypost: Replace remaining mentions of REQUEST_TIME in comments

parent 21583269
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,6 @@ interface TimeInterface { ...@@ -20,7 +20,6 @@ interface TimeInterface {
* This method can replace instances of * This method can replace instances of
* @code * @code
* $request_time = $_SERVER['REQUEST_TIME']; * $request_time = $_SERVER['REQUEST_TIME'];
* $request_time = REQUEST_TIME;
* $request_time = $requestStack->getCurrentRequest()->server->get('REQUEST_TIME'); * $request_time = $requestStack->getCurrentRequest()->server->get('REQUEST_TIME');
* $request_time = $request->server->get('REQUEST_TIME'); * $request_time = $request->server->get('REQUEST_TIME');
* @endcode * @endcode
......
...@@ -76,7 +76,7 @@ public function render(array $js_assets) { ...@@ -76,7 +76,7 @@ public function render(array $js_assets) {
// A dummy query-string is added to filenames, to gain control over // A dummy query-string is added to filenames, to gain control over
// browser-caching. The string changes on every update or full cache // browser-caching. The string changes on every update or full cache
// flush, forcing browsers to load a new copy of the files, as the // 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. // query-string instead, to enforce reload on every page request.
$default_query_string = $this->assetQueryString->get(); $default_query_string = $this->assetQueryString->get();
......
...@@ -572,7 +572,7 @@ ...@@ -572,7 +572,7 @@
* @code * @code
* $fids = Drupal::entityQuery('file') * $fids = Drupal::entityQuery('file')
* ->condition('status', \Drupal\file\FileInterface::STATUS_PERMANENT, '<>') * ->condition('status', \Drupal\file\FileInterface::STATUS_PERMANENT, '<>')
* ->condition('changed', REQUEST_TIME - $age, '<') * ->condition('changed', \Drupal::time()->getRequestTime() - $age, '<')
* ->range(0, 100) * ->range(0, 100)
* ->execute(); * ->execute();
* $files = $storage->loadMultiple($fids); * $files = $storage->loadMultiple($fids);
...@@ -1176,8 +1176,8 @@ function hook_entity_insert(\Drupal\Core\Entity\EntityInterface $entity) { ...@@ -1176,8 +1176,8 @@ function hook_entity_insert(\Drupal\Core\Entity\EntityInterface $entity) {
->fields([ ->fields([
'type' => $entity->getEntityTypeId(), 'type' => $entity->getEntityTypeId(),
'id' => $entity->id(), 'id' => $entity->id(),
'created' => REQUEST_TIME, 'created' => \Drupal::time()->getRequestTime(),
'updated' => REQUEST_TIME, 'updated' => \Drupal::time()->getRequestTime(),
]) ])
->execute(); ->execute();
} }
...@@ -1199,8 +1199,8 @@ function hook_ENTITY_TYPE_insert(\Drupal\Core\Entity\EntityInterface $entity) { ...@@ -1199,8 +1199,8 @@ function hook_ENTITY_TYPE_insert(\Drupal\Core\Entity\EntityInterface $entity) {
\Drupal::database()->insert('example_entity') \Drupal::database()->insert('example_entity')
->fields([ ->fields([
'id' => $entity->id(), 'id' => $entity->id(),
'created' => REQUEST_TIME, 'created' => \Drupal::time()->getRequestTime(),
'updated' => REQUEST_TIME, 'updated' => \Drupal::time()->getRequestTime(),
]) ])
->execute(); ->execute();
} }
...@@ -1222,7 +1222,7 @@ function hook_entity_update(\Drupal\Core\Entity\EntityInterface $entity) { ...@@ -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. // Update the entity's entry in a fictional table of all entities.
\Drupal::database()->update('example_entity') \Drupal::database()->update('example_entity')
->fields([ ->fields([
'updated' => REQUEST_TIME, 'updated' => \Drupal::time()->getRequestTime(),
]) ])
->condition('type', $entity->getEntityTypeId()) ->condition('type', $entity->getEntityTypeId())
->condition('id', $entity->id()) ->condition('id', $entity->id())
...@@ -1246,7 +1246,7 @@ function hook_ENTITY_TYPE_update(\Drupal\Core\Entity\EntityInterface $entity) { ...@@ -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. // Update the entity's entry in a fictional table of this type of entity.
\Drupal::database()->update('example_entity') \Drupal::database()->update('example_entity')
->fields([ ->fields([
'updated' => REQUEST_TIME, 'updated' => \Drupal::time()->getRequestTime(),
]) ])
->condition('id', $entity->id()) ->condition('id', $entity->id())
->execute(); ->execute();
......
...@@ -42,7 +42,8 @@ public function testUpdateDeleteFileIfStale() { ...@@ -42,7 +42,8 @@ public function testUpdateDeleteFileIfStale() {
$this->assertFalse($deleted); $this->assertFalse($deleted);
$this->assertFileExists($file_path); $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') $this->config('system.file')
->set('temporary_maximum_age', -100000) ->set('temporary_maximum_age', -100000)
->save(); ->save();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment