From 83de52f1124a71c6688a04e0c0acd841f6188d0f Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 1 Apr 2016 11:13:16 +0200 Subject: [PATCH] =?utf8?q?QuickSearch:=20nicht=20anzeigen,=20wenn=20Datenb?= =?utf8?q?ankupgrades=20eingespielt=20werden=20m=C3=BCssen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit QuickSearch hat seine Konfiguration in gewissen Spalten in der Datenbank. Um auf diese zugreifen zu können, müssen die dazugehörigen Datenbankupgrades bereits eingespielt worden sein. Da das Menü und damit die QuickSearch-Items auch während des Einspielens der Upgrades angezeigt werden, kann es also dazu führen, dass die Spalten noch nicht existieren. Daher wird QuickSearch nun komplett deaktiviert, solange ausstehende Datenbankupgrades existieren. --- SL/Layout/Top.pm | 8 +++++++- SL/Request.pm | 1 + SL/User.pm | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/SL/Layout/Top.pm b/SL/Layout/Top.pm index 2ae61cb05..05c0046e1 100644 --- a/SL/Layout/Top.pm +++ b/SL/Layout/Top.pm @@ -8,11 +8,17 @@ use SL::Controller::TopQuickSearch; sub pre_content { my ($self) = @_; + my @options; + # Only enable the quick search functionality if all database + # upgrades have already been applied as quick search requires + # certain columns that are only created by said database upgrades. + push @options, (quick_search => SL::Controller::TopQuickSearch->new) unless $::request->applying_database_upgrades; + $self->presenter->render('menu/header', now => DateTime->now_local, is_fastcgi => $::dispatcher ? scalar($::dispatcher->interface_type =~ /fastcgi/i) : 0, is_links => scalar($ENV{HTTP_USER_AGENT} =~ /links/i), - quick_search => SL::Controller::TopQuickSearch->new, + @options, ); } diff --git a/SL/Request.pm b/SL/Request.pm index f72694d1c..8d62f17d0 100644 --- a/SL/Request.pm +++ b/SL/Request.pm @@ -18,6 +18,7 @@ our @EXPORT_OK = qw(flatten unflatten read_cgi_input); use Rose::Object::MakeMethods::Generic ( + scalar => [ qw(applying_database_upgrades) ], 'scalar --get_set_init' => [ qw(cgi layout presenter is_ajax type) ], ); diff --git a/SL/User.pm b/SL/User.pm index fe2152ece..37e1a9b5f 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -133,6 +133,11 @@ sub login { return LOGIN_OK(); } + # Store the fact that we're applying database upgrades at the + # moment. That way functions called from the layout modules that may + # require updated tables can chose only to use basic features. + $::request->applying_database_upgrades(1); + $form->{$_} = $::auth->client->{$_} for qw(dbname dbhost dbport dbuser dbpasswd); $form->{$_} = $myconfig{$_} for qw(datestyle); -- 2.20.1