Martin Renvoize
d2e189ca1c
This patch change Koha::Cron to be a more generic Koha::Script class and update all commanline driven scripts to use it. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
18 lines
617 B
Perl
Executable file
18 lines
617 B
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
use Modern::Perl;
|
|
|
|
use Koha::Script -cron;
|
|
use C4::Context;
|
|
use C4::SocialData;
|
|
|
|
my $url = C4::Context->preference( "Babeltheque_url_update" );
|
|
my $output_dir = qq{/tmp};
|
|
my $output_filepath = qq{$output_dir/social_data.csv};
|
|
system( qq{/bin/rm -f $output_filepath} );
|
|
system( qq{/bin/rm -f $output_dir/social_data.csv.bz2} );
|
|
system( qq{/usr/bin/wget $url -O $output_dir/social_data.csv.bz2 } ) == 0 or die "Can't get bz2 file from url $url ($?)";
|
|
system( qq{/bin/bunzip2 $output_dir/social_data.csv.bz2 } ) == 0 or die "Can't extract bz2 file ($?)";
|
|
|
|
|
|
C4::SocialData::update_data $output_filepath;
|