Koha-clms/t
Lari Taskula b4662eb60a
Bug 32440: Support purging statistics by type in cleanup_database.pl
Cleanup_database can delete all statistics entries more than X days
old. If one is using pseudonymization to create pseudonymized_transactions
data, then one may wish to use that cleanup_database function to delete
statistics entries that have been duplicated in pseudonymized_transactions.
However, not all types of transactions in statistics are duplicated in
pseudonymized transactions.

Pseudonymized_transactions currently only includes checkouts, returns,
and renewals.

This patch adds two additional parameters to cleanup_database.pl:

  1. --statistics-type

  Defines the types of statistics to purge. Will purge all types if
  parameter is omitted. Repeatable.

  2. --statistics-type-pseudo

  Grabs values from @Koha::Statistic::pseudonymization_types. At the
  time of writing this patch, they are:

  renew, issue, return and onsite_checkout

To test:
1. prove t/db_dependent/Koha/Statistic.t
2. Before applying this patch:
3. Create some statistics entry by checking out, renewing and checking in
   items.
4. perl misc/cronjobs/cleanup_database.pl --statistics 1 --verbose

Observe:
Purging statistics older than 1 days
n statistics would have been removed

Where n is the amount of statistics rows matching your test environment

5. Apply patch
6. Repeat step 4, observe same result
7. perl misc/cronjobs/cleanup_database.pl --statistics 1 --statistics-type-pseudo --verbose

Observe:

Purging statistics older than 1 days with types "onsite_checkout,renew,return,issue".
n statistics would have been removed

Where n is the amount of statistics rows matching your test environment
(order of listed types does not matter)

8. perl misc/cronjobs/cleanup_database.pl --statistics 1 --statistics-type test1 --statistics-type test2 --verbose

Observe:

Purging statistics older than 1 days with types "test1,test2".
n statistics would have been removed

Where n is the amount of statistics rows matching your test environment
(order of listed types does not matter)

9. perl misc/cronjobs/cleanup_database.pl --statistics 1 --statistics-type-pseudo --statistics-type test1 --verbose

Observe:

Purging statistics older than 1 days with types "test1,onsite_checkout,renew,return,issue".
n statistics would have been removed

Where n is the amount of statistics rows matching your test environment
(order of listed types does not matter)

10. Try previous cleanup_database.pl commands with --confirm flag and make sure correct rows are purged

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-21 16:41:29 +01:00
..
Acquisition Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Biblio Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Budgets Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Circulation Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
External Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Koha Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Number Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
SIP Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Search Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Serials Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Template
…
Test Bug 38818: Unit tests 2025-02-20 17:34:52 +01:00
cypress Bug 37222: Standardize markup for sidebar menus 2025-02-21 16:41:24 +01:00
data
…
db_dependent Bug 32440: Support purging statistics by type in cleanup_database.pl 2025-02-21 16:41:29 +01:00
edi_testfiles Bug 38689: Improve test coverage 2025-02-21 16:41:23 +01:00
etc Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
lib Bug 36433: UT 2025-02-21 10:41:39 +01:00
mock_templates/intranet-tmpl/prog Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
00-check-atomic-updates.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
00-deprecated.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
00-load.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
00-merge-conflict-markers.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
00-testcritic.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
00-valid-xml.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Auth.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
AuthoritiesMarc_MARC21.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
AuthoritiesMarc_UNIMARC.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Barcodes_EAN13.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Barcodes_annual.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Barcodes_hbyymmincr.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Barcodes_incremental.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Biblio.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Biblio2.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Budgets.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Charset.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Circulation_barcodedecode.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ClassSortRoutine.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ClassSortRoutine_Dewey.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ClassSortRoutine_Generic.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ClassSortRoutine_LCC.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ClassSource.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Context.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Contract.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
CookieManager.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Creators.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
DateUtils.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
EdiInvoice.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Edifact.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Ediorder.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Ediordrsp.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Form_MessagingPreferences.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
HtmlTags.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ImportBatch.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Installer_PerlModules.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ItemCirculationAlertPreference.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Koha_MetadataRecord.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Koha_SearchEngine_Elasticsearch_Browse.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Koha_Template_Plugin_HtmlId.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Koha_Template_Plugin_Koha.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Koha_Util_FrameworkPlugin.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Koha_Util_MARC.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Koha_XSLT_HTTPS.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Labels.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Labels_split_Regex.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Labels_split_ccn.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Labels_split_ddcn.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Labels_split_lccn.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Languages.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Logger.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Makefile.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Members_Messaging.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
OpenLibrarySearch.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Output.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Output_JSONStream.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Patroncards.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Patroncards_Batch.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Patroncards_Lib.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Patroncards_Patroncard.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Patroncards_Profile.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Patroncards_Template.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
RecordProcessor.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Ris.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
SMS.t
…
Scheduler.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Scrubber.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Search.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Search_PazPar2.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
SimpleMARC.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
SuggestionEngine.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
SuggestionEngine_AuthorityFile.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
TmplToken.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Token.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
dummy.t
…
template_filters.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
timezones.t Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00