Bugzilla – Attachment 99521 Details for
Bug 24131
Improved formatting for output of updatedatabase
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24131: Move the print statement to a new subroutine
Bug-24131-Move-the-print-statement-to-a-new-subrou.patch (text/plain), 10.32 KB, created by
Martin Renvoize (ashimema)
on 2020-02-24 13:46:59 UTC
(
hide
)
Description:
Bug 24131: Move the print statement to a new subroutine
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-02-24 13:46:59 UTC
Size:
10.32 KB
patch
obsolete
>From a4b98d4b113aab7acbae44d054eb982229c2d5ce Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 6 Feb 2020 13:07:35 +0100 >Subject: [PATCH] Bug 24131: Move the print statement to a new subroutine > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > installer/data/mysql/updatedatabase.pl | 86 +++++++++++--------------- > 1 file changed, 36 insertions(+), 50 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 065a02b1b9..9ba2fbc696 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -20228,21 +20228,18 @@ if( CheckVersion( $DBversion ) ) { > > $DBversion = '19.11.00.000'; > if( CheckVersion( $DBversion ) ) { >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (19.11.00 release)\n"; >+ NewVersion( $DBversion, undef '19.11.00 release' ); > } > > $DBversion = '19.12.00.000'; > if( CheckVersion( $DBversion ) ) { >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Dobbie is a free elf...)\n"; >+ NewVersion( $DBversion, undef, 'Dobbie is a free elf...' ); > } > > $DBversion = '19.12.00.001'; > if( CheckVersion( $DBversion ) ) { > $dbh->do( "UPDATE marc_subfield_structure SET kohafield = NULL WHERE kohafield = 'bibliosubject.subject';" ); >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 17831 - Remove non-existing bibliosubject.subject from frameworks)\n"; >+ NewVersion( $DBversion, 17831, 'Remove non-existing bibliosubject.subject from frameworks' ); > } > > $DBversion = '19.12.00.002'; >@@ -20254,8 +20251,7 @@ if( CheckVersion( $DBversion ) ) { > WHERE variable = 'AllowItemsOnHoldCheckout' > }); > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 23233 - Rename AllowItemsOnHoldCheckout syspref)\n"; >+ NewVersion( $DBversion, 23233, 'Rename AllowItemsOnHoldCheckout syspref' ); > } > > $DBversion = '19.12.00.003'; >@@ -20265,9 +20261,7 @@ if( CheckVersion( $DBversion ) ) { > $dbh->do( "ALTER TABLE library_groups ADD COLUMN ft_local_hold_group tinyint(1) NOT NULL DEFAULT 0 AFTER ft_search_groups_staff" ); > } > >- # Always end with this (adjust the bug info) >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 22284 - Add ft_local_hold_group column to library_groups)\n"; >+ NewVersion( $DBversion, 22284, 'Add ft_local_hold_group column to library_groups' ); > } > > $DBversion = '19.12.00.004'; >@@ -20297,19 +20291,14 @@ if ( CheckVersion($DBversion) ) { > (10, 'payout', 'Perform account payout action') > }); > >- SetVersion($DBversion); >- print "Upgrade to $DBversion done (Bug 24080 - Add PAYOUT account_debit_type)\n"; >- print "Upgrade to $DBversion done (Bug 24080 - Add PAYOUT account_offset_type)\n"; >- print "Upgrade to $DBversion done (Bug 24080 - Add accounts payout permission)\n"; >+ NewVersion( $DBversion, 24080, ['Add PAYOUT account_debit_type', 'Add PAYOUT account_offset_type', 'Add accounts payout permission'] ); > } > > $DBversion = '19.12.00.005'; > if( CheckVersion( $DBversion ) ) { > $dbh->do( "ALTER TABLE action_logs MODIFY COLUMN `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP" ); > >- # Always end with this (adjust the bug info) >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 24329 - Do not update action_log.timestamp)\n"; >+ NewVersion( $DBversion, 24329, 'Do not update action_log.timestamp' ); > } > > $DBversion = '19.12.00.006'; >@@ -20319,8 +20308,7 @@ if( CheckVersion( $DBversion ) ) { > WHERE relationship = "" > |); > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 24263 - Replace relationship with NULL when empty string)\n"; >+ NewVersion( $DBversion, 24263, 'Replace relationship with NULL when empty string' ); > } > > $DBversion = '19.12.00.007'; >@@ -20344,10 +20332,7 @@ if ( CheckVersion($DBversion) ) { > (10, 'refund', 'Perform account refund action') > }); > >- SetVersion($DBversion); >- print "Upgrade to $DBversion done (Bug 23442 - Add REFUND to account_credit_types)\n"; >- print "Upgrade to $DBversion done (Bug 23442 - Add REFUND to account_offset_types)\n"; >- print "Upgrade to $DBversion done (Bug 23442 - Add accounts refund permission)\n"; >+ NewVersion( $DBversion, 23442, ['Add REFUND to account_credit_types', 'Add REFUND to account_offset_types', 'Add accounts refund permission'] ); > } > > $DBversion = '19.12.00.008'; >@@ -20356,8 +20341,7 @@ if( CheckVersion( $DBversion ) ) { > $dbh->do( 'UPDATE systempreferences SET value = REPLACE(value, "http://www.bookfinder.com", "https://www.bookfinder.com") WHERE variable = "OPACSearchForTitleIn"' ); > $dbh->do( 'UPDATE systempreferences SET value = REPLACE(value, "https://openlibrary.org/search/?", "https://openlibrary.org/search?") WHERE variable = "OPACSearchForTitleIn"' ); > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 24206 - Update OpacSearchForTitleIn system preference)\n"; >+ NewVersion( $DBversion, 24206, 'Update OpacSearchForTitleIn system preference' ); > } > > $DBversion = '19.12.00.009'; >@@ -20479,10 +20463,7 @@ INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, > (25, 'takepayment', 'Access the point of sale page and take payments') > }); > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 23354 - Add 'Purchase' account offset type)\n"; >- print "Upgrade to $DBversion done (Bug 23354 - Add 'RECEIPT' notice for Point of Sale)\n"; >- print "Upgrade to $DBversion done (Bug 23354 - Add point of sale permissions)\n"; >+ NewVersion( $DBversion, 23354, [q|Add 'Purchase' account offset type|, q|Add 'RECEIPT' notice for Point of Sale|, q|Add point of sale permissions|] ); > } > > $DBversion = '19.12.00.010'; >@@ -20511,8 +20492,7 @@ if( CheckVersion( $DBversion ) ) { > } > } > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 21520 - Add rule_order and rule_operator fields to oai_sets_mappings table)\n"; >+ NewVersion( $DBversion, 21520, 'Add rule_order and rule_operator fields to oai_sets_mappings table' ); > } > > $DBversion = '19.12.00.011'; >@@ -20543,8 +20523,7 @@ if( CheckVersion( $DBversion ) ) { > |); > } > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 24289 - Adding foreign keys on *_holidays.branchcode tables)\n"; >+ NewVersion( $DBversion, 24289, 'Adding foreign keys on *_holidays.branchcode tables' ); > } > > $DBversion = '19.12.00.012'; >@@ -20559,8 +20538,7 @@ if( CheckVersion( $DBversion ) ) { > `code` = 'manage_cash_registers' > }); > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 24481 - Move permission to correct module_bit)\n"; >+ NewVersion( $DBversion, 24481, 'Move permission to correct module_bit' ); > } > > $DBversion = '19.12.00.013'; >@@ -20572,8 +20550,7 @@ if( CheckVersion( $DBversion ) ) { > ('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo') > }); > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 24478 - Add `EnablePointOfSale` system preference to allow disabling the point of sale feature)\n"; >+ NewVersion( $DBversion, 24478, 'Add `EnablePointOfSale` system preference to allow disabling the point of sale feature)' ); > } > > $DBversion = '19.12.00.014'; >@@ -20590,8 +20567,7 @@ if( CheckVersion( $DBversion ) ) { > ); > } > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 24287 - Add 'reason' field to transfers table)\n"; >+ NewVersion( $DBversion, 24287, q|Add 'reason' field to transfers table| ); > } > > $DBversion = '19.12.00.015'; >@@ -20636,8 +20612,7 @@ if( CheckVersion( $DBversion ) ) { > } > ); > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 24296 - Update stockrotation to use 'reason' field in transfers table)\n"; >+ NewVersion( $DBversion, 24296, q|Update stockrotation to use 'reason' field in transfers table| ); > } > > $DBversion = '19.12.00.016'; >@@ -20656,8 +20631,7 @@ if( CheckVersion( $DBversion ) ) { > UPDATE borrowers SET flags = flags + (1<<12) WHERE flags & (1 << 11) > }); > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 22868 - Move suggestions_manage subpermission out of acquisition permission)\n"; >+ NewVersion( $DBversion, 22868, 'Move suggestions_manage subpermission out of acquisition permission' ); > } > > $DBversion = '19.12.00.017'; >@@ -20679,8 +20653,7 @@ if( CheckVersion( $DBversion ) ) { > |); > } > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 21674 - Add unique key (parent_id, branchcode) to library_group)\n"; >+ NewVersion( $DBversion, 21674, 'Add unique key (parent_id, branchcode) to library_group' ); > } > > $DBversion = '19.12.00.018'; >@@ -20728,8 +20701,7 @@ if( CheckVersion( $DBversion ) ) { > $dbh->do("DROP TABLE issuingrules"); > } > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 18936: Convert issuingrules fields to circulation_rules)\n"; >+ NewVersion( $DBversion, 18936, 'Convert issuingrules fields to circulation_rules' ); > } > > $DBversion = '19.12.00.019'; >@@ -20742,8 +20714,7 @@ if( CheckVersion( $DBversion ) ) { > $dbh->do("UPDATE message_queue SET updated_on=time_queued"); > } > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 23673 - modify time_queued and add updated_on to message_queue)\n"; >+ NewVersion( $DBversion, 23673, 'modify time_queued and add updated_on to message_queue' ); > } > > $DBversion = '19.12.00.020'; >@@ -21042,6 +21013,21 @@ sub SetVersion { > C4::Context::clear_syspref_cache(); # invalidate cached preferences > } > >+sub NewVersion { >+ my ( $DBversion, $bug_number, $descriptions ) = @_; >+ SetVersion($DBversion); >+ unless ( ref($descriptions) ) { >+ $descriptions = [ $descriptions ]; >+ } >+ for my $description ( @$descriptions ) { >+ unless ( $bug_number ) { >+ say sprintf "Upgrade to %s done (%s)", $DBversion, $description; >+ } else { >+ say sprintf "Upgrade to %s done (Bug %s - %s)", $DBversion, $bug_number, $description; >+ } >+ } >+} >+ > =head2 CheckVersion > > Check whether a given update should be run when passed the proposed version >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24131
:
98536
|
98537
|
99315
|
99316
|
99317
|
99521
|
99522
|
99523
|
99524
|
100161
|
100162
|
100163
|
100164
|
100464
|
100465
|
100466
|
100467
|
100468
|
100530
|
100531
|
100532
|
100533
|
100534
|
100535
|
100536
|
100538
|
101155
|
101159
|
101160
|
101162
|
101164
|
101166
|
101168
|
101187
|
103001