Bugzilla – Attachment 148343 Details for
Bug 32334
Sync comments in database with schema
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32334: (QA follow-up) Invert dry run mode to commit parameter
Bug-32334-QA-follow-up-Invert-dry-run-mode-to-comm.patch (text/plain), 3.58 KB, created by
David Nind
on 2023-03-17 13:34:09 UTC
(
hide
)
Description:
Bug 32334: (QA follow-up) Invert dry run mode to commit parameter
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-03-17 13:34:09 UTC
Size:
3.58 KB
patch
obsolete
>From 98e186d4f97a0376eec1b99a1011aff80f284640 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 15 Feb 2023 12:49:16 +0000 >Subject: [PATCH] Bug 32334: (QA follow-up) Invert dry run mode to commit > parameter > >Note: This is only done (and 'needed') for the command line, not >for the module subroutines. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: David Nind <david@davidnind.com> >--- > misc/maintenance/sync_db_comments.pl | 21 +++++++++++---------- > 1 file changed, 11 insertions(+), 10 deletions(-) > >diff --git a/misc/maintenance/sync_db_comments.pl b/misc/maintenance/sync_db_comments.pl >index ffeb930e96..c5eb8cfdbc 100755 >--- a/misc/maintenance/sync_db_comments.pl >+++ b/misc/maintenance/sync_db_comments.pl >@@ -30,14 +30,15 @@ use Koha::Database::Commenter; > my $cmd_args = {}; > GetOptions( > 'clear' => \$cmd_args->{clear}, >+ 'commit|c' => \$cmd_args->{commit}, > 'database:s' => \$cmd_args->{database}, >- 'dry_run' => \$cmd_args->{dry_run}, > 'help|h' => \$cmd_args->{help}, > 'renumber' => \$cmd_args->{renumber}, > 'reset' => \$cmd_args->{reset}, > 'table:s' => \$cmd_args->{table}, > 'verbose|v' => \$cmd_args->{verbose}, > ); >+$cmd_args->{dry_run} = !$cmd_args->{commit}; > > my $commenter = Koha::Database::Commenter->new({ database => delete $cmd_args->{database}, dbh => C4::Context->dbh }); > if( $cmd_args->{help} ) { >@@ -45,19 +46,19 @@ if( $cmd_args->{help} ) { > } elsif( ($cmd_args->{clear}||0) + ($cmd_args->{renumber}||0) + ($cmd_args->{reset}||0) > 1 ) { > print "You cannot pass the clear, renumber and reset flags together\n"; > } elsif( delete $cmd_args->{clear} ) { >- alert_dry_run( $cmd_args->{dry_run} ); >+ alert_dry_run( $cmd_args ); > $commenter->clear( $cmd_args ); > } elsif( delete $cmd_args->{reset} ) { >- alert_dry_run( $cmd_args->{dry_run} ); >+ alert_dry_run( $cmd_args ); > $commenter->reset_to_schema( $cmd_args ); > } elsif( delete $cmd_args->{renumber} ) { >- alert_dry_run( $cmd_args->{dry_run} ); >+ alert_dry_run( $cmd_args ); > $commenter->renumber( $cmd_args ); > } else { > pod2usage( -verbose => 1 ); > } > >-sub alert_dry_run { print "-- DRY RUN\n" if $_[0]; } >+sub alert_dry_run { print "-- DRY RUN\n" if $_[0]->{dry_run}; } > > __END__ > >@@ -69,7 +70,7 @@ misc/maintenance/sync_db_comments.pl > > =head1 SYNOPSIS > >- perl sync_db_comments.pl [-h] [-v] [-database DB_NAME] [-table TABLE_NAME] [-dry_run] [-clear|-reset|-renumber] >+ perl sync_db_comments.pl [-h] [-v] [-database DB_NAME] [-table TABLE_NAME] [-commit] [-clear|-reset|-renumber] > > =head1 DESCRIPTION > >@@ -85,18 +86,18 @@ misc/maintenance/sync_db_comments.pl > misc/maintance/sync_db_comments.pl -help > Usage statement. > >- misc/maintance/sync_db_comments.pl -clear -verbose >+ misc/maintance/sync_db_comments.pl -clear -commit -verbose > Clear all column comments in database. > The verbose flag shows all issued ALTER TABLE statements. > >- misc/maintance/sync_db_comments.pl -reset -database mydb -table items >+ misc/maintance/sync_db_comments.pl -reset -commit -database mydb -table items > Only resets comments in items table. > Operates on specific database instead of the one from $KOHA_CONF. > >- misc/maintance/sync_db_comments.pl -renumber -dry_run >+ misc/maintance/sync_db_comments.pl -renumber > Renumbers all comments like Comment_1,2,.. > Added for testing purposes. Not meant to run on production. >- The dry_run flag allows you to see what would be done. >+ Omitting the commit flag allows you to see what would be done (dry run). > > =head1 ADDITIONAL COMMENTS > >-- >2.30.2
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 32334
:
144391
|
144392
|
144393
|
144394
|
146712
|
146713
|
146714
|
146715
|
146716
|
146717
|
146718
|
146719
|
146720
|
148266
|
148299
|
148335
|
148338
|
148339
|
148340
|
148341
|
148342
|
148343
|
148344
|
148345
|
148346
|
148347
|
148348
|
149259
|
149260
|
149261
|
149262
|
149263
|
149264
|
149265
|
149266
|
149267
|
149268
|
149269
|
149270