Page 1 of 1
Referers aren't saved [resolved => patch inside]
Posted: Thu Jun 30, 2005 4:00 pm
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
Re: Referers aren't saved
Posted: Thu Jun 30, 2005 5:54 pm
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
Posted: Fri Jul 01, 2005 9:29 am
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...
Posted: Fri Jul 01, 2005 1:36 pm
by garvinhicking
It should be noted that not all Databases support this kind of "UNION" query...
Thanks though for your patch!
Regards,
Garvin