Bug 21235: Remove table services_throttle
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 15 Aug 2018 15:01:56 +0000 (12:01 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 7 Sep 2018 15:09:39 +0000 (15:09 +0000)
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>
C4/XISBN.pm
Koha/Schema/Result/ServicesThrottle.pm [deleted file]
debian/koha-common.cron.daily
installer/data/mysql/kohastructure.sql
misc/cronjobs/crontab.example
misc/cronjobs/services_throttle.pl [deleted file]

index 7562d68..22b4502 100644 (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__
 
diff --git a/Koha/Schema/Result/ServicesThrottle.pm b/Koha/Schema/Result/ServicesThrottle.pm
deleted file mode 100644 (file)
index d9e34e4..0000000
+++ /dev/null
@@ -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;
index 50d49d8..63eb070 100644 (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
index cdc97fe..3048ade 100644 (file)
@@ -2325,17 +2325,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/
index db1c703..80c1d9e 100644 (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
 
diff --git a/misc/cronjobs/services_throttle.pl b/misc/cronjobs/services_throttle.pl
deleted file mode 100755 (executable)
index cafc517..0000000
+++ /dev/null
@@ -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.