diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-05-14 11:10:54 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-05-14 11:10:54 +0000 |
commit | 11aeff6016e8ee586c85913d315c0a5cb0c9fe09 (patch) | |
tree | 4f5b6274b80557fc987c36f62205cef3545d3b39 /modules/statistics/statistics.module | |
parent | 658b27c9eceed3c66c9fd4c75da9d9f0cdfd839c (diff) | |
download | brdo-11aeff6016e8ee586c85913d315c0a5cb0c9fe09.tar.gz brdo-11aeff6016e8ee586c85913d315c0a5cb0c9fe09.tar.bz2 |
- Patch #145242 by douggreen et al: refactor node_rank to modules can add scoring factors.
Diffstat (limited to 'modules/statistics/statistics.module')
-rw-r--r-- | modules/statistics/statistics.module | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 68de78e11..760219e1d 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -314,3 +314,20 @@ function statistics_nodeapi(&$node, $op, $arg = 0) { db_query('DELETE FROM {node_counter} WHERE nid = %d', $node->nid); } } + +/** + * Implementation of hook_ranking(). + */ +function statistics_ranking() { + if (variable_get('statistics_count_content_views', 0)) { + return array( + 'views' => array( + 'title' => t('Number of views'), + 'join' => 'LEFT JOIN {node_counter} node_counter ON node_counter.nid = i.sid', + // Inverse law that maps the highest view count on the site to 1 and 0 to 0. + 'score' => '2.0 - 2.0 / (1.0 + node_counter.totalcount * %f)', + 'arguments' => array(variable_get('node_cron_views_scale', 0)), + ), + ); + } +} |