Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3174996
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3174996
Commits
f97a92d5
Commit
f97a92d5
authored
15 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#667152
by catch: optimize node_tag_new().
parent
4a10bf28
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/node/node.module
+21
-11
21 additions, 11 deletions
modules/node/node.module
with
21 additions
and
11 deletions
modules/node/node.module
+
21
−
11
View file @
f97a92d5
...
...
@@ -302,19 +302,29 @@ function theme_node_list($variables) {
/**
* Update the 'last viewed' timestamp of the specified node for current user.
*
* @param $node
* A node object.
*/
function
node_tag_new
(
$n
id
)
{
function
node_tag_new
(
$n
ode
)
{
global
$user
;
if
(
$user
->
uid
)
{
db_merge
(
'history'
)
->
key
(
array
(
'uid'
=>
$user
->
uid
,
'nid'
=>
$nid
,
))
->
fields
(
array
(
'timestamp'
=>
REQUEST_TIME
))
->
execute
();
}
// To avoid multiple inserts if a user repeatedly requests the same page,
// only update history if the node has been updated, a new comment has been
// posted, or more than thirty minutes has elapsed since the last request.
$last_viewed
=
node_last_viewed
(
$node
->
nid
);
if
(
!
$last_viewed
||
(
$last_viewed
<=
$node
->
changed
||
$last_viewed
<=
$node
->
last_comment_timestamp
)
||
$last_viewed
<=
REQUEST_TIME
-
variable_get
(
'node_last_viewed_threshold'
,
1800
))
{
db_merge
(
'history'
)
->
key
(
array
(
'uid'
=>
$user
->
uid
,
'nid'
=>
$node
->
nid
,
))
->
fields
(
array
(
'timestamp'
=>
REQUEST_TIME
))
->
execute
();
}
}
}
/**
...
...
@@ -1315,7 +1325,7 @@ function node_show($node, $message = FALSE) {
}
// Update the history table, stating that this user viewed this node.
node_tag_new
(
$node
->
nid
);
node_tag_new
(
$node
);
// For markup consistency with other pages, use node_view_multiple() rather than node_view().
return
node_view_multiple
(
array
(
$node
->
nid
=>
$node
),
'full'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment