From d4818ecc846d556182e6122eda6febb19328e9b5 Mon Sep 17 00:00:00 2001 From: bernhard Date: Wed, 13 Mar 2024 13:34:14 +0100 Subject: [PATCH] Issue #2313: eliminate useless use of ObjectManager also eliminate useless constructur when only a method is called. --- scripts/DBUpdate-to-11.0.pl | 18 ++---------------- scripts/DBUpdateTo11_0.pm | 15 ++------------- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/scripts/DBUpdate-to-11.0.pl b/scripts/DBUpdate-to-11.0.pl index 459c0ed440..6f9da22e4e 100755 --- a/scripts/DBUpdate-to-11.0.pl +++ b/scripts/DBUpdate-to-11.0.pl @@ -32,6 +32,7 @@ # OTOBO modules use Kernel::System::ObjectManager (); +use scripts::DBUpdateTo11_0 (); $Kernel::OM = Kernel::System::ObjectManager->new( 'Kernel::System::Log' => { @@ -39,21 +40,6 @@ }, ); -## get options -#my %Options = ( -# Help => 0, -# NonInteractive => 0, -# Timing => 0, -# Verbose => 0, -#); -#Getopt::Long::GetOptions( -# 'help', \$Options{Help}, -# 'non-interactive', \$Options{NonInteractive}, -# 'cleanup-orphaned-articles', \$Options{CleanupOrphanedArticles}, -# 'timing', \$Options{Timing}, -# 'verbose', \$Options{Verbose}, -#); - -$Kernel::OM->Create('scripts::DBUpdateTo11_0')->Run; +scripts::DBUpdateTo11_0::Run(); exit 0; diff --git a/scripts/DBUpdateTo11_0.pm b/scripts/DBUpdateTo11_0.pm index 53e8875ffc..8bdef18798 100644 --- a/scripts/DBUpdateTo11_0.pm +++ b/scripts/DBUpdateTo11_0.pm @@ -29,24 +29,13 @@ scripts::DBUpdateTo11_0 - Perform system upgrade from OTOBO 10.1 to 11.0 =head1 PUBLIC INTERFACE -=head2 new() +=head1 Run -Don't use the constructor directly, use the ObjectManager instead: - - my $DBUpdateObject = $Kernel::OM->Get('scripts::DBUpdateTo11_0'); +This method is run without parameters. =cut -sub new { - my ( $Type, %Param ) = @_; - - # allocate new hash for object - return bless {}, $Type; -} - sub Run { - my ( $Self, %Param ) = @_; - print "\n Migration started ... \n"; my $SuccessfulMigration = 1;