@@ -, +, @@ convenience function C4::Context->setCommandlineEnvironment(); --- C4/Context.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- a/C4/Context.pm +++ a/C4/Context.pm @@ -1293,6 +1293,20 @@ sub IsSuperLibrarian { return ($userenv->{flags}//0) % 2; } +=head2 setCommandlineEnvironment + +Sets the Koha environment for command line scripts. + +=cut + +sub setCommandlineEnvironment { + my ($class) = @_; + + C4::Context->interface('commandline'); #Set interface for logger and friends + C4::Context->_new_userenv('commandline'); + C4::Context::set_userenv(1,0,0,'commandline',$0, '', '', {}, '', '', ''); +} + =head2 interface Sets the current interface for later retrieval in any Perl module --