diff --git a/core/modules/comment/src/CommentManager.php b/core/modules/comment/src/CommentManager.php index 47fe473725..21f438217e 100644 --- a/core/modules/comment/src/CommentManager.php +++ b/core/modules/comment/src/CommentManager.php @@ -258,7 +258,7 @@ public function getCountNewComments(EntityInterface $entity, $field_name = NULL, } $history_config = $this->configFactory->get('history.settings'); - $history_read_limit = $this->time->getRequestTime() - $history_config->get('history_mark_read'); + $history_read_limit = $this->time->getRequestTime() - $history_config->get('mark_read'); $timestamp = ($timestamp > $history_read_limit ? $timestamp : $history_read_limit); // Use the timestamp to retrieve the number of new comments. diff --git a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php index e5aea8931b..a362ab2241 100644 --- a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php +++ b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php @@ -196,7 +196,7 @@ public function preRender(&$values) { if ($nids) { $history_config = $this->configFactory->get('history.settings'); - $history_read_limit = $this->time->getRequestTime() - $history_config->get('history_mark_read'); + $history_read_limit = $this->time->getRequestTime() - $history_config->get('mark_read'); $result = $this->database->query("SELECT n.nid, COUNT(c.cid) as num_comments FROM {node} n INNER JOIN {comment_field_data} c ON n.nid = c.entity_id AND c.entity_type = 'node' AND c.default_langcode = 1 LEFT JOIN {history} h ON h.nid = n.nid AND h.uid = :h_uid WHERE n.nid IN ( :nids[] ) AND c.changed > GREATEST(COALESCE(h.timestamp, :timestamp1), :timestamp2) AND c.status = :status GROUP BY n.nid", [ diff --git a/core/modules/forum/src/ForumManager.php b/core/modules/forum/src/ForumManager.php index 86796c1186..4d21c37f35 100644 --- a/core/modules/forum/src/ForumManager.php +++ b/core/modules/forum/src/ForumManager.php @@ -331,7 +331,7 @@ protected function getTopicOrder($sortby) { protected function lastVisit($nid, AccountInterface $account) { $history_read_limit = $this->configFactory ->get('history.settings') - ->get('history_mark_read'); + ->get('mark_read'); if (empty($this->history[$nid])) { $result = $this->connection->select('history', 'h') ->fields('h', ['nid', 'timestamp']) @@ -501,7 +501,7 @@ public function checkNodeType(NodeInterface $node) { public function unreadTopics($term, $uid) { $history_read_limit = $this->configFactory ->get('history.settings') - ->get('history_mark_read'); + ->get('mark_read'); $query = $this->connection->select('node_field_data', 'n'); $query->join('forum', 'f', 'n.vid = f.vid AND f.tid = :tid', [':tid' => $term]); $query->leftJoin('history', 'h', 'n.nid = h.nid AND h.uid = :uid', [':uid' => $uid]); diff --git a/core/modules/history/config/install/history.settings.yml b/core/modules/history/config/install/history.settings.yml index 3b72c3c63d..7ff3957e2b 100644 --- a/core/modules/history/config/install/history.settings.yml +++ b/core/modules/history/config/install/history.settings.yml @@ -2,4 +2,4 @@ # # 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. -history_mark_read: 2592000 +mark_read: 2592000 diff --git a/core/modules/history/config/schema/history.settings.schema.yml b/core/modules/history/config/schema/history.settings.schema.yml index 530dddd111..16c935ebfd 100644 --- a/core/modules/history/config/schema/history.settings.schema.yml +++ b/core/modules/history/config/schema/history.settings.schema.yml @@ -2,6 +2,6 @@ history.settings: type: config_object label: 'History settings' mapping: - history_mark_read: + mark_read: type: integer label: 'Entities changed within this time period may be marked as new.' diff --git a/core/modules/history/history.module b/core/modules/history/history.module index a2355c6561..2b0e3f0411 100644 --- a/core/modules/history/history.module +++ b/core/modules/history/history.module @@ -118,7 +118,7 @@ function history_write($nid, $account = NULL) { * Implements hook_cron(). */ function history_cron() { - $history_read_limit = \Drupal::time()->getRequestTime() - \Drupal::config('history.settings')->get('history_mark_read'); + $history_read_limit = \Drupal::time()->getRequestTime() - \Drupal::config('history.settings')->get('mark_read'); \Drupal::database()->delete('history') ->condition('timestamp', $history_read_limit, '<') ->execute(); diff --git a/core/modules/history/history.post_update.php b/core/modules/history/history.post_update.php index 0b024d8a18..c36f9ddc74 100644 --- a/core/modules/history/history.post_update.php +++ b/core/modules/history/history.post_update.php @@ -10,5 +10,5 @@ */ function history_post_update_install_config(&$sandbox = NULL) { $config = \Drupal::configFactory()->getEditable('history.settings'); - $config->set('history_mark_read', 2592000)->save(TRUE); + $config->set('mark_read', 2592000)->save(TRUE); } diff --git a/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php index e655a8666e..05a55c1eb4 100644 --- a/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php +++ b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php @@ -144,7 +144,7 @@ public function render(ResultRow $values) { $last_comment = \Drupal::moduleHandler()->moduleExists('comment') && !empty($this->options['comments']) ? $this->getValue($values, 'last_comment') : 0; $history_config = $this->configFactory->get('history.settings'); - $history_read_limit = $this->time->getRequestTime() - $history_config->get('history_mark_read'); + $history_read_limit = $this->time->getRequestTime() - $history_config->get('mark_read'); if (!$last_read && $changed > $history_read_limit) { $mark = MARK_NEW; } diff --git a/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php b/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php index 488f7f5856..e5c2327bad 100644 --- a/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php +++ b/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php @@ -133,7 +133,7 @@ public function query() { // Hey, Drupal kills old history, so nodes that haven't been updated // since history_cron() are bzzzzzzzt outta here! - $limit = $this->time->getRequestTime() - $this->configFactory->get('history.settings')->get('history_mark_read'); + $limit = $this->time->getRequestTime() - $this->configFactory->get('history.settings')->get('mark_read'); $this->ensureMyTable(); $field = "$this->tableAlias.$this->realField"; diff --git a/core/modules/node/node.module b/core/modules/node/node.module index a6b6b50ef7..ad52d6bd27 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -247,7 +247,7 @@ function node_title_list(StatementInterface $result, $title = NULL) { function node_mark($nid, $timestamp) { $cache = &drupal_static(__FUNCTION__, []); - $history_read_limit = REQUEST_TIME - \Drupal::config('history.settings')->get('history_mark_read'); + $history_read_limit = \Drupal::time()->getRequestTime() - \Drupal::config('history.settings')->get('mark_read'); if (\Drupal::currentUser()->isAnonymous() || !\Drupal::moduleHandler()->moduleExists('history')) { return MARK_READ;