Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
aurweb
Commits
122636cb
Commit
122636cb
authored
Apr 05, 2014
by
Lukas Fleischer
Browse files
Refactor pkgbase_comments_count()
Signed-off-by:
Lukas Fleischer
<
archlinux@cryptocrack.de
>
parent
206678df
Changes
1
Hide whitespace changes
Inline
Side-by-side
web/lib/pkgbasefuncs.inc.php
View file @
122636cb
...
...
@@ -25,28 +25,26 @@ function pkgbase_categories() {
/**
* Get the number of non-deleted comments for a specific package base
*
* @param string $
pkg
id The package base ID to get comment count for
* @param string $
base_
id The package base ID to get comment count for
*
* @return string The number of comments left for a specific package
*/
function
pkgbase_comments_count
(
$base_id
)
{
$dbh
=
DB
::
connect
();
$base_id
=
intval
(
$base_id
);
if
(
$base_id
>
0
)
{
$dbh
=
DB
::
connect
();
$q
=
"SELECT COUNT(*) FROM PackageComments "
;
$q
.
=
"WHERE PackageBaseID = "
.
$base_id
;
$q
.
=
" AND DelUsersID IS NULL"
;
if
(
!
$base_id
)
{
return
null
;
}
$result
=
$dbh
->
query
(
$q
);
$dbh
=
DB
::
connect
();
$q
=
"SELECT COUNT(*) FROM PackageComments "
;
$q
.
=
"WHERE PackageBaseID = "
.
$base_id
.
" "
;
$q
.
=
"AND DelUsersID IS NULL"
;
$result
=
$dbh
->
query
(
$q
);
if
(
!
$result
)
{
return
;
return
null
;
}
$row
=
$result
->
fetch
(
PDO
::
FETCH_NUM
);
return
$row
[
0
];
return
$result
->
fetchColumn
(
0
);
}
/**
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment