Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
672295bb
Commit
672295bb
authored
Jan 14, 2014
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2054993
by andypost: Remove (untested, unused, broken) comment_get_recent().
parent
9b132b5e
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/comment/comment.module
+0
-37
0 additions, 37 deletions
core/modules/comment/comment.module
with
0 additions
and
37 deletions
core/modules/comment/comment.module
+
0
−
37
View file @
672295bb
...
...
@@ -304,43 +304,6 @@ function comment_permission() {
);
}
/**
* Finds the most recent comments that are available to the current user.
*
* @param int $number
* (optional) The maximum number of comments to find. Defaults to 10.
*
* @return \Drupal\comment\CommentInterface[]|array
* An array of comment objects or an empty array if there are no recent
* comments visible to the current user.
*/
function
comment_get_recent
(
$number
=
10
)
{
$query
=
db_select
(
'comment'
,
'c'
);
$query
->
addMetaData
(
'base_table'
,
'comment'
);
$query
->
fields
(
'c'
)
->
condition
(
'c.status'
,
CommentInterface
::
PUBLISHED
);
if
(
\Drupal
::
moduleHandler
()
->
moduleExists
(
'node'
))
{
// Special case to filter by published content.
$query
->
innerJoin
(
'node_field_data'
,
'n'
,
"n.nid = c.entity_id AND c.entity_type = 'node'"
);
$query
->
addTag
(
'node_access'
);
// @todo This should be actually filtering on the desired node status field
// language and just fall back to the default language.
$query
->
condition
(
'n.status'
,
NODE_PUBLISHED
)
->
condition
(
'n.default_langcode'
,
1
);
}
$comments
=
$query
->
orderBy
(
'c.created'
,
'DESC'
)
// Additionally order by cid to ensure that comments with the same timestamp
// are returned in the exact order posted.
->
orderBy
(
'c.cid'
,
'DESC'
)
->
range
(
0
,
$number
)
->
execute
()
->
fetchAll
();
return
$comments
?
$comments
:
array
();
}
/**
* Calculates the page number for the first new comment.
*
...
...
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