/usr/bin/wg-generateContent is in webgui 7.9.33-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | #!/usr/bin/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
#-------------------------------------------------------------------
use strict;
use File::Basename ();
use File::Spec;
my $webguiRoot;
BEGIN {
$webguiRoot = '/usr/share/webgui';
unshift @INC, File::Spec->catdir($webguiRoot, 'lib');
}
use DBI;
use FileHandle;
use Getopt::Long;
use Pod::Usage;
no strict 'refs';
use WebGUI::Session;
use WebGUI::Asset;
$|=1;
my ($configFile, $assetId, $userId, $styleId, $toFile, $help);
$userId = 1;
my $url = "";
GetOptions(
'configFile:s'=>\$configFile,
'assetId:s'=>\$assetId,
'userId:s'=>\$userId,
'toFile:s'=>\$toFile,
'help'=>\$help,
'styleId:s'=>\$styleId,
'url=s'=>\$url
);
pod2usage( verbose => 2 ) if $help;
pod2usage() if ($configFile eq '' || !($assetId||$url) );
# Open WebGUI session
my $session = WebGUI::Session->open($webguiRoot,$configFile);
$session->user({userId=>$userId}) if (defined $userId);
$session->scratch->set("personalStyleId", $styleId) if (defined $styleId);
my $asset = undef;
if ($url) {
$asset = WebGUI::Asset->newByUrl($session,$url);
} else {
$asset = WebGUI::Asset->newByDynamicClass($session,$assetId);
}
if (defined $asset) {
my $file = undef;
if ($toFile) {
$file = FileHandle->new(">$toFile") or die "Can't open file $toFile for writing. $!";
$session->output->setHandle($file);
}
my $content = $asset->www_view;
unless ($content eq "chunked") {
$session->output->print($content);
$session->output->setHandle(undef);
}
$file->close if (defined $file);
} else {
print "Asset not defined!!\n";
}
# Clean-up WebGUI Session
$session->var->end;
$session->close;
exit;
__END__
=head1 NAME
generateContent - Generate content for a specified Asset
=head1 SYNOPSIS
generateContent --configFile config.conf {--url home|--assetID id}
[--styleId id]
[--toFile pathname]
[--userId id]
generateContent --help
=head1 DESCRIPTION
This WebGUI utility script generates content for an Asset specified
either by its URL or its Asset ID. The content is sent to standard
output or to a filename.
A particular WebGUI UserId can be specified as a viewer, in order
to check whether the content is correctly generated or not, being
possible to specify any of the available WebGUI styles to format
the generated content.
=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<--assetId id>
Generate content for WebGUI's Asset identified by B<id>. Either this
parameter or B<--url> must be supplied.
=item B<--url url>
Generate content for WebGUI's Asset located at B<url>, which must be
relative to the server (e.g. B</home> instead of B<http://your.server/home>).
Either this parameter or B<--assetID> must be supplied.
=item B<--styleId id>
Use the WebGUI style specified by the AssetID B<id>. If left unspecified,
it defaults to using the Asset's default style.
=item B<--toFile pathname>
Send generated content to the specified filename. If left unspecified,
content is sent to standard output.
=item B<--userId id>
Set a specific WebGUI user to act as content viewer. If left unspecified,
defaults to B<1> (Visitor).
=item B<--help>
Shows this documentation, then exits.
=back
=head1 AUTHOR
Copyright 2001-2009 Plain Black Corporation.
=cut
|