Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2739
Modified Files:
serendipity_functions.inc.php
Log Message:
Lame half assed attempt at smuggling my 7 day extension into the main
codebase.
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.227
retrieving revision 1.228
diff -u -d -r1.227 -r1.228
--- serendipity_functions.inc.php 18 Mar 2004 15:19:48 -0000 1.227
+++ serendipity_functions.inc.php 18 Mar 2004 20:50:52 -0000 1.228
@@ -2246,11 +2246,26 @@
function serendipity_displayTopUrlList($list, $limit) {
global $serendipity;
- $query = "SELECT host, SUM(count) AS total
- FROM {$serendipity['dbPrefix']}$list
- GROUP BY host
- ORDER BY total DESC, host
- LIMIT $limit";
+ /* HACK */
+ if ($serendipity['dbType'] == 'mysql') {
+ /* Nonportable SQL due to MySQL date functions,
+ * but produces rolling 7 day totals, which is more
+ * interesting
+ */
+ $query = "SELECT host, SUM(count) AS total
+ FROM {$serendipity['dbPrefix']}$list
+ WHERE day > date_sub(current_date, interval 7 day)
+ GROUP BY host
+ ORDER BY total DESC, host
+ LIMIT $limit";
+ } else {
+ /* Portable version of the same query */
+ $query = "SELECT host, SUM(count) AS total
+ FROM {$serendipity['dbPrefix']}$list
+ GROUP BY host
+ ORDER BY total DESC, host
+ LIMIT $limit";
+ }
$rows = serendipity_db_query($query);
echo "<span class='serendipityReferer'>";
|