@@ -, +, @@ --- C4/XISBN.pm | 28 ------------ Koha/Schema/Result/ServicesThrottle.pm | 66 ----------------------------- debian/koha-common.cron.daily | 1 - installer/data/mysql/atomicupdate/bug_21226 | 1 + installer/data/mysql/kohastructure.sql | 11 ----- misc/cronjobs/crontab.example | 3 -- misc/cronjobs/services_throttle.pl | 21 --------- 7 files changed, 1 insertion(+), 130 deletions(-) delete mode 100644 Koha/Schema/Result/ServicesThrottle.pm delete mode 100755 misc/cronjobs/services_throttle.pl --- a/C4/XISBN.pm +++ a/C4/XISBN.pm @@ -141,34 +141,6 @@ sub _get_url { } - -# Throttle services to the specified amount -sub _service_throttle { - my ($service_type,$daily_limit) = @_; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare(q{ SELECT service_count FROM services_throttle WHERE service_type=? }); - $sth->execute($service_type); - my $count = 0; - - if ($sth->rows == 0) { - # initialize services throttle - my $sth2 = $dbh->prepare(q{ INSERT INTO services_throttle (service_type, service_count) VALUES (?, ?) }); - $sth2->execute($service_type, $count); - } else { - $count = $sth->fetchrow_array; - } - - # we're over the limit - return 1 if $count >= $daily_limit; - - # not over the limit - $count++; - my $sth3 = $dbh->prepare(q{ UPDATE services_throttle SET service_count=? WHERE service_type=? }); - $sth3->execute($count, $service_type); - - return undef; -} - 1; __END__ --- a/Koha/Schema/Result/ServicesThrottle.pm +++ a/Koha/Schema/Result/ServicesThrottle.pm @@ -1,66 +0,0 @@ -use utf8; -package Koha::Schema::Result::ServicesThrottle; - -# Created by DBIx::Class::Schema::Loader -# DO NOT MODIFY THE FIRST PART OF THIS FILE - -=head1 NAME - -Koha::Schema::Result::ServicesThrottle - -=cut - -use strict; -use warnings; - -use base 'DBIx::Class::Core'; - -=head1 TABLE: C - -=cut - -__PACKAGE__->table("services_throttle"); - -=head1 ACCESSORS - -=head2 service_type - - data_type: 'varchar' - default_value: (empty string) - is_nullable: 0 - size: 10 - -=head2 service_count - - data_type: 'varchar' - is_nullable: 1 - size: 45 - -=cut - -__PACKAGE__->add_columns( - "service_type", - { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 }, - "service_count", - { data_type => "varchar", is_nullable => 1, size => 45 }, -); - -=head1 PRIMARY KEY - -=over 4 - -=item * L - -=back - -=cut - -__PACKAGE__->set_primary_key("service_type"); - - -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XxtEV+cJ5qa/3oCHd2GrSw - - -# You can replace this text with custom content, and it will be preserved on regeneration -1; --- a/debian/koha-common.cron.daily +++ a/debian/koha-common.cron.daily @@ -22,7 +22,6 @@ koha-foreach --chdir --enabled --email /usr/share/koha/bin/cronjobs/advance_noti koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/serialsUpdate.pl -c koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/membership_expiry.pl -c koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/holds/cancel_expired_holds.pl >/dev/null 2>&1 -koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/services_throttle.pl > /dev/null 2>&1 koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/cleanup_database.pl --sessions --zebraqueue 10 --list-invites --temp-uploads koha-foreach --chdir --enabled --noemail /usr/share/koha/bin/cronjobs/cleanup_database.pl --mail koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/holds/auto_unsuspend_holds.pl > /dev/null 2>&1 --- a/installer/data/mysql/atomicupdate/bug_21226 +++ a/installer/data/mysql/atomicupdate/bug_21226 @@ -1,3 +1,4 @@ DELETE FROM systempreferences where variable="OCLCAffiliateID"; DELETE FROM systempreferences where variable="XISBN"; DELETE FROM systempreferences where variable="XISBNDailyLimit"; +DROP TABLE IF EXISTS services_throttle; --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -2341,17 +2341,6 @@ CREATE TABLE `zebraqueue` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- --- Table structure for table `services_throttle` --- - -DROP TABLE IF EXISTS `services_throttle`; -CREATE TABLE `services_throttle` ( - `service_type` varchar(10) NOT NULL default '', - `service_count` varchar(45) default NULL, - PRIMARY KEY (`service_type`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- -- Table structure for table `language_subtag_registry` -- http://www.w3.org/International/articles/language-tags/ -- RFC4646 --- a/misc/cronjobs/crontab.example +++ a/misc/cronjobs/crontab.example @@ -83,9 +83,6 @@ KOHA_CRON_PATH = /usr/share/koha/bin/cronjobs # for both authorities and bibs */10 * * * * __KOHA_USER__ $KOHA_CRON_PATH/../migration_tools/rebuild_zebra.pl -b -a -z >/dev/null -# services_throttle -- resets the xISBN service -59 23 * * * __KOHA_USER__ $KOHA_CRON_PATH/services_throttle.pl > /dev/null 2>&1 - # clean up databases nightly. Be sure not to run this with --sessions during a time when the system is in use! 16 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/cleanup_database.pl --sessions --zebraqueue 10 --list-invites --temp-uploads --- a/misc/cronjobs/services_throttle.pl +++ a/misc/cronjobs/services_throttle.pl @@ -1,21 +0,0 @@ -#!/usr/bin/perl -# run nightly -- resets the xisbn services throttle - -use strict; -use warnings; - -BEGIN { - # find Koha's Perl modules - # test carefully before changing this - use FindBin; - eval { require "$FindBin::Bin/../kohalib.pl" }; -} - -use C4::Context; -my $fixit="UPDATE services_throttle SET service_count=0 WHERE service_type='xisbn'"; -my $sth = C4::Context->dbh->prepare($fixit); -my $res = $sth->execute() or die "cannot execute query: $fixit"; - -# There is no need to return anything if we succeeded, -# and the die message (or other more internal Context/mysql error) -# will get emailed to the cron user if we didn't. --