Bugzilla – Attachment 54869 Details for
Bug 17195
Split logging of item modifications from CataloguingLog into separate system preferences
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17195 - Split logging of item modifications from CataloguingLog into separate system preferences
Bug-17195---Split-logging-of-item-modifications-fr.patch (text/plain), 10.49 KB, created by
Kyle M Hall (khall)
on 2016-08-25 13:22:13 UTC
(
hide
)
Description:
Bug 17195 - Split logging of item modifications from CataloguingLog into separate system preferences
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-08-25 13:22:13 UTC
Size:
10.49 KB
patch
obsolete
>From cf06d330f840e8eed8b1672c75e6b11c10eb70a5 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 25 Aug 2016 12:18:10 +0000 >Subject: [PATCH] Bug 17195 - Split logging of item modifications from > CataloguingLog into separate system preferences > >Because logging modifications to items has so much overhead, it is not >recommended that CataloguingLog be enabled. If we split off >modifications to items into a separate system preference >CataloguingLogItems, then libraries can at least log modifications to >records without taking a large processing hit. > >Test Plan: >1) Apply this patch >2) Run updatedatabase.pl >3) Disable CataloguingLog and CataloguingLogItems >4) Edit a record and edit an item >5) Note no action logs are produced >6) Enable CataloguingLog >7) Edit a record and edit an item >8) Note only a record edit action log is produced >9) Disable CataloguingLog, enable CataloguingLogItems >10) Edit a record and edit an item >11) Note only an item edit action log is produced >12) Enable both CataloguingLog and CataloguingLogItems >13) Edit a record and edit an item >14) Note an action log is created from both edits > >This test plan can be repeated with creating and deleting items/records >as well. >--- > C4/Items.pm | 8 ++++---- > C4/Log.pm | 17 +++++++++-------- > C4/UsageStats.pm | 1 + > installer/data/mysql/atomicupdate/bug_17195.sql | 2 ++ > .../prog/en/modules/admin/preferences/logs.pref | 8 +++++++- > misc/batchRebuildItemsTables.pl | 8 ++++---- > misc/migration_tools/bulkmarcimport.pl | 3 +++ > t/Log.t | 1 + > t/db_dependent/UsageStats.t | 1 + > 9 files changed, 32 insertions(+), 17 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_17195.sql > >diff --git a/C4/Items.pm b/C4/Items.pm >index 81a8263..8f5f7aa 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -312,7 +312,7 @@ sub AddItem { > > ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver" ); > >- logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); >+ logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLogItems"); > > return ($item->{biblionumber}, $item->{biblioitemnumber}, $itemnumber); > } >@@ -407,7 +407,7 @@ sub AddItemBatchFromMarc { > push @itemnumbers, $itemnumber; # FIXME not checking error > $item->{'itemnumber'} = $itemnumber; > >- logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); >+ logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLogItems"); > > my $new_item_marc = _marc_from_item_hash($item, $frameworkcode, $unlinked_item_subfields); > $item_field->replace_with($new_item_marc->field($itemtag)); >@@ -613,7 +613,7 @@ sub ModItem { > # item status is possible > ModZebra( $biblionumber, "specialUpdate", "biblioserver" ); > >- logaction("CATALOGUING", "MODIFY", $itemnumber, "item ".Dumper($item)) if C4::Context->preference("CataloguingLog"); >+ logaction("CATALOGUING", "MODIFY", $itemnumber, "item ".Dumper($item)) if C4::Context->preference("CataloguingLogItems"); > } > > =head2 ModItemTransfer >@@ -689,7 +689,7 @@ sub DelItem { > ModZebra( $biblionumber, "specialUpdate", "biblioserver" ); > > #search item field code >- logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); >+ logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLogItems"); > return $deleted; > } > >diff --git a/C4/Log.pm b/C4/Log.pm >index d8ea168..99b2f29 100644 >--- a/C4/Log.pm >+++ b/C4/Log.pm >@@ -138,14 +138,15 @@ C<$status> is a hasref like this example: > #' > sub GetLogStatus { > my %hash; >- $hash{BorrowersLog} = C4::Context->preference("BorrowersLog"); >- $hash{CataloguingLog} = C4::Context->preference("CataloguingLog"); >- $hash{HoldsLog} = C4::Context->preference("HoldsLog"); >- $hash{IssueLog} = C4::Context->preference("IssueLog"); >- $hash{ReturnLog} = C4::Context->preference("ReturnLog"); >- $hash{SubscriptionLog} = C4::Context->preference("SubscriptionLog"); >- $hash{LetterLog} = C4::Context->preference("LetterLog"); >- $hash{FinesLog} = C4::Context->preference("FinesLog"); >+ $hash{BorrowersLog} = C4::Context->preference("BorrowersLog"); >+ $hash{CataloguingLog} = C4::Context->preference("CataloguingLog"); >+ $hash{CataloguingLogItems} = C4::Context->preference("CataloguingLogItems"); >+ $hash{HoldsLog} = C4::Context->preference("HoldsLog"); >+ $hash{IssueLog} = C4::Context->preference("IssueLog"); >+ $hash{ReturnLog} = C4::Context->preference("ReturnLog"); >+ $hash{SubscriptionLog} = C4::Context->preference("SubscriptionLog"); >+ $hash{LetterLog} = C4::Context->preference("LetterLog"); >+ $hash{FinesLog} = C4::Context->preference("FinesLog"); > return \%hash; > } > >diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm >index b8dbb26..d408eef 100644 >--- a/C4/UsageStats.pm >+++ b/C4/UsageStats.pm >@@ -212,6 +212,7 @@ sub BuildReport { > AuthoritiesLog > BorrowersLog > CataloguingLog >+ CataloguingLogItems > FinesLog > IssueLog > LetterLog >diff --git a/installer/data/mysql/atomicupdate/bug_17195.sql b/installer/data/mysql/atomicupdate/bug_17195.sql >new file mode 100644 >index 0000000..94497ba >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_17195.sql >@@ -0,0 +1,2 @@ >+INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) >+SELECT 'CataloguingLogItems', value, NULL,'If ON, log edit/create/delete actions on bibliographic item data. WARNING: this feature is very resource consuming.','YesNo' FROM systempreferences WHERE variable = 'CataloguingLog'; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >index 4aa5790..f7fea3c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >@@ -17,7 +17,13 @@ Logging: > choices: > on: Log > off: "Don't log" >- - any changes to bibliographic or item records. Since this occurs whenever a book is checked in or out as well, it is not advisable to turn this on. >+ - any changes to bibliographic records. >+ - >+ - pref: CataloguingLogItems >+ choices: >+ on: Log >+ off: "Don't log" >+ - any changes to item records. Since this occurs whenever a book is checked in or out as well, it is not advisable to turn this on. > - > - pref: AuthoritiesLog > choices: >diff --git a/misc/batchRebuildItemsTables.pl b/misc/batchRebuildItemsTables.pl >index 61431c4..dcf57e7 100755 >--- a/misc/batchRebuildItemsTables.pl >+++ b/misc/batchRebuildItemsTables.pl >@@ -49,10 +49,10 @@ my $dbh = C4::Context->dbh; > $dbh->{AutoCommit} = 0; > #sysprefs > C4::Context->disable_syspref_cache() if ( defined( C4::Context->disable_syspref_cache() ) ); >-my $CataloguingLog = C4::Context->preference('CataloguingLog'); >+my $CataloguingLogItems = C4::Context->preference('CataloguingLogItems'); > my $dontmerge = C4::Context->preference('dontmerge'); > $dontmerge="0" unless defnonull($dontmerge); >-$dbh->do("UPDATE systempreferences SET value=0 WHERE variable='CataloguingLog'"); >+$dbh->do("UPDATE systempreferences SET value=0 WHERE variable='CataloguingLogItems'"); > $dbh->do("UPDATE systempreferences SET value=1 where variable='dontmerge'"); > $dbh->commit() unless $test_parameter; > my ($itemfield,$itemnumbersubfield) = &GetMarcFromKohaField("items.itemnumber",''); >@@ -91,8 +91,8 @@ while ( my ( $biblionumber, $biblioitemnumber, $frameworkcode ) = $sth->fetchrow > } > } > >-my $sthCataloguingLog = $dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='CataloguingLog'"); >-$sthCataloguingLog->execute($CataloguingLog); >+my $sthCataloguingLogItems = $dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='CataloguingLogItems'"); >+$sthCataloguingLogItems->execute($CataloguingLogItems); > my $sthdontmerge = $dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='dontmerge'"); > $sthdontmerge->execute($dontmerge); > $dbh->commit() unless $test_parameter; >diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl >index d007d29..f0d86b5 100755 >--- a/misc/migration_tools/bulkmarcimport.pl >+++ b/misc/migration_tools/bulkmarcimport.pl >@@ -132,9 +132,11 @@ if ((not defined $sourcesubfield) && (not defined $sourcetag)){ > C4::Context->disable_syspref_cache(); > # Save current CataloguingLog and AuthoritiesLog sysprefs values > my $CataloguingLog = C4::Context->preference( 'CataloguingLog' ); >+my $CataloguingLogItems = C4::Context->preference( 'CataloguingLogItems' ); > my $AuthoritiesLog = C4::Context->preference( 'AuthoritiesLog' ); > # Disable logging for both > C4::Context->set_preference( 'CataloguingLog', 0 ); >+C4::Context->set_preference( 'CataloguingLogItems', 0 ); > C4::Context->set_preference( 'AuthoritiesLog', 0 ); > > if ($fk_off) { >@@ -523,6 +525,7 @@ if ($fk_off) { > > # Restore CataloguingLog > C4::Context->set_preference( 'CataloguingLog', $CataloguingLog ); >+C4::Context->set_preference( 'CataloguingLogItems', $CataloguingLogItems ); > # Restore AuthoritiesLog > C4::Context->set_preference( 'AuthoritiesLog', $AuthoritiesLog ); > >diff --git a/t/Log.t b/t/Log.t >index 601b909..798db4e 100755 >--- a/t/Log.t >+++ b/t/Log.t >@@ -15,6 +15,7 @@ BEGIN { > > t::lib::Mocks::mock_preference('BorrowersLog', 1); > t::lib::Mocks::mock_preference('CataloguingLog', 1); >+t::lib::Mocks::mock_preference('CataloguingLogItems', 1); > t::lib::Mocks::mock_preference('IssueLog', 1); > t::lib::Mocks::mock_preference('ReturnLog', 1); > t::lib::Mocks::mock_preference('SubscriptionLog', 1); >diff --git a/t/db_dependent/UsageStats.t b/t/db_dependent/UsageStats.t >index 76abe49..6e0e0bb 100644 >--- a/t/db_dependent/UsageStats.t >+++ b/t/db_dependent/UsageStats.t >@@ -464,6 +464,7 @@ sub mocking_systempreferences_to_a_set_value { > AuthoritiesLog > BorrowersLog > CataloguingLog >+ CataloguingLogItems > FinesLog > IssueLog > LetterLog >-- >2.1.4
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 17195
: 54869