Bug 21235: Remove table services_throttle

This table was only used by XISBN, this patch remove the table and the
related code (cronjobs)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

https://bugs.koha-community.org/show_bug.cgi?id=21235
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 6a2a80988d)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2018-08-15 12:01:56 -03:00 committed by Martin Renvoize
parent 1c58af16be
commit 028c23fecf
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
6 changed files with 0 additions and 130 deletions

View File

@ -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__

View File

@ -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<services_throttle>
=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</service_type>
=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;

View File

@ -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

View File

@ -2338,17 +2338,6 @@ CREATE TABLE `zebraqueue` (
KEY `zebraqueue_lookup` (`server`, `biblio_auth_number`, `operation`, `done`)
) 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/

View File

@ -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

View File

@ -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.