Commit 36cb2427 authored by Luc Didry's avatar Luc Didry

Merge branch 'feature/piwik' into 'master'

Piwik tracking

Discuté dans https://framagit.org/luc/lstu/issues/13

See merge request !6
parents aad827aa 2c03e5a7
Pipeline #10308 failed with stage
in 5 minutes and 52 seconds
......@@ -4,6 +4,7 @@ requires 'Data::Validate::URI';
requires 'Net::Domain::TLD', '>= 1.74';
requires 'Mojolicious::Plugin::I18N';
requires "Mojolicious::Plugin::DebugDumperHelper";
requires "Mojolicious::Plugin::Piwik";
requires 'Locale::Maketext';
requires 'Locale::Maketext::Extract';
requires 'Net::Abuse::Utils::Spamhaus';
......
......@@ -189,6 +189,22 @@ DISTRIBUTIONS
File::Spec 3.29
Test::More 0.42
perl 5.00503
IO-Socket-INET6-2.72
pathname: S/SH/SHLOMIF/IO-Socket-INET6-2.72.tar.gz
provides:
IO::Socket::INET6 2.72
requirements:
Carp 0
Errno 0
Exporter 0
IO::Socket 0
Module::Build 0.36
Socket 0
Socket6 0.12
Test::More 0
perl 5.008
strict 0
warnings 0
IO-Socket-IP-0.37
pathname: P/PE/PEVANS/IO-Socket-IP-0.37.tar.gz
provides:
......@@ -425,13 +441,27 @@ DISTRIBUTIONS
Mojolicious-Plugin-I18N-1.6
pathname: S/SH/SHARIFULN/Mojolicious-Plugin-I18N-1.6.tar.gz
provides:
App undef
App::I18N undef
App::I18N::en undef
App::I18N::ru undef
Mojolicious::Plugin::I18N 1.6
Mojolicious::Plugin::I18N::_Handler 1.6
requirements:
I18N::LangTags 0.35
Module::Build 0.42
Mojolicious 5
Test::More 0
perl 5.010001
Mojolicious-Plugin-Piwik-0.19
pathname: A/AK/AKRON/Mojolicious-Plugin-Piwik-0.19.tar.gz
provides:
Mojolicious::Plugin::Piwik 0.19
requirements:
ExtUtils::MakeMaker 0
Mojolicious 4.88
Test::More 0
perl 5.010001
Net-Abuse-Utils-Spamhaus-0.07
pathname: S/SA/SAXJAZMAN/net/Net-Abuse-Utils-Spamhaus-0.07.tar.gz
provides:
......@@ -537,6 +567,7 @@ DISTRIBUTIONS
File::Spec 0.86
IO::Socket 1.16
IO::Socket::INET 1.25
IO::Socket::INET6 2.01
IO::Socket::IP 0.29
MIME::Base64 2.11
Test::More 0.52
......@@ -609,6 +640,12 @@ DISTRIBUTIONS
ExtUtils::MakeMaker 6.30
File::Spec 0
strict 0
Socket6-0.27
pathname: U/UM/UMEMOTO/Socket6-0.27.tar.gz
provides:
Socket6 0.27
requirements:
ExtUtils::MakeMaker 0
Test-Script-1.10
pathname: P/PL/PLICEASE/Test-Script-1.10.tar.gz
provides:
......
......@@ -48,6 +48,9 @@ sub startup {
# Debug
$self->plugin('DebugDumperHelper');
# Piwik
$self->plugin('Piwik');
# Schema updates
LstuModel->do('CREATE TABLE IF NOT EXISTS sessions (token TEXT PRIMARY KEY, until INTEGER)');
LstuModel->do('CREATE TABLE IF NOT EXISTS ban (ip TEXT PRIMARY KEY, until INTEGER, strike INTEGER)');
......
......@@ -233,6 +233,16 @@ sub get {
}
my $counter = $urls[0]->counter + 1;
$urls[0]->update(counter => $counter);
my $piwik = $c->config('piwik');
if (defined($piwik) && $piwik->{idsite} && $piwik->{url}) {
$c->piwik_api(
'Track' => {
idSite => $piwik->{idsite},
action_url => $c->{url},
url => $piwik->{url}
}
);
}
$c->clear_cache;
});
......
......@@ -79,4 +79,12 @@
# ban_min_strike times, it will be banned for a month.
# optional, default is 3
#ban_min_strike => 3,
# define an URL to the Piwik instance and the ID of a website to track
# set if you want to track views in Piwik
# optional, Piwik tracking is disabled by default
#piwik => {
# url => 'http://piwik.example.com',
# idsite => '1',
#}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment