+$DBversion = '16.12.00.023';
+if( CheckVersion( $DBversion ) ) {
+ my $oldval = C4::Context->preference('dontmerge');
+ my $newval = $oldval ? 0 : 50;
+
+ # Remove dontmerge, add AuthorityMergeLimit
+ $dbh->do(q{
+ DELETE FROM systempreferences WHERE variable = 'dontmerge';
+ });
+ $dbh->do(qq{
+ INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES ('AuthorityMergeLimit','$newval',NULL,'Maximum number of biblio records updated immediately when an authority record has been modified.','integer');
+ });
+
+ $dbh->do(q{
+ ALTER TABLE need_merge_authorities
+ ADD COLUMN authid_new BIGINT AFTER authid,
+ ADD COLUMN reportxml text AFTER authid_new,
+ ADD COLUMN timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
+ });
+
+ $dbh->do(q{
+ UPDATE need_merge_authorities SET authid_new=authid WHERE done <> 1
+ });
+
+ SetVersion( $DBversion );
+ if( $newval == 0 ) {
+ print "NOTE: Since dontmerge was enabled, we have initialized AuthorityMergeLimit to 0 records. Please consider raising this value. This will allow for performing smaller merges directly and only postponing larger merges.\n";
+ }
+ print "IMPORTANT NOTE: If you are not using a Debian package install, please verify that you no longer use misc/migration_tools/merge_authority.pl in your cron files AND add misc/cronjobs/merge_authorities.pl to cron now. This job is no longer optional! You need it to perform larger authority merges.\n";
+ print "Upgrade to $DBversion done (Bug 9988 - Add AuthorityMergeLimit)\n";
+}
+