Install script for Copy Sender.

This commit is contained in:
Colin Kuskie 2009-03-10 12:21:03 -07:00
parent f2c26cd15b
commit fc0312cb6d

125
sbin/installCopySender.pm Normal file
View file

@ -0,0 +1,125 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
$|++; # disable output buffering
our ($webguiRoot, $configFile, $help, $man);
BEGIN {
$webguiRoot = "..";
unshift (@INC, $webguiRoot."/lib");
}
use strict;
use Pod::Usage;
use Getopt::Long;
use WebGUI::Session;
# Get parameters here, including $help
GetOptions(
'configFile=s' => \$configFile,
'help' => \$help,
'man' => \$man,
);
pod2usage( verbose => 1 ) if $help;
pod2usage( verbose => 2 ) if $man;
pod2usage( msg => "Must specify a config file!" ) unless $configFile;
my $session = start( $webguiRoot, $configFile );
# Do your work here
finish($session);
#----------------------------------------------------------------------------
# Your sub here
sub installCopySender {
my $session = shift;
return if $session->setting->get('inboxCopySender');
}
#----------------------------------------------------------------------------
sub start {
my $webguiRoot = shift;
my $configFile = shift;
my $session = WebGUI::Session->open($webguiRoot,$configFile);
$session->user({userId=>3});
## If your script is adding or changing content you need these lines, otherwise leave them commented
#
# my $versionTag = WebGUI::VersionTag->getWorking($session);
# $versionTag->set({name => 'Name Your Tag'});
#
##
return $session;
}
#----------------------------------------------------------------------------
sub finish {
my $session = shift;
## If your script is adding or changing content you need these lines, otherwise leave them commented
#
# my $versionTag = WebGUI::VersionTag->getWorking($session);
# $versionTag->commit;
##
$session->var->end;
$session->close;
}
__END__
=head1 NAME
Install the Copy Sender code on a WebGUI site. If the RFE for this is accepted, then
the subroutines should be moved into an upgrade script.
=head1 SYNOPSIS
installCopySender --configFile config.conf ...
installCopySender --help
=head1 DESCRIPTION
This WebGUI utility script helps you install Copy Sender.
=head1 ARGUMENTS
=head1 OPTIONS
=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<--help>
Shows a short summary and usage
=item B<--man>
Shows this document
=back
=head1 AUTHOR
Copyright 2001-2009 SDH Consulting Pty, Ltd.
=cut
#vim:ft=perl