Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
80e7ee23
Commit
80e7ee23
authored
Sep 05, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only recalculate hotness when necessary
parent
694c2eaf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
page.php
qa-include/app/page.php
+3
-2
hotness.php
qa-include/db/hotness.php
+3
-1
No files found.
qa-include/app/page.php
View file @
80e7ee23
...
...
@@ -374,8 +374,9 @@ function qa_do_content_stats($qa_content)
require_once
QA_INCLUDE_DIR
.
'db/hotness.php'
;
qa_db_increment_views
(
$qa_content
[
'inc_views_postid'
]);
if
(
qa_opt
(
'recalc_hotness_q_view'
))
{
$viewsIncremented
=
qa_db_increment_views
(
$qa_content
[
'inc_views_postid'
]);
if
(
$viewsIncremented
&&
qa_opt
(
'recalc_hotness_q_view'
))
{
qa_db_hotness_update
(
$qa_content
[
'inc_views_postid'
]);
}
...
...
qa-include/db/hotness.php
View file @
80e7ee23
...
...
@@ -28,7 +28,7 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
/**
* Increment the views counter for the post (if different IP from last view).
* @param int $postid The ID of the post
* @return
void
* @return
bool Whether views were actually incremented.
*/
function
qa_db_increment_views
(
$postid
)
{
...
...
@@ -36,6 +36,8 @@ function qa_db_increment_views($postid)
$ipHex
=
bin2hex
(
@
inet_pton
(
qa_remote_ip_address
()));
qa_db_query_sub
(
$query
,
$ipHex
,
$postid
,
$ipHex
);
return
qa_db_affected_rows
()
>
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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