Added proper POD documentation to utility scripts using POD::Usage.

This commit is contained in:
Ernesto Hernández-Novich 2008-06-06 22:08:59 +00:00
parent 3a59968376
commit 4555e8ca8e
15 changed files with 1202 additions and 604 deletions

View file

@ -17,6 +17,7 @@ use WebGUI::Session;
use WebGUI::Search;
use WebGUI::Search::Index;
use Time::HiRes;
use Pod::Usage;
$|=1;
my $search = "";
@ -35,6 +36,8 @@ GetOptions(
'updatesite'=>\$updatesite
);
pod2usage( verbose => 2 ) if $help;
if ($configFile) {
my $session = WebGUI::Session->open("..", $configFile);
if ($indexsite) {
@ -44,51 +47,16 @@ if ($configFile) {
} elsif ($search) {
searchSite($session, $search);
} else {
displayHelp();
pod2usage();
}
$session->var->end;
$session->close;
} elsif ($indexAll) {
reindexAllSites();
} else {
displayHelp();
pod2usage();
}
#-------------------------------------------------------------------
sub displayHelp {
print <<STOP;
perl $0 [ options ]
Options:
--configFile= The config file of the site you wish to perform
an action on.
--help Displays this message.
--indexall Reindexes all the sites. Note that this can take
many hours and will affect the performance of the
server during the indexing process.
--indexsite * Reindexes the entire site. Note that depending
upon the amount of content you have, it may take
hours to index a site and server performance will
suffer somewhat during the indexing process.
--search= * Searches the site for a keyword or phrase and
returns the results.
--updatesite * Indexes content that has not be indexed, but does not
index content that has been indexed. This is useful
if the --indexsite option had to be stopped part way
through.
* This option requires the --configFile option.
STOP
}
#-------------------------------------------------------------------
sub reindexAllSites {
my $configs = WebGUI::Config->readAllConfigs("..");
@ -165,3 +133,73 @@ sub updateSite {
print "\nSite indexing took ".Time::HiRes::tv_interval($siteTime)." seconds.\n";
}
__END__
=head1 NAME
search - Reindex and search a WebGUI site.
=head1 SYNOPSIS
search --configFile config.conf --indexsite
search --configFile config.conf --updatesite
search --configFile config.conf --search text
search --indexall
search --help
=head1 DESCRIPTION
This WebGUI utility scripts helps maintaining search indexes on
any site. It can be used to build the index for an entire site,
build the index only for new content, and perform searches.
=over
=item C<--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 C<--indexsite>
Reindexes the entire site specified in the config file. This process
may take a while (even hours) depending on the amount of content the
site has. Server performance will suffer somewhat during the
indexing process. This option requires a C<--configFile> to be
specified.
=item C<--updatesite>
Indexes content that has not be indexed for the site specified in
the config file, keeping the indexes for already indexed content
intact. This is useful if the C<--indexsite> had to be stopped
partway through. This option requires a C<--configFile> to be
specified.
=item C<--search text>
Searches the site specified in the config file for a given keyword or
phrase, returning the results. This option requires a C<--configFile>
to be specified.
=item C<--indexall>
Reindexes B<all> the sites. Note that this can take many hours and
will affect performance of the server during the indexing process.
=item C<--help>
Shows this documentation, then exits.
=back
=head1 AUTHOR
Copyright 2001-2008 Plain Black Corporation.
=cut