Bugzilla – Attachment 170490 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.98 KB, created by
David Cook
on 2024-08-20 04:19:12 UTC
(
hide
)
Description:
Bug 37657: Make koha-preferences CLI tool faster
Filename:
MIME Type:
Creator:
David Cook
Created:
2024-08-20 04:19:12 UTC
Size:
1.98 KB
patch
obsolete
>From d2d5f540f29ac3cae32451200167a19e35715ad3 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 >--- >marcflavour: MARC21 >viewMARC: 1 >6. time misc/admin/koha-preferences load -i sysprefs.yml > >7. Apply patch >8. Repeat the koha-preferences commands above >9. Note that the command runs about 2-3 times faster >--- > 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 5c07c2b8a7..11cbc42dc7 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.39.2
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