Bugzilla – Attachment 135759 Details for
Bug 30889
Background jobs lead to wrong/missing info in logs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30889: Set userenv for background jobs
Bug-30889-Set-userenv-for-background-jobs.patch (text/plain), 1.27 KB, created by
Jonathan Druart
on 2022-06-07 12:41:53 UTC
(
hide
)
Description:
Bug 30889: Set userenv for background jobs
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-06-07 12:41:53 UTC
Size:
1.27 KB
patch
obsolete
>From 6033bb9103f5062562441540e0ae18f839e1c487 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 7 Jun 2022 14:39:44 +0200 >Subject: [PATCH] Bug 30889: Set userenv for background jobs > >We need to set the userenv when we process the jobs. It is useful for >stats (at least) >--- > misc/background_jobs_worker.pl | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > >diff --git a/misc/background_jobs_worker.pl b/misc/background_jobs_worker.pl >index 0027a820e7c..f10880d6ca9 100755 >--- a/misc/background_jobs_worker.pl >+++ b/misc/background_jobs_worker.pl >@@ -121,6 +121,20 @@ sub process_job { > > die "fork failed!" unless defined $pid; > >- $job->process( $args ); >+ my $patron = Koha::Patrons->find($job->borrowernumber); >+ if ( $patron ) { >+ C4::Context->_new_userenv(-1); >+ C4::Context->set_userenv( >+ $patron->borrowernumber, $patron->userid, >+ $patron->cardnumber, $patron->firstname, >+ $patron->surname, $patron->branchcode, >+ $patron->library->branchname, $patron->flags >+ ); >+ $job->process( $args ); >+ C4::Context->_unset_userenv(-1); >+ } ese { >+ $job->process( $args ); >+ } >+ > exit; > } >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30889
:
135759
|
135760
|
135932
|
135933
|
135934
|
135935
|
135936
|
136294
|
136295
|
136296
|
136297
|
136298
|
136299
|
136375
|
136376
|
136784
|
136785
|
136786
|
136787
|
136788
|
136789
|
136790
|
136791
|
136792
|
136904
|
136948