From b8b59892920935adb817167bc49631bcdcc3c023 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 9 May 2017 21:25:46 +0000 Subject: [PATCH] Bug 18314 - DBRev 16.12.00.037 Signed-off-by: Kyle M Hall --- Koha.pm | 2 +- Koha/Schema/Result/Borrower.pm | 12 +++++++++-- Koha/Schema/Result/Deletedborrower.pm | 12 +++++++++-- .../data/mysql/atomicupdate/lockout.perl | 19 ------------------ installer/data/mysql/updatedatabase.pl | 20 +++++++++++++++++++ 5 files changed, 41 insertions(+), 24 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/lockout.perl diff --git a/Koha.pm b/Koha.pm index 0b88ac284c..c62529f4db 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "16.12.00.036"; +$VERSION = "16.12.00.037"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index f8da9f633c..e50268d377 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -434,6 +434,12 @@ __PACKAGE__->table("borrowers"); is_nullable: 0 size: 25 +=head2 login_attempts + + data_type: 'integer' + default_value: 0 + is_nullable: 1 + =head2 overdrive_auth_token data_type: 'text' @@ -635,6 +641,8 @@ __PACKAGE__->add_columns( is_nullable => 0, size => 25, }, + "login_attempts", + { data_type => "integer", default_value => 0, is_nullable => 1 }, "overdrive_auth_token", { data_type => "text", is_nullable => 1 }, ); @@ -1370,8 +1378,8 @@ Composing rels: L -> ordernumber __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-05-09 21:01:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dc49uW1FevMTWMaWeRVHgA +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-05-09 21:24:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7llO928plwtX2Q+I9nQA8A __PACKAGE__->belongs_to( "guarantor", diff --git a/Koha/Schema/Result/Deletedborrower.pm b/Koha/Schema/Result/Deletedborrower.pm index b7d0b7d6b8..33e394757a 100644 --- a/Koha/Schema/Result/Deletedborrower.pm +++ b/Koha/Schema/Result/Deletedborrower.pm @@ -431,6 +431,12 @@ __PACKAGE__->table("deletedborrowers"); is_nullable: 0 size: 25 +=head2 login_attempts + + data_type: 'integer' + default_value: 0 + is_nullable: 1 + =head2 overdrive_auth_token data_type: 'text' @@ -620,13 +626,15 @@ __PACKAGE__->add_columns( is_nullable => 0, size => 25, }, + "login_attempts", + { data_type => "integer", default_value => 0, is_nullable => 1 }, "overdrive_auth_token", { data_type => "text", is_nullable => 1 }, ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-05-09 21:01:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:77wtFNqtEjJry9Qo/d1GrQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-05-09 21:24:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SpP0xoSTFIweqTp1muUwvg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/lockout.perl b/installer/data/mysql/atomicupdate/lockout.perl deleted file mode 100644 index db7fbc9200..0000000000 --- a/installer/data/mysql/atomicupdate/lockout.perl +++ /dev/null @@ -1,19 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( q| - INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) - VALUES ('FailedLoginAttempts','','','Number of login attempts before lockout the patron account','Integer'); - |); - - unless( column_exists( 'borrowers', 'login_attempts' ) ) { - $dbh->do(q| - ALTER TABLE borrowers ADD COLUMN login_attempts INT(4) DEFAULT 0 AFTER lastseen - |); - $dbh->do(q| - ALTER TABLE deletedborrowers ADD COLUMN login_attempts INT(4) DEFAULT 0 AFTER lastseen - |); - } - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug XXXXX - Add FailedLoginAttempts and borrowers.login_attempts)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 1888ec7e9f..9a2a616498 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -14473,6 +14473,26 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 17465 - Add a System Preference to control number of Saved Reports displayed)\n"; } +$DBversion = '16.12.00.037'; +if( CheckVersion( $DBversion ) ) { + $dbh->do( q| + INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) + VALUES ('FailedLoginAttempts','','','Number of login attempts before lockout the patron account','Integer'); + |); + + unless( column_exists( 'borrowers', 'login_attempts' ) ) { + $dbh->do(q| + ALTER TABLE borrowers ADD COLUMN login_attempts INT(4) DEFAULT 0 AFTER lastseen + |); + $dbh->do(q| + ALTER TABLE deletedborrowers ADD COLUMN login_attempts INT(4) DEFAULT 0 AFTER lastseen + |); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 18314 - Add FailedLoginAttempts and borrowers.login_attempts)\n"; +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5