Difference between revisions of "Extension:SearchLog.php"
(log file stuff) |
m (Extension:SearchLog moved to Extension:SearchLog.php) |
(No difference)
|
Revision as of 06:31, 18 May 2007
<?php
- Extension:SearchLog
{{#Security:*|dev}}{{#Security:view|*}}Template:Php
- - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
- - 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, } } } ?>