From 3eeaba3f2e13ae1f2d5fe8b0981ad7411ff3980a Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 27 Jan 2022 10:55:12 +0000 Subject: [PATCH] Bug 29954: Rename _new calls to new Content-Type: text/plain; charset=utf-8 --- C4/Auth.pm | 8 ++++---- C4/InstallAuth.pm | 6 +++--- Koha/REST/V1/Auth.pm | 2 +- Koha/Script.pm | 4 ++-- opac/ilsdi.pl | 2 +- t/Token.t | 2 +- t/db_dependent/Auth.t | 6 +++--- t/db_dependent/Koha/Items.t | 2 +- t/db_dependent/Koha/Reviews.t | 2 +- t/db_dependent/Koha/Template/Plugin/Registers.t | 4 ++-- t/db_dependent/Patron/Borrower_Discharge.t | 2 +- t/lib/Mocks.pm | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 30926af608..0d2a9f2d01 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -952,7 +952,7 @@ sub checkauth { } $sessionID = $session->id; - C4::Context->_new_userenv($sessionID); + C4::Context->new_userenv($sessionID); $cookie = $query->cookie( -name => 'CGISESSID', -value => $sessionID, @@ -1509,7 +1509,7 @@ sub check_api_auth { return ( "failed", undef, undef ) unless $session; my $sessionID = $session->id; - C4::Context->_new_userenv($sessionID); + C4::Context->new_userenv($sessionID); my $cookie = $query->cookie( -name => 'CGISESSID', -value => $sessionID, @@ -1695,7 +1695,7 @@ sub check_cookie_auth { $session->param( 'lasttime', time() ); my $flags = defined($flagsrequired) ? haspermission( $userid, $flagsrequired ) : 1; if ($flags) { - C4::Context->_new_userenv($sessionID); + C4::Context->new_userenv($sessionID); C4::Context->interface($session->param('interface')); C4::Context->set_userenv( $session->param('number'), $session->param('id') // '', @@ -1714,7 +1714,7 @@ sub check_cookie_auth { } } else { - C4::Context->_new_userenv($sessionID); + C4::Context->new_userenv($sessionID); C4::Context->interface($session->param('interface')); C4::Context->set_userenv( undef, q{} ); return ( "anon", $session ); diff --git a/C4/InstallAuth.pm b/C4/InstallAuth.pm index 83b72493cf..43d66cf187 100644 --- a/C4/InstallAuth.pm +++ b/C4/InstallAuth.pm @@ -240,7 +240,7 @@ sub checkauth { my ( $userid, $cookie, $sessionID, $flags, $envcookie ); my $logout = $query->param('logout.x'); if ( $sessionID = $query->cookie("CGISESSID") ) { - C4::Context->_new_userenv($sessionID); + C4::Context->new_userenv($sessionID); my $session = CGI::Session->new( "driver:File", $sessionID, { Directory => $sessdir } ); @@ -285,9 +285,9 @@ sub checkauth { CGI::Session->new( "driver:File", undef, { Directory => $sessdir } ); $sessionID = $session->id; $userid = $query->param('userid'); - C4::Context->_new_userenv($sessionID); + C4::Context->new_userenv($sessionID); my $password = $query->param('password'); - C4::Context->_new_userenv($sessionID); + C4::Context->new_userenv($sessionID); my ( $return, $cardnumber ) = checkpw( $userid, $password ); if ($return) { $loggedin = 1; diff --git a/Koha/REST/V1/Auth.pm b/Koha/REST/V1/Auth.pm index 7bbf97fc05..020fbbff90 100644 --- a/Koha/REST/V1/Auth.pm +++ b/Koha/REST/V1/Auth.pm @@ -518,7 +518,7 @@ sub _set_userenv { $THE_library = $patron->library; } - C4::Context->_new_userenv( $patron->borrowernumber ); + C4::Context->new_userenv( $patron->borrowernumber ); C4::Context->set_userenv( $patron->borrowernumber, # number, $patron->userid, # userid, diff --git a/Koha/Script.pm b/Koha/Script.pm index d9e11ea7d8..165bff918d 100644 --- a/Koha/Script.pm +++ b/Koha/Script.pm @@ -46,11 +46,11 @@ sub import { my $class = shift; my @flags = @_; - C4::Context->_new_userenv(1); + C4::Context->new_userenv(1); if ( ( $flags[0] || '' ) eq '-cron' ) { # Set userenv - C4::Context->_new_userenv(1); + C4::Context->new_userenv(1); C4::Context->set_userenv( undef, undef, undef, 'CRON', 'CRON', undef, undef, undef, undef, undef diff --git a/opac/ilsdi.pl b/opac/ilsdi.pl index 8613ac1267..eb91138cec 100755 --- a/opac/ilsdi.pl +++ b/opac/ilsdi.pl @@ -128,7 +128,7 @@ unless ( $cgi->param('service') ) { } # Set the userenv -C4::Context->_new_userenv( 'ILSDI_'.time() ); +C4::Context->new_userenv( 'ILSDI_'.time() ); C4::Context->set_userenv( undef, undef, undef, 'ILSDI', 'ILSDI', undef, undef, undef, undef, undef, diff --git a/t/Token.t b/t/Token.t index 89154a39fd..13ba7c312a 100755 --- a/t/Token.t +++ b/t/Token.t @@ -26,7 +26,7 @@ use Time::HiRes qw|usleep|; use C4::Context; use Koha::Token; -C4::Context->_new_userenv('DUMMY SESSION'); +C4::Context->new_userenv('DUMMY SESSION'); C4::Context->set_userenv(0,42,0,'firstname','surname', 'CPL', 'Library 1', 0, ''); my $tokenizer = Koha::Token->new; diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t index e86790d982..5a7a0d29ef 100755 --- a/t/db_dependent/Auth.t +++ b/t/db_dependent/Auth.t @@ -108,7 +108,7 @@ subtest 'checkauth() tests' => sub { is( $userid, undef, 'If librarian user is used and password with GET, they should not be logged in' ); }; - C4::Context->_new_userenv; # For next tests + C4::Context->new_userenv; # For next tests }; @@ -167,7 +167,7 @@ subtest 'no_set_userenv parameter tests' => sub { ok( checkpw( $dbh, $patron->userid, $password, undef, undef, 1 ), 'checkpw returns true' ); is( C4::Context->userenv, undef, 'Userenv should be undef as required' ); - C4::Context->_new_userenv('DUMMY SESSION'); + C4::Context->new_userenv('DUMMY SESSION'); C4::Context->set_userenv(0,0,0,'firstname','surname', $library->branchcode, 'Library 1', 0, '', ''); is( C4::Context->userenv->{branch}, $library->branchcode, 'Userenv gives correct branch' ); ok( checkpw( $dbh, $patron->userid, $password, undef, undef, 1 ), 'checkpw returns true' ); @@ -641,7 +641,7 @@ subtest 'Userenv clearing in check_cookie_auth' => sub { is( C4::Context->userenv, undef, 'Environment should be cleared too' ); # Show that we clear the userenv again: set up env and check deleted session - C4::Context->_new_userenv( $sessionID ); + C4::Context->new_userenv( $sessionID ); C4::Context->set_userenv; # empty is( defined C4::Context->userenv, 1, 'There should be an empty userenv again' ); ( $auth_status, $session) = C4::Auth::check_cookie_auth( $sessionID ); diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t index dc258b4510..b71f401b8e 100755 --- a/t/db_dependent/Koha/Items.t +++ b/t/db_dependent/Koha/Items.t @@ -1288,7 +1288,7 @@ subtest 'store' => sub { C4::Circulation::LostItem( $item->itemnumber, 1 ); # Unset the userenv - C4::Context->_new_userenv(undef); + C4::Context->new_userenv(undef); # Simluate item marked as found $item->itemlost(0)->store; diff --git a/t/db_dependent/Koha/Reviews.t b/t/db_dependent/Koha/Reviews.t index 7e947a1bb8..794505dd74 100755 --- a/t/db_dependent/Koha/Reviews.t +++ b/t/db_dependent/Koha/Reviews.t @@ -70,7 +70,7 @@ is( $retrieved_review_1_1->review, $new_review_1_1->review, 'Find a review by id subtest 'search_limited' => sub { plan tests => 2; - C4::Context->_new_userenv('xxx'); + C4::Context->new_userenv('xxx'); my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1' } )->store; my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2' } )->store; Koha::Library::Group->new({ parent_id => $group_1->id, branchcode => $patron_1->branchcode })->store(); diff --git a/t/db_dependent/Koha/Template/Plugin/Registers.t b/t/db_dependent/Koha/Template/Plugin/Registers.t index 3e110ff6c5..ebf2318449 100755 --- a/t/db_dependent/Koha/Template/Plugin/Registers.t +++ b/t/db_dependent/Koha/Template/Plugin/Registers.t @@ -45,7 +45,7 @@ subtest 'session_register_id' => sub { '1', "Returns the register id when set in the userenv" ); # Unset the userenv - C4::Context->_new_userenv(undef); + C4::Context->new_userenv(undef); }; subtest 'session_register_name' => sub { @@ -61,7 +61,7 @@ subtest 'session_register_name' => sub { 'Register One', "Returns the register name when set in the userenv" ); # Unset the userenv - C4::Context->_new_userenv(undef); + C4::Context->new_userenv(undef); }; subtest 'all() tests' => sub { diff --git a/t/db_dependent/Patron/Borrower_Discharge.t b/t/db_dependent/Patron/Borrower_Discharge.t index 8c74219537..27bdfaa13b 100755 --- a/t/db_dependent/Patron/Borrower_Discharge.t +++ b/t/db_dependent/Patron/Borrower_Discharge.t @@ -42,7 +42,7 @@ my $library = $builder->build({ source => 'Branch' }); my $another_library = $builder->build({ source => 'Branch' }); my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype}; -C4::Context->_new_userenv('xxx'); +C4::Context->new_userenv('xxx'); my $patron = $builder->build({ source => 'Borrower', value => { diff --git a/t/lib/Mocks.pm b/t/lib/Mocks.pm index 0eaf2106bc..018f33c39a 100644 --- a/t/lib/Mocks.pm +++ b/t/lib/Mocks.pm @@ -115,7 +115,7 @@ Also, some sane defaults are set if no parameters are passed. sub mock_userenv { my ( $params ) = @_; - C4::Context->_new_userenv(42); + C4::Context->new_userenv(42); my $userenv; if ( $params and my $patron = $params->{patron} ) { -- 2.20.1