Bug 21865: improve remove_unused_authorities.pl script
authorFridolin Somers <fridolin.somers@biblibre.com>
Mon, 19 Nov 2018 13:46:05 +0000 (14:46 +0100)
committerLucas Gass <lucas@bywatersolutions.com>
Thu, 14 May 2020 14:56:49 +0000 (14:56 +0000)
commit655958ca124d9969abfde40876a496f8f5a173f9
treeeb8b8e5c29feb600e3b9ddda38922ea6d84a6848
parentb2a046f25d0a48d1262778b76958f8c9382752f1
Bug 21865: improve remove_unused_authorities.pl script

remove_unused_authorities.pl script can be improved.

This patch changes changes verbosity so than test mode can be used
to know the autorities that are used and those that can be deleted.
It also writes a line in output if limited authority type(s).

This patch also removes the unused vars $thresholdmin and $thresholdmax.

It also changes the query to use SQL with parameters for authority types.

Test plan :
1) On a catalog create a new authority
2) Be sure catalog is well indexed
3) Run misc/migration_tools/remove_unused_authorities.pl -t
4) You will see the line :
   *** Testing only, authorities will not be deleted. ***
5) You will see lines of :
   authid=x type=y : used X time(s)
6) You will see the line for the authority created in 1) :
   authid=x type=y : can be deleted
7) You will see at the end :
   x authorities parsed
   y can be deleted because unused
   z unchanged because used
8) Run misc/migration_tools/remove_unused_authorities.pl
9) You don't see the line :
   *** Testing only, authorities will not be deleted. ***
10) You will see lines of :
   authid=x type=y : used X time(s)
11) You will see the line for the authority created in 1) :
   authid=x type=y : deleted
12) You will see at the end :
   x authorities parsed
   y deleted because unused
   z unchanged because used
13) Run misc/migration_tools/remove_unused_authorities.pl --auth NP --auth CO
14) You see the line :
    Restricted to authority type(s) : NP,CO.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit 36a84f4264e5c03b900eb850c93cc4eb0befd9e7)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
misc/migration_tools/remove_unused_authorities.pl