1<?php
2// must be run within Dokuwiki
3if(!defined('DOKU_INC')) die();
4
5/**
6 * statdisplay plugin action component
7 *
8 * @author Andreas Gohr <gohr@cosmocode.de>
9 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
10 */
11class action_plugin_statdisplay extends DokuWiki_Action_Plugin {
12
13    function register(Doku_Event_Handler $controller) {
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        echo "logfile analysis started.\n";
25
26        /** @var $log helper_plugin_statdisplay_log */
27        $log = plugin_load('helper', 'statdisplay_log');
28        $lines = $log->parseLogData();
29
30        // did we do any work?
31        if($lines){
32            $event->preventDefault();
33            $event->stopPropagation();
34        }
35        echo "logfile analysis finished analyzing $lines lines.\n";
36    }
37
38}
39