Referers aren't saved [resolved => patch inside]

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
cvk
Posts: 3
Joined: Thu Jun 30, 2005 3:28 pm
Location: Köln, Germany
Contact:

Referers aren't saved [resolved => patch inside]

Post by cvk »

I just noticed that the "Last Google search" plugin sometimes doesn't show the correct entries. Checking the referrers table revealed that obviously not all referers are added to it. I weren't able to find out, when a referer is written to the table and when it is not, yet. Has anybody got an idea?

Thanks,
Chris
Last edited by cvk on Sat Jul 02, 2005 8:00 am, edited 1 time in total.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Referers aren't saved

Post by garvinhicking »

There is a mechanism which stops referrer spam by rejecting multiple identical referrers within a timespan of whatever minutes.

Maybe you can search the forums or the manual, there is a posting about it somewhere. Try to search for "suppress"...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
cvk
Posts: 3
Joined: Thu Jun 30, 2005 3:28 pm
Location: Köln, Germany
Contact:

Post by cvk »

Ah, thanks, I found the explanation. Looks like the "Last Google Search" plugin was virtually useless as long as it uses just the referers table, so if anyone is interested - here's a quick hack to include the suppressed referers. Edit: Please note that you need MySql >= 4.0 or PostgreSQL >= 6.5 for this patch to work.

Linux users can simply save the code below as somename.patch in the plugins/serendipity_plugin_google_last_query directory and apply with

Code: Select all

patch -p0 serendipity_plugin_google_last_query.php somename.patch

others and those without an shell account can just replace the lines marked with "<" by the ones marked with ">" in the file serendipity_plugin_google_last_query.php.

Code: Select all

71,72c71,82
<         $rows = serendipity_db_query("select scheme, host, path, query from {$serendipity['dbPrefix']}referrers where host like '%.google.%' and path like '/search' order by day desc, count asc limit $count");
<
---
>         $sql = "(select scheme, host, path, query, day
>                     from {$serendipity['dbPrefix']}referrers
>                     where host like '%.google.%' and path like '/search')
>                 union
>                 (select scheme, host, path, query, last as day
>                     from $serendipity['dbPrefix']}suppress
>                     where host like '%.google.%' and path like '/search')
>                 order by day desc
>                 limit $count";
>
>         $rows = serendipity_db_query($sql);
>
76c86
<
---
>
Please note that this patch, although it seems to work and I can't really think of any situation where it would cause any problems, is quite untested and might affect your system stability. Somehow... who knows...
Last edited by cvk on Mon Jul 04, 2005 8:11 pm, edited 3 times in total.
damocles.de - Powered by s9y
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

It should be noted that not all Databases support this kind of "UNION" query...

Thanks though for your patch! :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply