Extension:Log Searches

From MediaWiki.org

Jump to: navigation, search
This extension requires patches to core MediaWiki code . Extensions implemented using patches may be disabled by or interfere with upgrades and security patches. If a suitable alternative without a patch is available, we recommend you use that extension instead.


Manual on MediaWiki Extensions
List of MediaWiki Extensions
Log Searches

Release status: experimental

Implementation User interface
Description logs searches into file
Author(s) Flominator
MediaWiki tested with 1.67
Download no link

At the moment, this one is just a dirty hack in order to log your search results into a comma separated file, which can be analyzed manually. This originally was a response to Project:Extension_requests#Search_statistics and is far from complete. In order to turn this into a "real" extension a new hook would have to added into Special:Search. --Flominator 09:21, 25 October 2007 (UTC)

[edit] Installation

Place this code in /extensions/LogSearches.php ...

<?php
 
function log_goResult($term)
{
        logSearch("Artikelsuche;$term");
}
 
function log_showResults($term)
{
        logSearch("Volltextsuche;$term");
 
}
function logSearch($line)
{
        $f = fopen("./extensions/searchlog.csv", "a");
        fputs($f, $_SERVER['REMOTE_ADDR'] .';'. strftime("%Y-%m-%d;%H:%M").";$line;$time\n");
        fclose($f);
}
?>

... and this one in /LocalSettings.php ...

require_once("$IP/extensions/LogSearches.php")

... and modify /includes/SpecialSearch.php:

line 83:

function goResult( $term ) {
 log_goResult($term);
global $wgOut;

line 129

function showResults( $term ) {
 log_showResults($term);
$fname = 'SpecialSearch::showResults';
Personal tools