From 954d3bf84cfcb2666f5d9715f14f4ca2d921621c Mon Sep 17 00:00:00 2001 From: bernhard Date: Fri, 2 Feb 2024 16:44:50 +0100 Subject: [PATCH] Issue #2919: perlimports check for MIME::Base64 --- Kernel/GenericInterface/Invoker/Ticket/Common.pm | 9 +++++++-- .../GenericInterface/Operation/Ticket/Common.pm | 4 ++-- .../Operation/Ticket/TicketCreate.pm | 4 ++-- .../Operation/Ticket/TicketGet.pm | 12 ++++++++---- .../Operation/Ticket/TicketUpdate.pm | 4 ++-- Kernel/GenericInterface/Transport/HTTP/REST.pm | 2 +- Kernel/GenericInterface/Transport/HTTP/SOAP.pm | 1 - Kernel/Modules/PublicCalendar.pm | 6 +++++- Kernel/System/AuthSession/DB.pm | 10 +++++----- Kernel/System/Calendar.pm | 8 ++++---- Kernel/System/Daemon/SchedulerDB.pm | 7 ++++++- Kernel/System/EmailParser.pm | 2 +- Kernel/System/FormDraft.pm | 15 ++++++++++----- Kernel/System/HTMLUtils.pm | 2 +- Kernel/System/MailQueue.pm | 6 +++++- .../System/MigrateFromOTRS/CloneDB/Driver/Base.pm | 6 +++--- Kernel/System/Package.pm | 2 +- Kernel/System/Stats.pm | 6 ++++-- Kernel/System/StdAttachment.pm | 7 ++++++- Kernel/System/SysConfig/DB.pm | 9 ++++++--- .../Article/Backend/MIMEBase/ArticleStorageDB.pm | 2 +- Kernel/System/VirtualFS/DB.pm | 7 ++++++- Kernel/System/Web/UploadCache/DB.pm | 7 ++++++- .../Ticket/TicketCreateIncludeTicketData.t | 10 +++------- .../GenericInterface/Operation/Ticket/TicketGet.t | 2 +- .../Operation/Ticket/TicketHistoryGet.t | 12 ++++++------ .../Operation/Ticket/TicketSearch.t | 2 +- scripts/tools/base64.pl | 7 ++++++- 28 files changed, 109 insertions(+), 62 deletions(-) diff --git a/Kernel/GenericInterface/Invoker/Ticket/Common.pm b/Kernel/GenericInterface/Invoker/Ticket/Common.pm index 019304104..b276da208 100644 --- a/Kernel/GenericInterface/Invoker/Ticket/Common.pm +++ b/Kernel/GenericInterface/Invoker/Ticket/Common.pm @@ -16,12 +16,17 @@ package Kernel::GenericInterface::Invoker::Ticket::Common; +use v5.24; use strict; use warnings; -use v5.24; -use MIME::Base64; +# core modules +use MIME::Base64 qw(encode_base64); use Storable; + +# CPAN modules + +# OTOBO modules use Kernel::System::VariableCheck qw(:all); our $ObjectManagerDisabled = 1; diff --git a/Kernel/GenericInterface/Operation/Ticket/Common.pm b/Kernel/GenericInterface/Operation/Ticket/Common.pm index 7fdc13eb7..76833a722 100644 --- a/Kernel/GenericInterface/Operation/Ticket/Common.pm +++ b/Kernel/GenericInterface/Operation/Ticket/Common.pm @@ -20,7 +20,7 @@ use strict; use warnings; # core modules -use MIME::Base64(); +use MIME::Base64 qw(decode_base64); use Encode; # CPAN modules @@ -1432,7 +1432,7 @@ sub CreateAttachment { # write attachment my $Success = $ArticleBackendObject->ArticleWriteAttachment( %{ $Param{Attachment} }, - Content => MIME::Base64::decode_base64( $Param{Attachment}->{Content} ), + Content => decode_base64( $Param{Attachment}->{Content} ), ArticleID => $Param{ArticleID}, UserID => $Param{UserID}, ); diff --git a/Kernel/GenericInterface/Operation/Ticket/TicketCreate.pm b/Kernel/GenericInterface/Operation/Ticket/TicketCreate.pm index 8a7906c83..f4e70d098 100644 --- a/Kernel/GenericInterface/Operation/Ticket/TicketCreate.pm +++ b/Kernel/GenericInterface/Operation/Ticket/TicketCreate.pm @@ -27,6 +27,7 @@ use parent qw( # core modules use Scalar::Util qw(reftype); +use MIME::Base64 qw(encode_base64); # CPAN modules @@ -1670,7 +1671,6 @@ sub _TicketCreate { ); my @Attachments; - $Kernel::OM->Get('Kernel::System::Main')->Require('MIME::Base64'); ATTACHMENT: for my $FileID ( sort keys %AttachmentIndex ) { next ATTACHMENT if !$FileID; @@ -1682,7 +1682,7 @@ sub _TicketCreate { next ATTACHMENT if !IsHashRefWithData( \%Attachment ); # convert content to base64, but prevent 76 chars brake, see bug#14500. - $Attachment{Content} = MIME::Base64::encode_base64( $Attachment{Content}, '' ); + $Attachment{Content} = encode_base64( $Attachment{Content}, '' ); push @Attachments, {%Attachment}; } diff --git a/Kernel/GenericInterface/Operation/Ticket/TicketGet.pm b/Kernel/GenericInterface/Operation/Ticket/TicketGet.pm index b77bc5baf..0314e8076 100644 --- a/Kernel/GenericInterface/Operation/Ticket/TicketGet.pm +++ b/Kernel/GenericInterface/Operation/Ticket/TicketGet.pm @@ -19,15 +19,19 @@ package Kernel::GenericInterface::Operation::Ticket::TicketGet; use strict; use warnings; -use MIME::Base64; - -use Kernel::System::VariableCheck qw(IsArrayRefWithData IsHashRefWithData IsStringWithData); - use parent qw( Kernel::GenericInterface::Operation::Common Kernel::GenericInterface::Operation::Ticket::Common ); +# core modules +use MIME::Base64 qw(encode_base64); + +# CPAN modules + +# OTOBO modules +use Kernel::System::VariableCheck qw(IsArrayRefWithData IsHashRefWithData IsStringWithData); + our $ObjectManagerDisabled = 1; =head1 NAME diff --git a/Kernel/GenericInterface/Operation/Ticket/TicketUpdate.pm b/Kernel/GenericInterface/Operation/Ticket/TicketUpdate.pm index b9516f21b..b761ef965 100644 --- a/Kernel/GenericInterface/Operation/Ticket/TicketUpdate.pm +++ b/Kernel/GenericInterface/Operation/Ticket/TicketUpdate.pm @@ -27,6 +27,7 @@ use parent qw( # core modules use Scalar::Util qw(reftype); +use MIME::Base64 qw(encode_base64); # CPAN modules @@ -2287,7 +2288,6 @@ sub _TicketUpdate { ); my @Attachments; - $Kernel::OM->Get('Kernel::System::Main')->Require('MIME::Base64'); ATTACHMENT: for my $FileID ( sort keys %AttachmentIndex ) { next ATTACHMENT if !$FileID; @@ -2299,7 +2299,7 @@ sub _TicketUpdate { next ATTACHMENT if !IsHashRefWithData( \%Attachment ); # convert content to base64, but prevent 76 chars brake, see bug#14500. - $Attachment{Content} = MIME::Base64::encode_base64( $Attachment{Content}, '' ); + $Attachment{Content} = encode_base64( $Attachment{Content}, '' ); push @Attachments, {%Attachment}; } diff --git a/Kernel/GenericInterface/Transport/HTTP/REST.pm b/Kernel/GenericInterface/Transport/HTTP/REST.pm index ef7a2f6de..2eb971b1e 100644 --- a/Kernel/GenericInterface/Transport/HTTP/REST.pm +++ b/Kernel/GenericInterface/Transport/HTTP/REST.pm @@ -22,7 +22,7 @@ use warnings; use namespace::autoclean; # core modules -use MIME::Base64; +use MIME::Base64 qw(encode_base64); # CPAN modules use HTTP::Status; diff --git a/Kernel/GenericInterface/Transport/HTTP/SOAP.pm b/Kernel/GenericInterface/Transport/HTTP/SOAP.pm index a0c1d1477..96871019b 100644 --- a/Kernel/GenericInterface/Transport/HTTP/SOAP.pm +++ b/Kernel/GenericInterface/Transport/HTTP/SOAP.pm @@ -22,7 +22,6 @@ use warnings; use namespace::autoclean; # core modules -use MIME::Base64; use PerlIO; # CPAN modules diff --git a/Kernel/Modules/PublicCalendar.pm b/Kernel/Modules/PublicCalendar.pm index 6b2ad4a43..0b0c6f15a 100644 --- a/Kernel/Modules/PublicCalendar.pm +++ b/Kernel/Modules/PublicCalendar.pm @@ -19,7 +19,11 @@ package Kernel::Modules::PublicCalendar; use strict; use warnings; -use MIME::Base64 (); +# core modules + +# CPAN modules + +# OTOBO modules use Kernel::Language qw(Translatable); our $ObjectManagerDisabled = 1; diff --git a/Kernel/System/AuthSession/DB.pm b/Kernel/System/AuthSession/DB.pm index ae0da56dd..9fba2e71b 100644 --- a/Kernel/System/AuthSession/DB.pm +++ b/Kernel/System/AuthSession/DB.pm @@ -23,7 +23,7 @@ use warnings; use utf8; # core modules -use MIME::Base64 (); +use MIME::Base64 qw(decode_base64 encode_base64); # CPAN modules @@ -207,7 +207,7 @@ sub GetSessionIDData { # deserialize data if needed if ( $Row[3] ) { my $Value = eval { - $StorableObject->Deserialize( Data => MIME::Base64::decode_base64( $Row[2] ) ); + $StorableObject->Deserialize( Data => decode_base64( $Row[2] ) ); }; # workaround for the oracle problem with empty @@ -671,7 +671,7 @@ sub _SQLCreate { { # dump the data - $Value = MIME::Base64::encode_base64( + $Value = encode_base64( $StorableObject->Serialize( Data => $Value ) ); $Serialized = 1; @@ -737,7 +737,7 @@ sub _SQLCreate { } # dump the data - $Value = MIME::Base64::encode_base64( + $Value = encode_base64( $StorableObject->Serialize( Data => $Value ) ); $Serialized = 1; @@ -805,7 +805,7 @@ sub _SQLCreate { { # dump the data - $Value = MIME::Base64::encode_base64( + $Value = encode_base64( $StorableObject->Serialize( Data => $Value ) ); $Serialized = 1; diff --git a/Kernel/System/Calendar.pm b/Kernel/System/Calendar.pm index 4776d9de9..7570b3d97 100644 --- a/Kernel/System/Calendar.pm +++ b/Kernel/System/Calendar.pm @@ -23,7 +23,7 @@ use parent qw(Kernel::System::EventHandler); # core modules use Digest::MD5; -use MIME::Base64 (); +use MIME::Base64 qw(decode_base64 encode_base64); # CPAN modules @@ -177,7 +177,7 @@ sub CalendarCreate { Data => $Param{TicketAppointments}, ); $Kernel::OM->Get('Kernel::System::Encode')->EncodeOutput($TicketAppointments); - $TicketAppointments = MIME::Base64::encode_base64($TicketAppointments); + $TicketAppointments = encode_base64($TicketAppointments); } my $SQL = ' @@ -337,7 +337,7 @@ sub CalendarGet { # decode and deserialize ticket appointment data my $TicketAppointments; if ( $Row[4] ) { - my $DecodedData = MIME::Base64::decode_base64( $Row[4] ); + my $DecodedData = decode_base64( $Row[4] ); $TicketAppointments = $Kernel::OM->Get('Kernel::System::Storable')->Deserialize( Data => $DecodedData, ); @@ -587,7 +587,7 @@ sub CalendarUpdate { Data => $Param{TicketAppointments}, ); $Kernel::OM->Get('Kernel::System::Encode')->EncodeOutput($TicketAppointments); - $TicketAppointments = MIME::Base64::encode_base64($TicketAppointments); + $TicketAppointments = encode_base64($TicketAppointments); } my $SQL = ' diff --git a/Kernel/System/Daemon/SchedulerDB.pm b/Kernel/System/Daemon/SchedulerDB.pm index 0601a44cb..c24c4a053 100644 --- a/Kernel/System/Daemon/SchedulerDB.pm +++ b/Kernel/System/Daemon/SchedulerDB.pm @@ -19,9 +19,14 @@ package Kernel::System::Daemon::SchedulerDB; use strict; use warnings; -use MIME::Base64; +# core modules +use MIME::Base64 qw(decode_base64 encode_base64); use Time::HiRes; +# CPAN modules + +# OTOBO modules + use Kernel::System::VariableCheck qw(:all); our @ObjectDependencies = ( diff --git a/Kernel/System/EmailParser.pm b/Kernel/System/EmailParser.pm index bd4137b20..59ca8caff 100644 --- a/Kernel/System/EmailParser.pm +++ b/Kernel/System/EmailParser.pm @@ -26,7 +26,7 @@ use warnings; use Mail::Internet; use MIME::Parser; use MIME::QuotedPrint; -use MIME::Base64; +use MIME::Base64 qw(decode_base64); use MIME::Words qw(:all); use Mail::Address (); diff --git a/Kernel/System/FormDraft.pm b/Kernel/System/FormDraft.pm index cfedca839..748ca0dcf 100644 --- a/Kernel/System/FormDraft.pm +++ b/Kernel/System/FormDraft.pm @@ -19,10 +19,15 @@ package Kernel::System::FormDraft; use strict; use warnings; -use Kernel::System::VariableCheck qw(:all); -use MIME::Base64; +# core modules +use MIME::Base64 qw(decode_base64 encode_base64); use Storable; +# CPAN modules + +# OTOBO modules +use Kernel::System::VariableCheck qw(:all); + our @ObjectDependencies = ( 'Kernel::System::Cache', 'Kernel::System::DB', @@ -199,7 +204,7 @@ sub FormDraftGet { my $StorableContent = $RawContent; if ( !$DBObject->GetDatabaseFunction('DirectBlob') ) { - $StorableContent = MIME::Base64::decode_base64($RawContent); + $StorableContent = decode_base64($RawContent); } # convert form and file data from yaml @@ -317,7 +322,7 @@ sub FormDraftAdd { my $Content = $StorableContent; if ( !$DBObject->GetDatabaseFunction('DirectBlob') ) { - $Content = MIME::Base64::encode_base64($StorableContent); + $Content = encode_base64($StorableContent); } # add to database @@ -431,7 +436,7 @@ sub FormDraftUpdate { my $Content = $StorableContent; if ( !$DBObject->GetDatabaseFunction('DirectBlob') ) { - $Content = MIME::Base64::encode_base64($StorableContent); + $Content = encode_base64($StorableContent); } # add to database diff --git a/Kernel/System/HTMLUtils.pm b/Kernel/System/HTMLUtils.pm index 76119c4c5..adf1b2a2f 100644 --- a/Kernel/System/HTMLUtils.pm +++ b/Kernel/System/HTMLUtils.pm @@ -23,7 +23,7 @@ use namespace::autoclean; use utf8; # core modules -use MIME::Base64; +use MIME::Base64 qw(decode_base64); ## no perlimorts # CPAN modules diff --git a/Kernel/System/MailQueue.pm b/Kernel/System/MailQueue.pm index d0b6a6dc0..577173545 100644 --- a/Kernel/System/MailQueue.pm +++ b/Kernel/System/MailQueue.pm @@ -21,8 +21,12 @@ use warnings; use parent qw(Kernel::System::EventHandler); -use MIME::Base64; +# core modules +use MIME::Base64 qw(decode_base64 encode_base64); +# CPAN modules + +# OTOBO modules use Kernel::System::VariableCheck qw(:all); our @ObjectDependencies = ( diff --git a/Kernel/System/MigrateFromOTRS/CloneDB/Driver/Base.pm b/Kernel/System/MigrateFromOTRS/CloneDB/Driver/Base.pm index 1d22072cc..355a15d4b 100644 --- a/Kernel/System/MigrateFromOTRS/CloneDB/Driver/Base.pm +++ b/Kernel/System/MigrateFromOTRS/CloneDB/Driver/Base.pm @@ -23,9 +23,9 @@ use namespace::autoclean; # core modules use Encode; -use MIME::Base64; -use List::Util qw(any none); -use Fcntl qw(:flock); +use MIME::Base64 qw(decode_base64 encode_base64); +use List::Util qw(any none); +use Fcntl qw(:flock); # CPAN modules diff --git a/Kernel/System/Package.pm b/Kernel/System/Package.pm index 95763ae1b..7cf7ba234 100644 --- a/Kernel/System/Package.pm +++ b/Kernel/System/Package.pm @@ -25,7 +25,7 @@ use utf8; use parent qw(Kernel::System::EventHandler); # core modules -use MIME::Base64 qw(encode_base64 decode_base64); +use MIME::Base64 qw(decode_base64 encode_base64); use File::Copy qw(copy move); # CPAN modules diff --git a/Kernel/System/Stats.pm b/Kernel/System/Stats.pm index 1c39d7b30..e20c65c74 100644 --- a/Kernel/System/Stats.pm +++ b/Kernel/System/Stats.pm @@ -19,10 +19,12 @@ package Kernel::System::Stats; use strict; use warnings; -use MIME::Base64; - +# core modules use POSIX qw(ceil); +# CPAN modules + +# OTOBO modules use Kernel::Language qw(Translatable); use Kernel::System::VariableCheck qw(:all); use Kernel::Output::HTML::Statistics::View; diff --git a/Kernel/System/StdAttachment.pm b/Kernel/System/StdAttachment.pm index b3d8fd44e..0d765e7b9 100644 --- a/Kernel/System/StdAttachment.pm +++ b/Kernel/System/StdAttachment.pm @@ -19,7 +19,12 @@ package Kernel::System::StdAttachment; use strict; use warnings; -use MIME::Base64; +# core modules +use MIME::Base64 qw(decode_base64 encode_base64); + +# CPAN modules + +# OTOBO modules our @ObjectDependencies = ( 'Kernel::System::Cache', diff --git a/Kernel/System/SysConfig/DB.pm b/Kernel/System/SysConfig/DB.pm index 5546baa85..b964a39bb 100644 --- a/Kernel/System/SysConfig/DB.pm +++ b/Kernel/System/SysConfig/DB.pm @@ -18,11 +18,14 @@ package Kernel::System::SysConfig::DB; use strict; use warnings; - -use MIME::Base64; -use Time::HiRes(); use utf8; +# core modules +use Time::HiRes (); + +# CPAN modules + +# OTOBO modules use Kernel::System::VariableCheck qw( :all ); our @ObjectDependencies = ( diff --git a/Kernel/System/Ticket/Article/Backend/MIMEBase/ArticleStorageDB.pm b/Kernel/System/Ticket/Article/Backend/MIMEBase/ArticleStorageDB.pm index e6b615d20..7551a262f 100644 --- a/Kernel/System/Ticket/Article/Backend/MIMEBase/ArticleStorageDB.pm +++ b/Kernel/System/Ticket/Article/Backend/MIMEBase/ArticleStorageDB.pm @@ -23,7 +23,7 @@ use v5.24; use parent qw(Kernel::System::Ticket::Article::Backend::MIMEBase::Base); # core modules -use MIME::Base64 qw(encode_base64 decode_base64); +use MIME::Base64 qw(decode_base64 encode_base64); # CPAN modules diff --git a/Kernel/System/VirtualFS/DB.pm b/Kernel/System/VirtualFS/DB.pm index 56f4eac48..e8ddff70d 100644 --- a/Kernel/System/VirtualFS/DB.pm +++ b/Kernel/System/VirtualFS/DB.pm @@ -19,7 +19,12 @@ package Kernel::System::VirtualFS::DB; use strict; use warnings; -use MIME::Base64; +# core modules +use MIME::Base64 qw(decode_base64 encode_base64); + +# CPAN modules + +# OTOBO modules our @ObjectDependencies = ( 'Kernel::System::DB', diff --git a/Kernel/System/Web/UploadCache/DB.pm b/Kernel/System/Web/UploadCache/DB.pm index 101a5965c..8d7fed855 100644 --- a/Kernel/System/Web/UploadCache/DB.pm +++ b/Kernel/System/Web/UploadCache/DB.pm @@ -19,7 +19,12 @@ package Kernel::System::Web::UploadCache::DB; use strict; use warnings; -use MIME::Base64; +# core modules +use MIME::Base64 qw(decode_base64 encode_base64); + +# CPAN modules + +# OTOBO modules our @ObjectDependencies = ( 'Kernel::Config', diff --git a/scripts/test/GenericInterface/Operation/Ticket/TicketCreateIncludeTicketData.t b/scripts/test/GenericInterface/Operation/Ticket/TicketCreateIncludeTicketData.t index a8de3a2e9..f7e397a5b 100644 --- a/scripts/test/GenericInterface/Operation/Ticket/TicketCreateIncludeTicketData.t +++ b/scripts/test/GenericInterface/Operation/Ticket/TicketCreateIncludeTicketData.t @@ -19,24 +19,20 @@ use warnings; use utf8; # core modules +use Socket; # CPAN modules use Test2::V0; # OTOBO modules use Kernel::System::UnitTest::RegisterDriver; # Set up $Kernel::OM and $main::Self - -our $Self; - -use Socket; -use MIME::Base64; - use Kernel::GenericInterface::Debugger; use Kernel::GenericInterface::Operation::Ticket::TicketCreate; use Kernel::GenericInterface::Operation::Session::SessionCreate; - use Kernel::System::VariableCheck qw(IsArrayRefWithData IsHashRefWithData IsStringWithData); +our $Self; + # get needed objects my $ConfigObject = $Kernel::OM->Get('Kernel::Config'); my $SysConfigObject = $Kernel::OM->Get('Kernel::System::SysConfig'); diff --git a/scripts/test/GenericInterface/Operation/Ticket/TicketGet.t b/scripts/test/GenericInterface/Operation/Ticket/TicketGet.t index 8b6e04962..9d235a390 100644 --- a/scripts/test/GenericInterface/Operation/Ticket/TicketGet.t +++ b/scripts/test/GenericInterface/Operation/Ticket/TicketGet.t @@ -19,7 +19,7 @@ use warnings; use utf8; # core modules -use MIME::Base64; +use MIME::Base64 qw(encode_base64); # CPAN modules use Test2::V0; diff --git a/scripts/test/GenericInterface/Operation/Ticket/TicketHistoryGet.t b/scripts/test/GenericInterface/Operation/Ticket/TicketHistoryGet.t index e0d57e132..57126f1ba 100644 --- a/scripts/test/GenericInterface/Operation/Ticket/TicketHistoryGet.t +++ b/scripts/test/GenericInterface/Operation/Ticket/TicketHistoryGet.t @@ -18,19 +18,19 @@ use strict; use warnings; use utf8; -# Set up the test driver $Self when we are running as a standalone script. -use Kernel::System::UnitTest::RegisterDriver; +# core modules -our $Self; - -use MIME::Base64; +# CPAN modules +# OTOBO modules +use Kernel::System::UnitTest::RegisterDriver; # Set up $Kernel::OM and the test driver $Self use Kernel::GenericInterface::Debugger; use Kernel::GenericInterface::Operation::Session::SessionCreate; use Kernel::GenericInterface::Operation::Ticket::TicketHistoryGet; - use Kernel::System::VariableCheck qw(:all); +our $Self; + my $ConfigObject = $Kernel::OM->Get('Kernel::Config'); # disable SessionCheckRemoteIP setting diff --git a/scripts/test/GenericInterface/Operation/Ticket/TicketSearch.t b/scripts/test/GenericInterface/Operation/Ticket/TicketSearch.t index e6782ff94..cf967ddca 100644 --- a/scripts/test/GenericInterface/Operation/Ticket/TicketSearch.t +++ b/scripts/test/GenericInterface/Operation/Ticket/TicketSearch.t @@ -19,7 +19,7 @@ use warnings; use utf8; # core modules -use MIME::Base64; +use MIME::Base64 qw(encode_base64); # CPAN modules use Test2::V0; diff --git a/scripts/tools/base64.pl b/scripts/tools/base64.pl index 03a41ec44..0ac5963f9 100755 --- a/scripts/tools/base64.pl +++ b/scripts/tools/base64.pl @@ -18,7 +18,12 @@ use strict; use warnings; -use MIME::Base64; +# core modules +use MIME::Base64 qw(decode_base64 encode_base64); + +# CPAN modules + +# OTOBO modules # get type my $Type = shift;