Bugzilla – Attachment 194379 Details for
Bug 41972
Move C4::Context->interface to Koha::Context::Interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41972: Move C4::Context->interface to Koha::Context::Interface
3f3f9b7.patch (text/plain), 2.26 KB, created by
Jonathan Druart
on 2026-03-03 12:54:28 UTC
(
hide
)
Description:
Bug 41972: Move C4::Context->interface to Koha::Context::Interface
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2026-03-03 12:54:28 UTC
Size:
2.26 KB
patch
obsolete
>From 3f3f9b7c2dd50b7d47e11cd954ad7af74075c27c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 3 Mar 2026 13:49:13 +0100 >Subject: [PATCH] Bug 41972: Move C4::Context->interface to > Koha::Context::Interface > >--- > C4/Context.pm | 18 ++++-------------- > Koha/Context/Interface.pm | 28 ++++++++++++++++++++++++++++ > 2 files changed, 32 insertions(+), 14 deletions(-) > create mode 100644 Koha/Context/Interface.pm > >diff --git a/C4/Context.pm b/C4/Context.pm >index 3834c2a0038..1cc4b6c44c5 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -52,6 +52,7 @@ use Koha::Context::Preferences; > use Koha::Config; > use Koha::Database; > use Koha::Context::UserEnv; >+use Koha::Context::Interface; > > =head1 NAME > >@@ -816,21 +817,10 @@ sub interface { > my ( $class, $interface ) = @_; > > if ( defined $interface ) { >- $interface = lc $interface; >- if ( $interface eq 'api' >- || $interface eq 'opac' >- || $interface eq 'intranet' >- || $interface eq 'sip' >- || $interface eq 'cron' >- || $interface eq 'commandline' ) >- { >- $context->{interface} = $interface; >- } else { >- warn "invalid interface : '$interface'"; >- } >+ return Koha::Context::Interface::set_interface($interface); >+ } else { >+ return Koha::Context::Interface::get_interface(); > } >- >- return $context->{interface} // 'opac'; > } > > # always returns a string for OK comparison via "eq" or "ne" >diff --git a/Koha/Context/Interface.pm b/Koha/Context/Interface.pm >new file mode 100644 >index 00000000000..b6cdf7b6fcf >--- /dev/null >+++ b/Koha/Context/Interface.pm >@@ -0,0 +1,28 @@ >+package Koha::Context::Interface; >+ >+use Modern::Perl; >+ >+my $INTERFACE = undef; >+ >+sub set_interface { >+ my ($interface) = @_; >+ $interface = lc $interface; >+ if ( $interface eq 'api' >+ || $interface eq 'opac' >+ || $interface eq 'intranet' >+ || $interface eq 'sip' >+ || $interface eq 'cron' >+ || $interface eq 'commandline' ) >+ { >+ $INTERFACE = $interface; >+ } else { >+ warn "Invalid interface: '$interface'"; >+ } >+ return $INTERFACE; >+} >+ >+sub get_interface { >+ return $INTERFACE // 'opac'; >+} >+ >+1; >-- >2.43.0 >
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 41972
: 194379