Bugzilla – Attachment 170520 Details for
Bug 37657
Improve speed of koha-preferences CLI tool (by using minimal dbh)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37657: Make koha-preferences CLI tool faster
Bug-37657-Make-koha-preferences-CLI-tool-faster.patch (text/plain), 1.85 KB, created by
Martin Renvoize (ashimema)
on 2024-08-21 06:44:09 UTC
(
hide
)
Description:
Bug 37657: Make koha-preferences CLI tool faster
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-08-21 06:44:09 UTC
Size:
1.85 KB
patch
obsolete
>From 02f8ac0819e598628b9cfd7c71b6f3a00f8a23b9 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Tue, 20 Aug 2024 04:13:38 +0000 >Subject: [PATCH] Bug 37657: Make koha-preferences CLI tool faster > >By using Koha::Database->dbh() to use a minimal database handle >which doesn't preload the whole DBIx::Class schema, we're able to >run the same command 2-3 times faster. > >This is beneficial when running the tool in a loop which runs the >command serially one by one. > >Test plan: > >1. time misc/admin/koha-preferences get SearchEngine >2. Note time is about 1 second >3. time misc/admin/koha-preferences dump >4. Note time is about 1 second >5. Create sysprefs.yml > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > misc/admin/koha-preferences | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > >diff --git a/misc/admin/koha-preferences b/misc/admin/koha-preferences >index 5c07c2b8a79..11cbc42dc73 100755 >--- a/misc/admin/koha-preferences >+++ b/misc/admin/koha-preferences >@@ -28,6 +28,8 @@ use YAML::XS; > > use Koha::Logger; > >+use Koha::Database; >+ > our %NOT_SET_PREFS = map { $_, 1 } qw( Version ); > > =head1 NAME >@@ -68,7 +70,7 @@ sub _set_preference { > } > > sub GetPreferences { >- my $dbh = C4::Context->dbh; >+ my $dbh = Koha::Database->dbh; > > return { > map { $_->{variable}, $_->{value} } >@@ -83,7 +85,7 @@ sub GetPreferences { > sub SetPreferences { > my ( %preferences ) = @_; > >- my $dbh = C4::Context->dbh; >+ my $dbh = Koha::Database->dbh; > > # First, a quick check to make sure all of the system preferences exist > my $current_state = $dbh->selectall_arrayref( " >@@ -109,7 +111,7 @@ sub SetPreferences { > sub _fetch_preference { > my ( $preference ) = @_; > >- my $dbh = C4::Context->dbh; >+ my $dbh = Koha::Database->dbh; > > my $row = $dbh->selectrow_hashref( " > SELECT >-- >2.46.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37657
:
170490
| 170520