From b4c66d5cc4be5ca555799a719ff07ffae5b2f45f Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 18 Jan 2017 16:56:16 +0100 Subject: [PATCH] Bug 17935: Adjust some POD lines, fix a few typos This patch does the following: [1] Move some POD lines from Cache to Caches. [2] Correct C4::Plugins to Koha::Plugins in POD line of Koha::Plugins [3] POD Koha/AuthorisedValue.pm: lib_opac moved to opac_description [4] The POD in Koha/Patron.pm uses head2 and head3 inconsistently. Ran s/^=head2/=head3/ on those lines (7 substitutions on 7 lines) [5] Correct a copied POD line from reports/issues_stats.pl in reports/reserve_stats.pl. [6] Correct a test description in t/db_dependent/Koha/Authorities.t. You should never delete the library :) [7] Correct typo shouild in a comment of rebuild_zebra.pl Test plan: [1] Read the patch. Does it make sense? [2] Run perldoc Koha/Cache.pm and Koha/Caches.pm [3] Run t/db_dependent/Koha/Authorities.t Signed-off-by: Marcel de Rooy Signed-off-by: David Cook Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- Koha/AuthorisedValue.pm | 8 +++----- Koha/Cache.pm | 13 +++--------- Koha/Caches.pm | 29 +++++++++++++++++++++++++++ Koha/Patron.pm | 14 ++++++------- Koha/Plugins.pm | 2 +- misc/migration_tools/rebuild_zebra.pl | 4 ++-- reports/reserves_stats.pl | 2 +- t/db_dependent/Koha/Authorities.t | 2 +- 8 files changed, 47 insertions(+), 27 deletions(-) diff --git a/Koha/AuthorisedValue.pm b/Koha/AuthorisedValue.pm index 910b3da9a9..898b630279 100644 --- a/Koha/AuthorisedValue.pm +++ b/Koha/AuthorisedValue.pm @@ -131,11 +131,9 @@ sub replace_branch_limitations { return \@return_values; } -=head3 lib_opac +=head3 opac_description -my $description = $av->lib_opac(); - -$av->lib_opac( $description ); +my $description = $av->opac_description(); =cut @@ -145,7 +143,7 @@ sub opac_description { return $self->lib_opac() || $self->lib(); } -=head3 Koha::Objects->_avb_resultset +=head3 _avb_resultset Returns the internal resultset or creates it if undefined diff --git a/Koha/Cache.pm b/Koha/Cache.pm index 80ff1cad0e..5af8c0ea32 100644 --- a/Koha/Cache.pm +++ b/Koha/Cache.pm @@ -27,6 +27,8 @@ Koha::Cache - Handling caching of html and Objects for Koha use Koha::Cache; my $cache = Koha::Cache->new({cache_type => $cache_type, %params}); + # see also Koha::Caches->get_instance; + =head1 DESCRIPTION Koha caching routines. This class provides two interfaces for cache access. @@ -35,6 +37,7 @@ The first, traditional OO interface provides the following functions: =head1 FUNCTIONS =cut + use strict; use warnings; use Carp; @@ -54,16 +57,6 @@ our %L1_cache; our $L1_encoder = Sereal::Encoder->new; our $L1_decoder = Sereal::Decoder->new; -=head2 get_instance - - my $cache = Koha::Caches->get_instance(); - -This gets a shared instance of the cache, set up in a very default way. This is -the recommended way to fetch a cache object. If possible, it'll be -persistent across multiple instances. - -=cut - =head2 new Create a new Koha::Cache object. This is required for all cache-related functionality. diff --git a/Koha/Caches.pm b/Koha/Caches.pm index 52f181226f..89409255a4 100644 --- a/Koha/Caches.pm +++ b/Koha/Caches.pm @@ -15,11 +15,36 @@ package Koha::Caches; # You should have received a copy of the GNU General Public License # along with Koha; if not, see . +=head1 NAME + +Koha::Caches - Cache handling + +=head1 SYNOPSIS + +my $cache = Koha::Caches->get_instance(); + +=head1 DESCRIPTION + +Description + +=head1 CLASS METHODS + +=cut + use Modern::Perl; use Koha::Cache; our $singleton_caches; + +=head2 get_instance + +This gets a shared instance of the cache, set up in a very default way. This is +the recommended way to fetch a cache object. If possible, it'll be +persistent across multiple instances. + +=cut + sub get_instance { my ($class, $subnamespace) = @_; $subnamespace //= ''; @@ -28,6 +53,10 @@ sub get_instance { return $singleton_caches->{$subnamespace}; } +=head2 flush_L1_caches + +=cut + sub flush_L1_caches { return unless $singleton_caches; for my $cache ( values %$singleton_caches ) { diff --git a/Koha/Patron.pm b/Koha/Patron.pm index f04831d425..5a1fe47f12 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -264,7 +264,7 @@ sub do_check_for_previous_checkout { return $old_issues->count; # 0 || N } -=head2 is_debarred +=head3 is_debarred my $debarment_expiration = $patron->is_debarred; @@ -283,7 +283,7 @@ sub is_debarred { return; } -=head2 is_expired +=head3 is_expired my $is_expired = $patron->is_expired; @@ -299,7 +299,7 @@ sub is_expired { return 0; } -=head2 is_going_to_expire +=head3 is_going_to_expire my $is_going_to_expire = $patron->is_going_to_expire; @@ -319,7 +319,7 @@ sub is_going_to_expire { return 0; } -=head2 update_password +=head3 update_password my $updated = $patron->update_password( $userid, $password ); @@ -367,7 +367,7 @@ sub renew_account { return dt_from_string( $expiry_date )->truncate( to => 'day' ); } -=head2 has_overdues +=head3 has_overdues my $has_overdues = $patron->has_overdues; @@ -381,7 +381,7 @@ sub has_overdues { return $self->_result->issues->search({ date_due => { '<' => $dtf->format_datetime( dt_from_string() ) } })->count; } -=head2 track_login +=head3 track_login $patron->track_login; $patron->track_login({ force => 1 }); @@ -400,7 +400,7 @@ sub track_login { $self->lastseen( dt_from_string() )->store; } -=head2 move_to_deleted +=head3 move_to_deleted my $is_moved = $patron->move_to_deleted; diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm index 6095f51eda..45da6d0541 100644 --- a/Koha/Plugins.pm +++ b/Koha/Plugins.pm @@ -54,7 +54,7 @@ sub new { This will return a list of all available plugins, optionally limited by method or metadata value. - my @plugins = C4::Plugins::GetPlugins({ + my @plugins = Koha::Plugins::GetPlugins({ method => 'some_method', metadata => { some_key => 'some_value' }, }); diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index 5d04545e7b..3b2cb43326 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -179,8 +179,8 @@ my $marcxml_close = q{ }; # Protect again simultaneous update of the zebra index by using a lock file. -# Create our own lock directory if its missing. This shouild be created -# by koha-zebra-ctl.sh or at system installation. If the desired directory +# Create our own lock directory if it is missing. This should be created +# by koha-zebra-ctl.sh or at system installation. If the desired directory # does not exist and cannot be created, we fall back on /tmp - which will # always work. diff --git a/reports/reserves_stats.pl b/reports/reserves_stats.pl index 3db1d6b9c7..aac93cc070 100755 --- a/reports/reserves_stats.pl +++ b/reports/reserves_stats.pl @@ -41,7 +41,7 @@ use YAML; =head1 DESCRIPTION - Plugin that shows circulation stats + Plugin that shows reserve stats =cut diff --git a/t/db_dependent/Koha/Authorities.t b/t/db_dependent/Koha/Authorities.t index 7210713f63..890929dc34 100644 --- a/t/db_dependent/Koha/Authorities.t +++ b/t/db_dependent/Koha/Authorities.t @@ -49,7 +49,7 @@ is( Koha::Authority::Types->search->count, $nb_of_authority_types + 1, 'The auth is( Koha::Authorities->search->count, $nb_of_authorities + 2, 'The 2 authorities should have been added' ); $new_authority_1->delete; -is( Koha::Authorities->search->count, $nb_of_authorities + 1, 'Delete should have deleted the library' ); +is( Koha::Authorities->search->count, $nb_of_authorities + 1, 'Delete should have deleted the authority' ); $schema->storage->txn_rollback; 1; -- 2.39.5