From 2bc4563b2c3d4bf896485cc48ca0dc114fc55605 Mon Sep 17 00:00:00 2001 From: Emin Yazi Date: Thu, 25 Jul 2024 17:45:39 +0200 Subject: [PATCH 1/4] Avoid database calls in the installer. --- Kernel/Output/HTML/Layout.pm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Kernel/Output/HTML/Layout.pm b/Kernel/Output/HTML/Layout.pm index 3de1d2ffcc..8d9cab4da9 100644 --- a/Kernel/Output/HTML/Layout.pm +++ b/Kernel/Output/HTML/Layout.pm @@ -1310,7 +1310,9 @@ sub Header { # Generate the minified CSS and JavaScript files and the tags referencing them (see LayoutLoader) $Self->LoaderCreateAgentCSSCalls(); - $Self->LoaderCreateDynamicCSS(); + if ( !$Self->{InstallerOnly} ) { + $Self->LoaderCreateDynamicCSS(); + } my %AgentLogo; @@ -1758,10 +1760,14 @@ sub Footer { } # Set an array with pending states. - my @PendingStateIDs = $Kernel::OM->Get('Kernel::System::State')->StateGetStatesByType( - StateType => [ 'pending reminder', 'pending auto' ], - Result => 'ID', - ); + my @PendingStateIDs; + + if ( !$Self->{InstallerOnly} ) { + @PendingStateIDs = $Kernel::OM->Get('Kernel::System::State')->StateGetStatesByType( + StateType => [ 'pending reminder', 'pending auto' ], + Result => 'ID', + ); + } # add JS data my %JSConfig = ( From 09ca2134cd169fd7f9d5b8846e99fa649b999547 Mon Sep 17 00:00:00 2001 From: Emin Yazi Date: Thu, 25 Jul 2024 17:58:13 +0200 Subject: [PATCH 2/4] Check if the packages directory exists to avoid error messages. --- Kernel/System/Package.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Kernel/System/Package.pm b/Kernel/System/Package.pm index c60a3adeac..799ea96e0f 100644 --- a/Kernel/System/Package.pm +++ b/Kernel/System/Package.pm @@ -2571,7 +2571,11 @@ sub PackageInstallDefaultFiles { # get main object my $MainObject = $Kernel::OM->Get('Kernel::System::Main'); - my $Directory = $Self->{ConfigObject}->Get('Home') . '/var/packages'; + my $Directory = $Self->{ConfigObject}->Get('Home') . '/var/packages'; + + # Return if the directory does not exist. + return if !-e $Directory; + my @PackageFiles = $MainObject->DirectoryRead( Directory => $Directory, Filter => '*.opm', From 98b53d8e6a872a82f63685e24f6777f9bfea5fa3 Mon Sep 17 00:00:00 2001 From: Emin Yazi Date: Thu, 25 Jul 2024 18:28:03 +0200 Subject: [PATCH 3/4] Don't print database errors to the log. --- Kernel/Modules/Installer.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kernel/Modules/Installer.pm b/Kernel/Modules/Installer.pm index f1c20957e1..b3d37ecb16 100644 --- a/Kernel/Modules/Installer.pm +++ b/Kernel/Modules/Installer.pm @@ -1154,8 +1154,9 @@ sub ConnectToDB { ); } + # Connect to the database without logging errors, as they are already shown to the user. my $DBH = DBI->connect( - $Param{DSN}, $Param{DBUser}, $Param{DBPassword}, + $Param{DSN}, $Param{DBUser}, $Param{DBPassword}, { PrintError => 0 } ); if ( !$DBH ) { From 91a33bd7412d089528903f1ff2765052bcd29685 Mon Sep 17 00:00:00 2001 From: Emin Yazi Date: Thu, 25 Jul 2024 19:30:23 +0200 Subject: [PATCH 4/4] Fixed spacing --- Kernel/Output/HTML/Layout.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/Output/HTML/Layout.pm b/Kernel/Output/HTML/Layout.pm index 8d9cab4da9..be65b927da 100644 --- a/Kernel/Output/HTML/Layout.pm +++ b/Kernel/Output/HTML/Layout.pm @@ -1310,7 +1310,7 @@ sub Header { # Generate the minified CSS and JavaScript files and the tags referencing them (see LayoutLoader) $Self->LoaderCreateAgentCSSCalls(); - if ( !$Self->{InstallerOnly} ) { + if ( !$Self->{InstallerOnly} ) { $Self->LoaderCreateDynamicCSS(); }