1<?php 2/** 3 * statdisplay plugin action component 4 * 5 * @author Andreas Gohr <gohr@cosmocode.de> 6 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 7 */ 8class action_plugin_statdisplay extends DokuWiki_Action_Plugin 9{ 10 11 /** @inheritDoc */ 12 function register(Doku_Event_Handler $controller) 13 { 14 $controller->register_hook('INDEXER_TASKS_RUN', 'AFTER', $this, 'handle_run'); 15 } 16 17 /** 18 * Analyze the next chunk of data 19 * 20 * @param Doku_Event $event 21 * @param $param 22 */ 23 function handle_run(&$event, $param) 24 { 25 echo "logfile analysis started.\n"; 26 27 /** @var $log helper_plugin_statdisplay_log */ 28 $log = plugin_load('helper', 'statdisplay_log'); 29 $lines = $log->parseLogData($this->getConf('lines')); 30 31 // did we do any work? 32 if ($lines) { 33 $event->preventDefault(); 34 $event->stopPropagation(); 35 } 36 echo "logfile analysis finished analyzing $lines lines.\n"; 37 } 38 39} 40