From ca7a285acec4f5520f43789813685786a8d77c26 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 6 Oct 2009 15:20:16 -0700 Subject: [PATCH] Use proper POD for syncToCdn.pl's docs. Fixes bug #11100 --- docs/changelog/7.x.x.txt | 1 + sbin/syncToCdn.pl | 101 +++++++++++++++++++++++++++++++++++---- 2 files changed, 93 insertions(+), 9 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 07911f115..b96f14a39 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -42,6 +42,7 @@ - fixed #11088: i18n Survey Section Information - fixed #11087: SC asset repeats its own description in feeds - fixed #10916: png icon + - fixed #11100: syncToCdn's help is not proper POD 7.8.0 - upgraded YUI to 2.8.0r4 diff --git a/sbin/syncToCdn.pl b/sbin/syncToCdn.pl index 067396251..b94daa01c 100644 --- a/sbin/syncToCdn.pl +++ b/sbin/syncToCdn.pl @@ -20,6 +20,7 @@ use Fcntl ':flock'; use Getopt::Long; use WebGUI::Session; use WebGUI::Storage; +use Pod::Usage; my $configFile; my $help; @@ -32,17 +33,11 @@ GetOptions( 'override' => \$override, 'migrate' => \$migrate, 'quiet' => \$quiet, + 'h|help' => \$help, ); -if ( $configFile eq "" ) { - printHelp(); - exit 4; -} - -if ($help) { - printHelp(); - exit 2; -} +pod2usage( { verbose => 2, exitval => 2, } ) if $help; +pod2usage( { exitval => 4, } ) unless $configFile; # don't want two copies of this to run simultaneously unless ( flock( DATA, LOCK_EX | LOCK_NB ) ) { @@ -213,3 +208,91 @@ sub syncUploads { __DATA__ This exists so flock() code above works. DO NOT REMOVE THIS DATA SECTION. + +__END__ + +=head1 NAME + +syncToCdn - WebGUI interface to a Content Delivery Network. + +=head1 SYNOPSIS + + syncToCdn.pl --configFile config.conf + [--override] + [--migrate] + [--quiet] + + syncToCdn.pl --help + +=head1 DESCRIPTION + +This WebGUI utility script displays the amount of disk space used by +an asset and it's descendants. It has been modeled after the *nix 'du' +utility. + +=over + +=item B<--configFile config.conf> + +The WebGUI config file to use. Only the file name needs to be specified, +since it will be looked up inside WebGUI's configuration directory. +This parameter is required. + +=item B<--override> + +This utility is designed to be run as a privileged user on Linux style +systems. If you wish to run this utility without being the super user, +then use this flag, but note that it may not work as intended. + +=item B<--migrate> + +Migrate entirety of uploads directory to CDN. Ignore the CDN queue and +sync everything. + +=item B<--quiet> + +Disable output unless there is an error. + +=item B<--help> + +Shows this documentation, then exits. + +=back + +=head1 EXIT CODES + +The following exit values are returned: + +=over 4 + +=item 0 + +Successful execution. + +=item 1 + +Only super user may run the script. + +=item 2 + +Help requested. + +=item 3 + +Only one instance of this script can run at a time. + +=item 4 + +Error during invocation of the command. + +=item 5 + +Content Delivery Network (CDN) is not enabled. + +=back + +=head1 AUTHOR + +Copyright 2001-2009 Plain Black Corporation. + +=cut