Bug 20555 - usage() function in cleanup_database.pl needs refactoring
Summary: usage() function in cleanup_database.pl needs refactoring
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Developer documentation (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-10 15:11 UTC by Barton Chittenden
Modified: 2020-11-17 20:06 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Barton Chittenden 2018-04-10 15:11:50 UTC
1) '-m --mail DAYS' is misleading -- this cleans up the message queue, which covers a lot more than mail.

2) usage() should be implemented using pod2usage
Comment 1 Lee Jamison 2018-04-11 21:40:06 UTC
Barton, have a suggestion on how it should be re-written?
Comment 2 Barton Chittenden 2018-04-11 23:27:20 UTC
(In reply to Lee Jamison from comment #1)
> Barton, have a suggestion on how it should be re-written?

In terms of documenting the '-m' option:

I would change the GetOptions call from

     'm|mail:i'          => \$mail,

to

     'm|messageque:i'    => \$mail,
     'mail:i'            => sub { 
                                $mail = shift;
                                warn "Option '--mail' is deprecated. "
                                     . "use --messagequeue instead";
                            },

There may be better ways of handling the deprecated options, I welcome feedback from QA.

Then the actual message should be something like this:

'-m --messagequeue DAYS: Delete rows from message queue after DAYS days.'
'--mail DAYS: (Deprecated) Delete rows from message_queue after DAYS days. This option is deprecated and will issue a warning if used. Use --messagequeue DAYS instead.'

In terms of re-writing the usage() function to use pod2usage, take a look at misc/cronjobs/longoverdue.pl, it covers several common ways to call pod2usage.