Initial commit.
This commit is contained in:
commit
cfa018e04b
3 changed files with 315 additions and 0 deletions
135
sbin/install_newsletter.pl
Normal file
135
sbin/install_newsletter.pl
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
$|++; # disable output buffering
|
||||
our ( $webguiRoot, $configFile );
|
||||
|
||||
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,
|
||||
);
|
||||
|
||||
my $session = start( $webguiRoot, $configFile );
|
||||
|
||||
installMailableAspectTable( $session );
|
||||
installNewsletterCollection( $session );
|
||||
|
||||
finish($session);
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub installMailableAspectTable {
|
||||
my $session = shift;
|
||||
print "\tCreating Mailable aspect table...";
|
||||
|
||||
$session->db->write(<<EOSQL);
|
||||
create table if not exists assetAspectMailable (
|
||||
assetId char(22) binary not null,
|
||||
revisionDate bigint(20) not null,
|
||||
primary key( assetId, revisionDate )
|
||||
);
|
||||
EOSQL
|
||||
|
||||
print "Done.\n";
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub installNewsletterCollection {
|
||||
my $session = shift;
|
||||
print "\tCreating NewsletterCollection table...";
|
||||
|
||||
$session->db->write(<<EOSQL);
|
||||
create table if not exists NewsletterCollection (
|
||||
assetId char(22) binary not null,
|
||||
revisionDate bigint(20) not null,
|
||||
primary key( assetId, revisionDate )
|
||||
);
|
||||
EOSQL
|
||||
|
||||
print "Done.\n";
|
||||
}
|
||||
#----------------------------------------------------------------------------
|
||||
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
|
||||
|
||||
utility - A template for WebGUI utility scripts
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
utility --configFile config.conf ...
|
||||
|
||||
utility --help
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This WebGUI utility script helps you...
|
||||
|
||||
=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 Plain Black Corporation.
|
||||
|
||||
=cut
|
||||
|
||||
#vim:ft=perl
|
||||
Loading…
Add table
Add a link
Reference in a new issue