xref: /plugin/statistics/dispatch.php (revision 523da37276acfd8d5f4f6c331a0062602b449fec)
1*87e0f0b1SAndreas Gohr<?php
2*87e0f0b1SAndreas Gohr
3*87e0f0b1SAndreas Gohr// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
4*87e0f0b1SAndreas Gohr/**
5*87e0f0b1SAndreas Gohr * Statistics plugin - data logger
6*87e0f0b1SAndreas Gohr *
7*87e0f0b1SAndreas Gohr * This logger is called via JavaScript
8*87e0f0b1SAndreas Gohr *
9*87e0f0b1SAndreas Gohr * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
10*87e0f0b1SAndreas Gohr * @author     Andreas Gohr <gohr@cosmocode.de>
11*87e0f0b1SAndreas Gohr */
12*87e0f0b1SAndreas Gohruse dokuwiki\plugin\statistics\IgnoreException;
13*87e0f0b1SAndreas Gohruse dokuwiki\ErrorHandler;
14*87e0f0b1SAndreas Gohr
15*87e0f0b1SAndreas Gohrif (!defined('DOKU_INC')) define('DOKU_INC', realpath(__DIR__ . '/../../../') . '/');
16*87e0f0b1SAndreas Gohrdefine('DOKU_DISABLE_GZIP_OUTPUT', 1);
17*87e0f0b1SAndreas Gohrrequire_once(DOKU_INC . 'inc/init.php');
18*87e0f0b1SAndreas Gohrsession_write_close();
19*87e0f0b1SAndreas Gohr
20*87e0f0b1SAndreas Gohrglobal $INPUT;
21*87e0f0b1SAndreas Gohr
22*87e0f0b1SAndreas Gohr/** @var helper_plugin_statistics $plugin */
23*87e0f0b1SAndreas Gohr$plugin = plugin_load('helper', 'statistics');
24*87e0f0b1SAndreas Gohr$plugin->sendGIF(); // browser be done
25*87e0f0b1SAndreas Gohr
26*87e0f0b1SAndreas Gohr$logger = $plugin->getLogger();
27*87e0f0b1SAndreas Gohr$logger->begin(); // triggers autologging
28*87e0f0b1SAndreas Gohr
29*87e0f0b1SAndreas Gohrswitch ($INPUT->str('do')) {
30*87e0f0b1SAndreas Gohr    case 'v':
31*87e0f0b1SAndreas Gohr        $logger->logPageView();
32*87e0f0b1SAndreas Gohr        break;
33*87e0f0b1SAndreas Gohr    case 'o':
34*87e0f0b1SAndreas Gohr        $logger->logOutgoing();
35*87e0f0b1SAndreas Gohr}
36*87e0f0b1SAndreas Gohr
37*87e0f0b1SAndreas Gohr$logger->end();
38