Skip to content

Commit

Permalink
Issue #2919: perlimports check for MIME::Base64
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed Feb 2, 2024
1 parent 43bdbec commit 954d3bf
Show file tree
Hide file tree
Showing 28 changed files with 109 additions and 62 deletions.
9 changes: 7 additions & 2 deletions Kernel/GenericInterface/Invoker/Ticket/Common.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Kernel/GenericInterface/Operation/Ticket/Common.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use strict;
use warnings;

# core modules
use MIME::Base64();
use MIME::Base64 qw(decode_base64);
use Encode;

# CPAN modules
Expand Down Expand Up @@ -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},
);
Expand Down
4 changes: 2 additions & 2 deletions Kernel/GenericInterface/Operation/Ticket/TicketCreate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use parent qw(

# core modules
use Scalar::Util qw(reftype);
use MIME::Base64 qw(encode_base64);

# CPAN modules

Expand Down Expand Up @@ -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;
Expand All @@ -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};
}

Expand Down
12 changes: 8 additions & 4 deletions Kernel/GenericInterface/Operation/Ticket/TicketGet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Kernel/GenericInterface/Operation/Ticket/TicketUpdate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use parent qw(

# core modules
use Scalar::Util qw(reftype);
use MIME::Base64 qw(encode_base64);

# CPAN modules

Expand Down Expand Up @@ -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;
Expand All @@ -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};
}

Expand Down
2 changes: 1 addition & 1 deletion Kernel/GenericInterface/Transport/HTTP/REST.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion Kernel/GenericInterface/Transport/HTTP/SOAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use warnings;
use namespace::autoclean;

# core modules
use MIME::Base64;
use PerlIO;

# CPAN modules
Expand Down
6 changes: 5 additions & 1 deletion Kernel/Modules/PublicCalendar.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions Kernel/System/AuthSession/DB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use warnings;
use utf8;

# core modules
use MIME::Base64 ();
use MIME::Base64 qw(decode_base64 encode_base64);

# CPAN modules

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -671,7 +671,7 @@ sub _SQLCreate {
{

# dump the data
$Value = MIME::Base64::encode_base64(
$Value = encode_base64(
$StorableObject->Serialize( Data => $Value )
);
$Serialized = 1;
Expand Down Expand Up @@ -737,7 +737,7 @@ sub _SQLCreate {
}

# dump the data
$Value = MIME::Base64::encode_base64(
$Value = encode_base64(
$StorableObject->Serialize( Data => $Value )
);
$Serialized = 1;
Expand Down Expand Up @@ -805,7 +805,7 @@ sub _SQLCreate {
{

# dump the data
$Value = MIME::Base64::encode_base64(
$Value = encode_base64(
$StorableObject->Serialize( Data => $Value )
);
$Serialized = 1;
Expand Down
8 changes: 4 additions & 4 deletions Kernel/System/Calendar.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 = '
Expand Down Expand Up @@ -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,
);
Expand Down Expand Up @@ -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 = '
Expand Down
7 changes: 6 additions & 1 deletion Kernel/System/Daemon/SchedulerDB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
2 changes: 1 addition & 1 deletion Kernel/System/EmailParser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();

Expand Down
15 changes: 10 additions & 5 deletions Kernel/System/FormDraft.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Kernel/System/HTMLUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use namespace::autoclean;
use utf8;

# core modules
use MIME::Base64;
use MIME::Base64 qw(decode_base64); ## no perlimorts

# CPAN modules

Expand Down
6 changes: 5 additions & 1 deletion Kernel/System/MailQueue.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
6 changes: 3 additions & 3 deletions Kernel/System/MigrateFromOTRS/CloneDB/Driver/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Kernel/System/Package.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions Kernel/System/Stats.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion Kernel/System/StdAttachment.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
9 changes: 6 additions & 3 deletions Kernel/System/SysConfig/DB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading

0 comments on commit 954d3bf

Please sign in to comment.