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