diff --git a/core/modules/history/history.module b/core/modules/history/history.module old mode 100644 new mode 100755 index a3842fc..b798263 --- a/core/modules/history/history.module +++ b/core/modules/history/history.module @@ -8,7 +8,6 @@ * - Generic helper for _forum_user_last_visit() + history_read(). * - Generic helper for node_mark(). */ - use Drupal\Core\Entity\EntityInterface; /** @@ -25,8 +24,8 @@ function history_help($path, $arg) { switch ($path) { case 'admin/help#history': - $output = '

' . t('About') . '

'; - $output .= '

' . t('The History module keeps track of which content a user has read. Its data is available through the Views module. The History module marks content as new or updated depending on the last time the user viewed that content. It also provides a filter to Views to show new or updated content. History records older than one month will be removed during cron. This means that content older than one month will always be considered read. The module does not provide a user interface. For more information, see the online documentation for the History module.', array('!views-help' => \Drupal::url('help.page', array ('name' => 'views')), '!url' => 'https://drupal.org/documentation/modules/history')) . '

'; + $output = '

' . t('About') . '

'; + $output .= '

' . t('The History module keeps track of which content a user has read. Its data is available through the Views module. The History module marks content as new or updated depending on the last time the user viewed that content. It also provides a filter to Views to show new or updated content. History records older than one month will be removed during cron. This means that content older than one month will always be considered read. The module does not provide a user interface. For more information, see the online documentation for the History module.', array('!views-help' => \Drupal::url('help.page', array('name' => 'views')), '!url' => 'https://drupal.org/documentation/modules/history')) . '

'; return $output; } } @@ -66,8 +65,7 @@ function history_read_multiple($nids) { foreach ($nids as $nid) { if (isset($history[$nid])) { $return[$nid] = $history[$nid]; - } - else { + } else { // Initialize value if current user has not viewed the node. $nodes_to_read[$nid] = 0; } @@ -78,9 +76,9 @@ function history_read_multiple($nids) { } $result = db_query('SELECT nid, timestamp FROM {history} WHERE uid = :uid AND nid IN(:nids)', array( - ':uid' => \Drupal::currentUser()->id(), - ':nids' => array_keys($nodes_to_read), - )); + ':uid' => \Drupal::currentUser()->id(), + ':nids' => array_keys($nodes_to_read), + )); foreach ($result as $row) { $nodes_to_read[$row->nid] = (int) $row->timestamp; } @@ -107,12 +105,12 @@ function history_write($nid, $account = NULL) { if ($account->isAuthenticated()) { db_merge('history') - ->key(array( - 'uid' => $account->id(), - 'nid' => $nid, - )) - ->fields(array('timestamp' => REQUEST_TIME)) - ->execute(); + ->key(array( + 'uid' => $account->id(), + 'nid' => $nid, + )) + ->fields(array('timestamp' => REQUEST_TIME)) + ->execute(); // Update static cache. $history = &drupal_static('history_read_multiple', array()); $history[$nid] = REQUEST_TIME; @@ -124,8 +122,8 @@ function history_write($nid, $account = NULL) { */ function history_cron() { db_delete('history') - ->condition('timestamp', HISTORY_READ_LIMIT, '<') - ->execute(); + ->condition('timestamp', HISTORY_READ_LIMIT, '<') + ->execute(); } /** @@ -133,8 +131,8 @@ function history_cron() { */ function history_node_delete(EntityInterface $node) { db_delete('history') - ->condition('nid', $node->id()) - ->execute(); + ->condition('nid', $node->id()) + ->execute(); } /** @@ -144,8 +142,8 @@ function history_user_cancel($edit, $account, $method) { switch ($method) { case 'user_cancel_reassign': db_delete('history') - ->condition('uid', $account->id()) - ->execute(); + ->condition('uid', $account->id()) + ->execute(); break; } } @@ -155,8 +153,8 @@ function history_user_cancel($edit, $account, $method) { */ function history_user_delete($account) { db_delete('history') - ->condition('uid', $account->id()) - ->execute(); + ->condition('uid', $account->id()) + ->execute(); } /** @@ -164,17 +162,17 @@ function history_user_delete($account) { */ function history_library_info() { $libraries['drupal.history'] = array( - 'title' => 'History', - 'version' => \Drupal::VERSION, - 'js' => array( - drupal_get_path('module', 'history') . '/js/history.js' => array(), - ), - 'dependencies' => array( - array('system', 'jquery'), - array('system', 'drupalSettings'), - array('system', 'drupal'), - array('system', 'drupal.ajax'), - ), + 'title' => 'History', + 'version' => \Drupal::VERSION, + 'js' => array( + drupal_get_path('module', 'history') . '/js/history.js' => array(), + ), + 'dependencies' => array( + array('system', 'jquery'), + array('system', 'drupalSettings'), + array('system', 'drupal'), + array('system', 'drupal.ajax'), + ), ); return $libraries;