Difference between revisions of "Extension:SearchLog.php"

From Organic Design wiki
(Make a start)
 
(log file stuff)
Line 7: Line 7:
 
   
 
   
 
define('SEARCHLOG_VERSION','0.0.1, 2007-05-17');
 
define('SEARCHLOG_VERSION','0.0.1, 2007-05-17');
+
 
 +
$wgSearchLogFile        = dirname(__FILE__)."/search.log";
 +
$wgExtensionFunctions[] = 'wfSetupSearchLog';
 +
 
 
$wgExtensionCredits['other'][] = array(
 
$wgExtensionCredits['other'][] = array(
 
'name'        => 'SearchLog',
 
'name'        => 'SearchLog',
Line 16: Line 19:
 
);
 
);
  
# If a search has been posted, log the info
+
function wfSetupSearchLog() {
if (isset($_REQUEST['search'])) {
+
global $wgSearchLogFile,$wgUser;
if (isset($_REQUEST['go'])) $type = 'go';
+
 
else if (isset($_REQUEST['go'])) $type = 'fulltext';
+
# If a search has been posted, log the info
else $type = 'other';
+
if (isset($_REQUEST['search'])) {
}
+
if (isset($_REQUEST['go'])) $type = 'go';
+
else if (isset($_REQUEST['go'])) $type = 'fulltext';
 +
else $type = 'other';
 +
 
 +
# Log the data to the file
 +
if ($fh = fopen($wgSearchLogFile,'a')) {
 +
fwrite($fh,
 +
}
 +
}
 +
}  
 
?>
 
?>

Revision as of 22:08, 17 May 2007

<?php

  1. Extension:SearchLog
Info.svg These are the MediaWiki extensions we're using and/or developing. Please refer to the information on the mediawiki.org wiki for installation and usage details. Extensions here which have no corresponding mediawiki article are either not ready for use or have been superseded. You can also browse our extension code in our local Subversion repository or our GitHub mirror.

{{#Security:*|dev}}{{#Security:view|*}}Template:Php

  1. - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
  2. - Author: User:NadCategory:Extensions created with Template:Extension

if (!defined('MEDIAWIKI')) die('Not an entry point.');

define('SEARCHLOG_VERSION','0.0.1, 2007-05-17');

$wgSearchLogFile = dirname(__FILE__)."/search.log"; $wgExtensionFunctions[] = 'wfSetupSearchLog';

$wgExtensionCredits['other'][] = array( 'name' => 'SearchLog', 'author' => 'User:Nad', 'description' => 'An example extension made with Extension:SearchLog', 'url' => 'http://www.organicdesign.co.nz/Extension:Example', 'version' => SEARCHLOG_VERSION );

function wfSetupSearchLog() { global $wgSearchLogFile,$wgUser;

# If a search has been posted, log the info if (isset($_REQUEST['search'])) { if (isset($_REQUEST['go'])) $type = 'go'; else if (isset($_REQUEST['go'])) $type = 'fulltext'; else $type = 'other';

# Log the data to the file if ($fh = fopen($wgSearchLogFile,'a')) { fwrite($fh, } } } ?>