Bugzilla – Attachment 129867 Details for
Bug 29954
Fix C4::Context->unset_userenv and rename _new too
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29954: Make new_userenv and unset_userenv consistent
Bug-29954-Make-newuserenv-and-unsetuserenv-consist.patch (text/plain), 2.01 KB, created by
Marcel de Rooy
on 2022-01-27 11:11:29 UTC
(
hide
)
Description:
Bug 29954: Make new_userenv and unset_userenv consistent
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-01-27 11:11:29 UTC
Size:
2.01 KB
patch
obsolete
>From 4f9d622917ae7df30b2c9cbb718f40ad5aa0d3a9 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 27 Jan 2022 10:46:32 +0000 >Subject: [PATCH] Bug 29954: Make new_userenv and unset_userenv consistent >Content-Type: text/plain; charset=utf-8 > >Remove the underscore; not a private routine. >--- > C4/Context.pm | 35 ++++++++++++++++------------------- > 1 file changed, 16 insertions(+), 19 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 241589e7b5..8baf029861 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -747,44 +747,41 @@ sub set_userenv { > return $cell; > } > >-=head2 _new_userenv >+=head2 new_userenv > >- C4::Context->_new_userenv($session); # FIXME: This calling style is wrong for what looks like an _internal function >+ C4::Context->new_userenv($session); > > Builds a hash for user environment variables. > > This hash shall be cached for future use: if you call > C<C4::Context-E<gt>userenv> twice, you will get the same hash without real DB access > >-_new_userenv is called in Auth.pm >+new_userenv is called in Auth.pm > > =cut > >-#' >-sub _new_userenv >-{ >- shift; # Useless except it compensates for bad calling style >- my ($sessionID)= @_; >- $context->{"activeuser"}=$sessionID; >+sub new_userenv { >+ my ( $class, $sessionID ) = @_; >+ $context->{activeuser} = $sessionID; > } > >-=head2 _unset_userenv >+=head2 unset_userenv > >- C4::Context->_unset_userenv; >+ C4::Context->unset_userenv( $sessionID ); > >-Destroys the hash for activeuser user environment variables. >+Destroys the hash for activeuser user environment variables if sessionID matches. > > =cut > >-#' >- >-sub _unset_userenv >-{ >- my ($sessionID)= @_; >- undef $context->{"activeuser"} if ($context->{"activeuser"} eq $sessionID); >+sub unset_userenv { >+ my ( $class, $sessionID )= @_; >+ if( defined($sessionID) && defined($context->{activeuser}) && >+ $context->{activeuser} eq $sessionID ) >+ { >+ undef $context->{activeuser}; >+ } > } > >- > =head2 get_versions > > C4::Context->get_versions >-- >2.20.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 29954
: 129867 |
129868
|
129869
|
129870