Mercurial > hg > cmmr2012-drupal-site
diff core/modules/history/history.module @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
line wrap: on
line diff
--- a/core/modules/history/history.module Thu Feb 28 13:11:55 2019 +0000 +++ b/core/modules/history/history.module Thu May 09 15:34:47 2019 +0100 @@ -9,6 +9,7 @@ * - Generic helper for node_mark(). */ +use Drupal\Core\Url; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Routing\RouteMatchInterface; @@ -29,7 +30,7 @@ switch ($route_name) { case 'help.page.history': $output = '<h3>' . t('About') . '</h3>'; - $output .= '<p>' . t('The History module keeps track of which content a user has read. It marks content as <em>new</em> or <em>updated</em> depending on the last time the user viewed it. History records that are older than one month are removed during cron, which means that content older than one month is always considered <em>read</em>. The History module does not have a user interface but it provides a filter to <a href=":views-help">Views</a> to show new or updated content. For more information, see the <a href=":url">online documentation for the History module</a>.', [':views-help' => (\Drupal::moduleHandler()->moduleExists('views')) ? \Drupal::url('help.page', ['name' => 'views']) : '#', ':url' => 'https://www.drupal.org/documentation/modules/history']) . '</p>'; + $output .= '<p>' . t('The History module keeps track of which content a user has read. It marks content as <em>new</em> or <em>updated</em> depending on the last time the user viewed it. History records that are older than one month are removed during cron, which means that content older than one month is always considered <em>read</em>. The History module does not have a user interface but it provides a filter to <a href=":views-help">Views</a> to show new or updated content. For more information, see the <a href=":url">online documentation for the History module</a>.', [':views-help' => (\Drupal::moduleHandler()->moduleExists('views')) ? Url::fromRoute('help.page', ['name' => 'views'])->toString() : '#', ':url' => 'https://www.drupal.org/documentation/modules/history']) . '</p>'; return $output; } } @@ -108,7 +109,7 @@ } if ($account->isAuthenticated()) { - db_merge('history') + \Drupal::database()->merge('history') ->keys([ 'uid' => $account->id(), 'nid' => $nid, @@ -125,7 +126,7 @@ * Implements hook_cron(). */ function history_cron() { - db_delete('history') + \Drupal::database()->delete('history') ->condition('timestamp', HISTORY_READ_LIMIT, '<') ->execute(); } @@ -152,7 +153,7 @@ * Implements hook_ENTITY_TYPE_delete() for node entities. */ function history_node_delete(EntityInterface $node) { - db_delete('history') + \Drupal::database()->delete('history') ->condition('nid', $node->id()) ->execute(); } @@ -163,7 +164,7 @@ function history_user_cancel($edit, UserInterface $account, $method) { switch ($method) { case 'user_cancel_reassign': - db_delete('history') + \Drupal::database()->delete('history') ->condition('uid', $account->id()) ->execute(); break; @@ -174,7 +175,7 @@ * Implements hook_ENTITY_TYPE_delete() for user entities. */ function history_user_delete($account) { - db_delete('history') + \Drupal::database()->delete('history') ->condition('uid', $account->id()) ->execute(); }