From d82649c6e0d0a28bae8aafbcc8a10f194d099c6f Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 7 Oct 2024 09:16:59 +0000 Subject: [PATCH] Bug 38104: Adjust number of seconds in UsageStats::NeedUpdate Content-Type: text/plain; charset=utf-8 Test plan: Check pref UsageStatsLastUpdateTime Run perl -MC4::UsageStats -e'print C4::UsageStats::NeedUpdate()' Verify that it prints 1 only if time interval exceeds 4 weeks. Temporarily clear this pref. Run again. Should always print 1 now. Restore pref value. Signed-off-by: Marcel de Rooy --- C4/UsageStats.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index 37b4a76ec4..bb9194c416 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -25,6 +25,8 @@ use JSON qw( decode_json encode_json ); use Koha::Libraries; +use constant MIN_INTERVAL_BETWEEN_RUNS => 2419200; # 28 * 24 * 60 * 60 seconds + =head1 NAME C4::UsageStats @@ -51,7 +53,7 @@ sub NeedUpdate { my $now = strftime( "%s", localtime ); # Need to launch cron. - return 1 if $now - $lastupdated >= 2592000; + return 1 if $now - $lastupdated > MIN_INTERVAL_BETWEEN_RUNS; # Data don't need to be updated return 0; -- 2.39.5