Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv19301
Modified Files:
serendipity_functions.inc.php
Log Message:
Fixed track_urls for postgresql. Also a bug where duplicate supress entries were being created. Please look it over to make sure I haven't misunderstood the intention.
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- serendipity_functions.inc.php 1 Oct 2003 15:50:51 -0000 1.160
+++ serendipity_functions.inc.php 10 Oct 2003 04:01:46 -0000 1.161
@@ -2129,6 +2129,10 @@
if (rand(0, 100) < 1) {
serendipity_track_referrer_gc();
}
+ if($serendipity['dbType'] == "mysql")
+ $interval = 900;
+ else
+ $interval = "interval '900'";
$suppressq = "SELECT count(1)
FROM $serendipity[dbPrefix]suppress
@@ -2138,7 +2142,7 @@
AND host = '$url_parts[host]'
AND path = '$url_parts[path]'
AND query = '$url_parts[query]'
- AND last > now() - 900";
+ AND last > now() - $interval";
$suppressp = "DELETE FROM $serendipity[dbPrefix]suppress
WHERE ip = '$_SERVER[REMOTE_ADDR]'
@@ -2153,7 +2157,7 @@
$count = serendipity_db_query($suppressq, true);
- if ($count[0] > 0) {
+ if ($count[0] == 0) {
serendipity_db_query($suppressu);
return;
}
@@ -2168,7 +2172,12 @@
function serendipity_track_referrer_gc() {
global $serendipity;
- $gc = "DELETE FROM $serendipity[dbPrefix]suppress where last < now() - 900";
+ if($serendipity['dbType'] == "mysql")
+ $interval = 900;
+ else
+ $interval = "interval '900'";
+
+ $gc = "DELETE FROM $serendipity[dbPrefix]suppress where last < now() = $interval";
serendipity_db_query($gc);
}
|