5 use Pod::Usage qw( pod2usage );
6 use Getopt::Long qw( GetOptions );
8 use Koha::Script -cron;
11 use C4::Log qw( cronlogaction );
12 use POSIX qw( strftime );
14 my $command_line_options = join(" ",@ARGV);
16 my ( $help, $verbose, $force, $quiet );
19 'v|verbose' => \$verbose,
28 unless ( C4::Context->preference('UsageStats') ) {
32 The UsageStats system preference is not set.
33 If your library wants to share their usage statistics with the Koha community, you have to switch on this system preference
35 Setting the quiet flag will silence this message.
41 cronlogaction({ info => $command_line_options });
43 my $need_update = ($force ? 1 : C4::UsageStats::NeedUpdate() );
46 say "Data need to be updated" if $verbose;
47 my $report = C4::UsageStats::BuildReport();
48 C4::UsageStats::ReportToCommunity($report);
49 C4::Context->set_preference( 'UsageStatsLastUpdateTime',
50 strftime( "%s", localtime ) );
53 say "Data don't need to be updated";
56 cronlogaction({ action => 'End', info => "COMPLETED" });
60 share_usage_with_koha_community.pl - Share your library's usage with the Koha community
64 share_usage_with_koha_community.pl [-h|--help] [-v|--verbose] [-f|--force] [-q|--quiet]
66 If the UsageStats system preference is set, you can launch this script to share your usage data
67 anonymously with the Koha community.
69 Collecting Koha usage statistics will help developers to know how Koha is used across the world.
71 This script will send the usage data for the bibliographic and authority records, checkouts, holds, orders,
74 Only the total number is retrieved. In no case will private data be shared!
76 In order to know which parts of Koha modules are used, this script will collect some system preference values.
78 If you want to tell us who you are, you can fill the UsageStatsLibraryName system preference with your library name, UsageStatsLibraryUrl, UsageStatsLibraryType and/or UsageStatsCountry, UsageStatsLibrariesInfo.
80 All these data will be analyzed on the http://hea.koha-community.org Koha community website.
82 IMPORTANT : please do NOT run the cron on the 1st, but on another day. The idea is to avoid all
83 Koha libraries sending their data at the same time ! So choose any day between 1 and 28 !
91 Print a brief help message
103 Do not emit "The UsageStats system preference is not set" message
109 Alex Arnaud <alex.arnaud@biblibre.com>
111 Jonathan Druart <jonathan.druart@biblibre.com>
115 Copyright 2014 BibLibre
119 This file is part of Koha.
121 # Koha is free software; you can redistribute it and/or modify it
122 # under the terms of the GNU General Public License as published by
123 # the Free Software Foundation; either version 3 of the License, or
124 # (at your option) any later version.
126 # Koha is distributed in the hope that it will be useful, but
127 # WITHOUT ANY WARRANTY; without even the implied warranty of
128 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
129 # GNU General Public License for more details.
131 # You should have received a copy of the GNU General Public License
132 # along with Koha; if not, see <http://www.gnu.org/licenses>.