[Bug 16306] New: C4::Context->setCommandlineEnvironment() convenience function
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16306 Bug ID: 16306 Summary: C4::Context->setCommandlineEnvironment() convenience function Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: gmcharlt@gmail.com Reporter: olli-antti.kivilahti@jns.fi QA Contact: testopia@bugs.koha-community.org There is no unified way to set the environment for commandline scripts, even if the C4::Context->interface('commandline') explicitly allows setting the cli interface. Also a default user environment must be set. This function wraps the complexity of environment setting in the command line. Usage: use C4::Context; BEGIN { C4::Context->setCommandlineEnvironment(); } ... #Load other dependencies that might depend on the environment or just: ... use C4::Context; C4::Context->setCommandlineEnvironment(); ... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16306 --- Comment #1 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 50454 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=50454&action=edit Bug 16306 - C4::Context->setCommandlineEnvironment() convenience function There is no unified way to set the environment for commandline scripts, even if the C4::Context->interface('commandline') explicitly allows setting the cli interface. Also a default user environment must be set. This function wraps the complexity of environment setting in the command line. Usage: use C4::Context; BEGIN { C4::Context->setCommandlineEnvironment(); } ... #Load other dependencies that might depend on the environment or just: ... use C4::Context; C4::Context->setCommandlineEnvironment(); ... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16306 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=14167 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16306 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|gmcharlt@gmail.com |olli-antti.kivilahti@jns.fi -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16306 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16306 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |veron@veron.ch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16306 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #50454|0 |1 is obsolete| | --- Comment #2 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 50501 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=50501&action=edit Bug 16306 - C4::Context->setCommandlineEnvironment() convenience function There is no unified way to set the environment for commandline scripts, even if the C4::Context->interface('commandline') explicitly allows setting the cli interface. This function wraps the complexity of environment setting in the command line. Also a default user environment must be set. To set the default user environment we need a default user. This patch also makes sure that a default 'commandlineadmin' always exists in DB. Usage: use C4::Context; BEGIN { C4::Context->setCommandlineEnvironment(); } ... #Load other dependencies that might depend on the environment or just: ... use C4::Context; C4::Context->setCommandlineEnvironment(); ... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16306 Nicolas Legrand <nicolas.legrand@bulac.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Patch doesn't apply CC| |nicolas.legrand@bulac.fr --- Comment #3 from Nicolas Legrand <nicolas.legrand@bulac.fr> --- nicolas@plac:~/kohaclone$ git bz apply 16306 Bug 16306 - C4::Context->setCommandlineEnvironment() convenience function 50501 - Bug 16306 - C4::Context->setCommandlineEnvironment() convenience function Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 16306 - C4::Context->setCommandlineEnvironment() convenience function fatal: sha1 information is lacking or useless (C4/Context.pm). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 Bug 16306 - C4::Context->setCommandlineEnvironment() convenience function The copy of the patch that failed is found in: /home/nicolas/kohaclone/.git/rebase-apply/patch When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-16306---C4Context-setCommandlineEnvironment-co-6OOIcM.patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16306 --- Comment #4 from Lari Taskula <lari.taskula@jns.fi> --- Created attachment 64965 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64965&action=edit Bug 16306 - (squashable) C4::Context->setCommandlineEnvironment() convenience function Test t/db_dependent/Context_commandline.t fails due to commandlinesuperuser not being stored in the database. To test: 1. Make sure commandlinesuperuser does not exist 2. prove t/db_dependent/Context_commandline.t 3. Observe failure 4. Apply patch 5. prove t/db_dependent/Context_commandline.t 6. Success -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16306 --- Comment #5 from M. Tompsett <mtompset@hotmail.com> --- Comment on attachment 50501 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=50501 Bug 16306 - C4::Context->setCommandlineEnvironment() convenience function Review of attachment 50501: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=16306&attachment=50501) ----------------------------------------------------------------- ::: C4/Context.pm @@ +1309,5 @@
+ C4::Context::set_userenv($clisu->{borrowernumber},$clisu->{userid},$clisu->{cardnumber},$clisu->{firstname},$clisu->{surname}, $clisu->{branchcode}, '', {}, '', '', ''); +} + +sub _enforceCommandlineSuperuserBorrowerExists { + my $commandlineSuperuser = C4::Members::GetMember(userid => 'commandlineadmin');
I believe this GetMember function was removed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16306 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de Status|Patch doesn't apply |Failed QA -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org