LogController.php 1.14 KB
Newer Older
Dominik Hebeler's avatar
Dominik Hebeler committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Redis;

class LogController extends Controller
{
    function clicklog(Request $request) 
    {
        $redis = Redis::connection('redisLogs');
        if( $redis )
        {
            $logEntry = "";
            $logEntry .= "[" . date(DATE_RFC822, mktime(date("H"),date("i"), date("s"), date("m"), date("d"), date("Y"))) . "]";
            $logEntry .= "  " . $request->input('i');
            $logEntry .= "  " . $request->input('s');
            $logEntry .= "  " . $request->input('q');
            $logEntry .= "  " . $request->input('p');
            $logEntry .= "  " . $request->input('url');

            $redis->rpush('logs.clicks', $logEntry);
        }
        return '';
    } 

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
    function pluginClose()
    {
        $redis = Redis::connection('redisLogs');
        if( $redis )
        {
            $redis->incr('logs.plugin.close');
        }
    }

    function pluginInstall()
    {
        $redis = Redis::connection('redisLogs');
        if( $redis )
        {
            $redis->incr('logs.plugin.install');
        }
    }

Dominik Hebeler's avatar
Dominik Hebeler committed
47
}