Skip to content

Commit

Permalink
Item14501: fixed broken init scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Sep 25, 2017
1 parent db3f9ae commit f7a8d09
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 46 deletions.
33 changes: 18 additions & 15 deletions data/System/PiwikPlugin.txt
@@ -1,6 +1,6 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1418745265" format="1.1" version="1"}%
---+!! %TOPIC%
%SHORTDESCRIPTION%
%FORMFIELD{"Description"}%

%TOC%

Expand Down Expand Up @@ -103,17 +103,12 @@ To track rendering times on older Foswikis you need to apply below patch
</verbatim>
%ENDTWISTY%

---++ Info
<!--
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
-->

| Author(s): | Michael Daum|
| Copyright: | &copy; 2013-2014 Michael Daum http://michaeldaumconsulting.com |
| License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]] |
| Version: | %$VERSION% |
| Release: | %$RELEASE% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
---++ Dependencies
%$DEPENDENCIES%

---++ Change History
%TABLE{columnwidths="7em" tablewidth="100%"}%
| 25 Sep 2017 | fixed broken init scripts for piwik_daemon script |
| 16 Dec 2014 | ignore ssl certificate problems when contacting piwik on localhost |
| 05 Dec 2014 | use both either completePageHander or modifyHeaderHandler not to miss a page view |
| 29 Aug 2014 | added proper system init scripts; fully specify rest security |
Expand All @@ -123,8 +118,16 @@ To track rendering times on older Foswikis you need to apply below patch
| 16 Jul 2013 | added auto-start feature for the piwik comm server |
| 15 Jul 2013 | implemented queue manager for better tracking performance; improved control over pages and actions being tracked |
| 14 Jul 2013 | initial release |
| Dependencies: | %$DEPENDENCIES% |
| Home page: | Foswiki:Extensions/%TOPIC% |
| Support: | Foswiki:Support/%TOPIC% |


%META:FILEATTACHMENT{name="logo.png" attachment="logo.png" attr="h" comment="" date="1418745265" size="7191" user="ProjectContributor" version="1"}%
%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="Michael Daum"}%
%META:FIELD{name="Copyright" title="Copyright" value="&copy; 2013-2014 Michael Daum http://michaeldaumconsulting.com"}%
%META:FIELD{name="Description" title="Description" value="%25$SHORTDESCRIPTION%25"}%
%META:FIELD{name="Home" title="Home" value="Foswiki:Extensions/%TOPIC%"}%
%META:FIELD{name="License" title="License" value="[[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]]"}%
%META:FIELD{name="Release" title="Release" value="%$RELEASE%"}%
%META:FIELD{name="Repository" title="Repository" value="https://github.com/foswiki/%TOPIC%"}%
%META:FIELD{name="Support" title="Support" value="Foswiki:Support/%TOPIC%"}%
%META:FIELD{name="Version" title="Version" value="%$VERSION%"}%
8 changes: 4 additions & 4 deletions lib/Foswiki/Plugins/PiwikPlugin.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
# Plugin for Foswiki - The Free and Open Source Wiki, https://foswiki.org/
#
# PiwikPlugin is Copyright (C) 2013-2014 Michael Daum http://michaeldaumconsulting.com
# PiwikPlugin is Copyright (C) 2013-2017 Michael Daum https://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -22,8 +22,8 @@ use Foswiki::Func ();
use Foswiki::Sandbox ();
use Error qw(:try);

our $VERSION = '2.22';
our $RELEASE = '2.22';
our $VERSION = '2.30';
our $RELEASE = '25 Sep 2017';
our $SHORTDESCRIPTION = 'Server-side page tracking using Piwik';
our $NO_PREFS_IN_TOPIC = 1;
our $tracker;
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/PiwikPlugin/Config.spec
Expand Up @@ -54,7 +54,7 @@ $Foswiki::cfg{PiwikPlugin}{TrackedActions} = 'edit,view,save';

# **STRING**
# Regular expression matched against the web.topic being tracked. A matching topic won't be recorded to Piwik.
$Foswiki::cfg{PiwikPlugin}{ExcludePattern} = '';
$Foswiki::cfg{PiwikPlugin}{ExcludePattern} = 'WebAtom|WebRss';

# **BOOLEAN**
# Boolean flag to trigger tracking of outgoing links and downloads
Expand Down
5 changes: 3 additions & 2 deletions lib/Foswiki/Plugins/PiwikPlugin/Daemon.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
# Plugin for Foswiki - The Free and Open Source Wiki, https://foswiki.org/
#
# PiwikPlugin is Copyright (C) 2013-2014 Michael Daum http://michaeldaumconsulting.com
# PiwikPlugin is Copyright (C) 2013-2017 Michael Daum https://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -70,6 +70,7 @@ sub userAgent {

$this->{userAgent}->ssl_opts(
verify_hostname => 0, # SMELL
verify_mode => 0, # SMELL
);
}

Expand Down
1 change: 1 addition & 0 deletions lib/Foswiki/Plugins/PiwikPlugin/MANIFEST
@@ -1,3 +1,4 @@
!noci
data/System/PiwikPlugin.txt 0644
lib/Foswiki/Plugins/PiwikPlugin/Config.spec 0644
lib/Foswiki/Plugins/PiwikPlugin/Daemon.pm 0644
Expand Down
8 changes: 5 additions & 3 deletions lib/Foswiki/Plugins/PiwikPlugin/Tracker.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
# Plugin for Foswiki - The Free and Open Source Wiki, https://foswiki.org/
#
# PiwikPlugin is Copyright (C) 2013-2014 Michael Daum http://michaeldaumconsulting.com
# PiwikPlugin is Copyright (C) 2013-2017 Michael Daum https://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -22,6 +22,7 @@ use Foswiki::Func ();
use Foswiki::Plugins ();
use Digest::MD5();
use JSON();
use Encode();
use File::Temp ();
use File::Path qw(make_path);

Expand Down Expand Up @@ -405,7 +406,8 @@ sub getTopicTitle {
sub urlEncode {
my $text = shift;

$text =~ s/([^0-9a-zA-Z-_.:~!*'\/])/'%'.sprintf('%02x',ord($1))/ge;
$text = Encode::encode_utf8($text) if $Foswiki::UNICODE;
$text =~ s/([^0-9a-zA-Z-_.:~!*'\/])/sprintf('%%%02x',ord($1))/ge;

return $text;
}
Expand Down
16 changes: 1 addition & 15 deletions lib/Foswiki/Plugins/PiwikPlugin/build.pl
@@ -1,24 +1,10 @@
#!/usr/bin/perl -w
#!/usr/bin/env perl
BEGIN { unshift @INC, split( /:/, $ENV{FOSWIKI_LIBS} ); }
use Foswiki::Contrib::Build;

# Create the build object
$build = new Foswiki::Contrib::Build('PiwikPlugin');

# (Optional) Set the details of the repository for uploads.
# This can be any web on any accessible Foswiki installation.
# These defaults will be used when expanding tokens in .txt
# files, but be warned, they can be overridden at upload time!

# name of web to upload to
$build->{UPLOADTARGETWEB} = 'Extensions';
# Full URL of pub directory
$build->{UPLOADTARGETPUB} = 'http://foswiki.org/pub';
# Full URL of bin directory
$build->{UPLOADTARGETSCRIPT} = 'http://foswiki.org/bin';
# Script extension
$build->{UPLOADTARGETSUFFIX} = '';

# Build the target on the command line, or the default target
$build->build($build->{target});

1 change: 1 addition & 0 deletions tools/foswiki-piwik.default
@@ -1,2 +1,3 @@
ENABLED=0
FOSWIKI_ROOT=/home/www-data/foswiki/core
FOSWIKI_PIWIK_LOGS=/var/log/nginx/$NAME.log
17 changes: 13 additions & 4 deletions tools/foswiki-piwik.init-script
Expand Up @@ -11,26 +11,28 @@
### END INIT INFO

DESC="Foswiki-to-Piwik backend server"
NAME=piwik_daemon
NAME=foswiki-piwik

PATH=/sbin:/bin:/usr/sbin:/usr/bin
USER=www-data
GRPOUP=www-data
GROUP=www-data

FOSWIKI_PIWIK_PIDFILE=/var/run/$NAME.pid
FOSWIKI_ROOT=/var/www/foswiki
FOSWIKI_PIWIK_LOGS=/var/log/$NAME.log
ENABLED=0

# Include defaults if available
if [ -f /etc/default/foswiki-piwik ] ; then
. /etc/default/foswiki-piwik
if [ -f /etc/default/$NAME ] ; then
. /etc/default/$NAME
fi

FOSWIKI_PIWIK_QUEUE=$FOSWIKI_ROOT/working/work_areas/PiwikPlugin/queue
FOSWIKI_PIWIK_DAEMON=$FOSWIKI_ROOT/tools/piwik_daemon
FOSWIKI_PIWIK_DAEMON_OPTS="-detach -pid $FOSWIKI_PIWIK_PIDFILE -log $FOSWIKI_PIWIK_LOGS"

start() {
check_enabled
log_daemon_msg "Starting $DESC" $NAME
if test ! -f $FOSWIKI_PIWIK_LOGS; then
:> $FOSWIKI_PIWIK_LOGS
Expand Down Expand Up @@ -90,6 +92,13 @@ status() {
status_of_proc -p "$FOSWIKI_PIWIK_PID" "$FOSWIKI_PIWIK_DAEMON" $NAME
}

check_enabled() {
if [ "$ENABLED" = "0" ]; then
echo "$DESC: disabled, see /etc/default/foswiki-piwik"
exit 0
fi
}

. /lib/lsb/init-functions

case "$1" in
Expand Down
4 changes: 2 additions & 2 deletions tools/piwik_daemon
@@ -1,7 +1,7 @@
#! /usr/bin/env perl
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
# Plugin for Foswiki - The Free and Open Source Wiki, https://foswiki.org/
#
# PiwikPlugin is Copyright (C) 2013-2014 Michael Daum http://michaeldaumconsulting.com
# PiwikPlugin is Copyright (C) 2013-2017 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down

0 comments on commit f7a8d09

Please sign in to comment.