removing first parameter from WebGUI::Session->open and other cleanups
This commit is contained in:
parent
29df110409
commit
a141de0ebf
39 changed files with 150 additions and 291 deletions
|
|
@ -10,31 +10,26 @@
|
|||
# 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::Paths -inc;
|
||||
use WebGUI::Session;
|
||||
|
||||
$|++; # disable output buffering
|
||||
|
||||
# Get parameters here, including $help
|
||||
GetOptions(
|
||||
'configFile=s' => \$configFile,
|
||||
'help' => \$help,
|
||||
'man' => \$man,
|
||||
'configFile=s' => \(my $configFile),
|
||||
'help' => \(my $help),
|
||||
'man' => \(my $man),
|
||||
);
|
||||
|
||||
pod2usage( verbose => 1 ) if $help;
|
||||
pod2usage( verbose => 2 ) if $man;
|
||||
pod2usage( msg => "Must specify a config file!" ) unless $configFile;
|
||||
pod2usage( msg => "Must specify a config file!" ) unless $configFile;
|
||||
|
||||
my $session = start( $webguiRoot, $configFile );
|
||||
my $session = start( $configFile );
|
||||
# Do your work here
|
||||
finish($session);
|
||||
|
||||
|
|
@ -43,9 +38,8 @@ finish($session);
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
sub start {
|
||||
my $webguiRoot = shift;
|
||||
my $configFile = shift;
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
my $session = WebGUI::Session->open($configFile);
|
||||
$session->user({userId=>3});
|
||||
|
||||
## If your script is adding or changing content you need these lines, otherwise leave them commented
|
||||
|
|
|
|||
|
|
@ -10,16 +10,10 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use strict;
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::User;
|
||||
use WebGUI::Inbox;
|
||||
|
|
@ -51,7 +45,7 @@ pod2usage( verbose => 2 ) if $help;
|
|||
pod2usage() unless $configFile;
|
||||
|
||||
print "Starting up...\n" unless ($quiet);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
my $session = WebGUI::Session->open($configFile);
|
||||
|
||||
if ($userMessageFile) {
|
||||
print "Opening message file.." unless ($quiet);
|
||||
|
|
|
|||
|
|
@ -10,16 +10,10 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use strict;
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset;
|
||||
|
||||
|
|
@ -54,7 +48,7 @@ finish($session);
|
|||
|
||||
#-------------------------------------------------
|
||||
sub start {
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
my $session = WebGUI::Session->open($configFile);
|
||||
$session->user({userId=>3});
|
||||
return $session;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,16 +10,8 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot, @nailable);
|
||||
use strict;
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
@nailable = qw(jpg jpeg png gif);
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
|
||||
$| = 1;
|
||||
|
||||
use File::Path;
|
||||
use File::stat;
|
||||
|
|
@ -27,13 +19,17 @@ use FileHandle;
|
|||
use Getopt::Long;
|
||||
use POSIX;
|
||||
use Pod::Usage;
|
||||
use strict;
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Asset::File;
|
||||
use WebGUI::Asset::File::Image;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Utility;
|
||||
|
||||
$| = 1;
|
||||
|
||||
my @nailable = qw(jpg jpeg png gif);
|
||||
|
||||
# TB : Get the time as soon as possible. Use $now as global variable.
|
||||
# $now is used for skipOlderThan feature.
|
||||
my $now = time;
|
||||
|
|
@ -89,7 +85,7 @@ my %ListAssetExists;
|
|||
my %filelisthash;
|
||||
|
||||
print "Starting..." unless ($quiet);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
my $session = WebGUI::Session->open($configFile);
|
||||
$session->user({userId=>3});
|
||||
print "OK\n" unless ($quiet);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,14 +10,13 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
$|=1;
|
||||
use lib '../lib';
|
||||
use strict;
|
||||
use Carp qw( carp croak );
|
||||
use File::Find;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use Scalar::Util qw( blessed );
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Asset::Wobject::Collaboration;
|
||||
use WebGUI::Asset::Wobject::GalleryAlbum;
|
||||
use WebGUI::Asset::Wobject::Gallery;
|
||||
|
|
@ -25,6 +24,7 @@ use WebGUI::Asset::Wobject::Folder;
|
|||
use WebGUI::Asset::Post::Thread;
|
||||
use WebGUI::Storage;
|
||||
|
||||
$|=1;
|
||||
|
||||
# custom flags
|
||||
my ($fromAssetId, $fromPath, $fromAssetUrl, $toId, $toUrl) = undef;
|
||||
|
|
@ -378,7 +378,7 @@ sub start {
|
|||
pod2usage("$0: Must specify a --configFile");
|
||||
}
|
||||
|
||||
my $session = WebGUI::Session->open("..",$configFile);
|
||||
my $session = WebGUI::Session->open($configFile);
|
||||
$session->user({userId=>3});
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
|
|
|
|||
|
|
@ -10,19 +10,10 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
||||
our $webguiRoot;
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use DBI;
|
||||
use FileHandle;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use strict qw(subs vars);
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset;
|
||||
|
||||
|
|
@ -46,7 +37,7 @@ pod2usage( verbose => 2 ) if $help;
|
|||
pod2usage() if ($configFile eq '' || !($assetId||$url) );
|
||||
|
||||
# Open WebGUI session
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
my $session = WebGUI::Session->open($configFile);
|
||||
$session->user({userId=>$userId}) if (defined $userId);
|
||||
$session->scratch->set("personalStyleId", $styleId) if (defined $styleId);
|
||||
|
||||
|
|
@ -54,23 +45,26 @@ my $asset = undef;
|
|||
|
||||
if ($url) {
|
||||
$asset = WebGUI::Asset->newByUrl($session,$url);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$asset = WebGUI::Asset->newByDynamicClass($session,$assetId);
|
||||
}
|
||||
|
||||
if (defined $asset) {
|
||||
my $file = undef;
|
||||
my $file;
|
||||
if ($toFile) {
|
||||
$file = FileHandle->new(">$toFile") or die "Can't open file $toFile for writing. $!";
|
||||
open $file '>', $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->print($content);
|
||||
$session->output->setHandle(undef);
|
||||
}
|
||||
$file->close if (defined $file);
|
||||
} else {
|
||||
close $file
|
||||
if defined $file;
|
||||
}
|
||||
else {
|
||||
print "Asset not defined!!\n";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use lib "../lib";
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Pluggable;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Paths;
|
||||
|
|
@ -48,7 +48,7 @@ die "Config file '$configFile' does not exist!\n"
|
|||
if !-f WebGUI::Paths->configBase . '/' . $configFile;
|
||||
|
||||
# Open the session
|
||||
my $session = WebGUI::Session->open( "..", $configFile );
|
||||
my $session = WebGUI::Session->open( $configFile );
|
||||
$session->user( { userId => 3 } );
|
||||
|
||||
# Install or uninstall the asset
|
||||
|
|
|
|||
|
|
@ -11,16 +11,10 @@
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use strict;
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Session;
|
||||
|
||||
my $help;
|
||||
|
|
@ -39,7 +33,7 @@ pod2usage( verbose => 2 ) if $help;
|
|||
pod2usage() if $configFile eq "";
|
||||
|
||||
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
my $session = WebGUI::Session->open($configFile);
|
||||
$session->setting->remove('specialState');
|
||||
$session->setting->add('specialState','upgrading') unless $stop;
|
||||
$session->var->end;
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
# Add paths to lib folders where you have custom plugins for WebGUI.
|
||||
# Note that the folder must contain the same directory structure of
|
||||
# of WebGUI itself. This file should reside at WebGUI/sbin/preload.custom
|
||||
/data/Custom/lib
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
# Create preload.exclude in your WebGUI/sbin directory and add modules to it
|
||||
# that you don't want to be loaded by modperl. This will decrease the overall
|
||||
# size of your modperl instances, which will increase performance, and reduce
|
||||
# memory use.
|
||||
WebGUI::Auth::LDAP
|
||||
WebGUI::Asset::Wobject::WSClient
|
||||
WebGUI::Asset::File::ZipArchive
|
||||
WebGUI::Asset::Template::HTMLTemplateExpr
|
||||
WebGUI::Asset::Template::TemplateToolkit
|
||||
WebGUI::Asset::Wobject::Matrix
|
||||
WebGUI::Asset::Wobject::HttpProxy
|
||||
WebGUI::Asset::Sku::Product
|
||||
WebGUI::Asset::Sku::Donation
|
||||
WebGUI::Asset::Sku::Subscription
|
||||
WebGUI::Asset::Sku::FlatDiscount
|
||||
WebGUI::Asset::Sku::EMSBadge
|
||||
WebGUI::Asset::Sku::EMSRibbon
|
||||
WebGUI::Asset::Sku::EMSTicket
|
||||
WebGUI::Asset::Sku::EMSToken
|
||||
WebGUI::Asset::Sku
|
||||
WebGUI::Asset::Wobject::Survey
|
||||
WebGUI::Asset::Wobject::InOutBoard
|
||||
WebGUI::Asset::Wobject::Dashboard
|
||||
WebGUI::Asset::Wobject::EventManagementSystem
|
||||
WebGUI::Asset::Wobject::ProjectManager
|
||||
WebGUI::Asset::Wobject::SyndicatedContent
|
||||
WebGUI::Asset::Wobject::WSClient
|
||||
WebGUI::Asset::Wobject::MultiSearch
|
||||
WebGUI::Shop::Vendor
|
||||
WebGUI::Shop::Transaction
|
||||
WebGUI::Shop::CartItem
|
||||
WebGUI::Shop::Cart
|
||||
WebGUI::Shop::Ship
|
||||
WebGUI::Shop::Pay
|
||||
WebGUI::Shop::TransactionItem
|
||||
WebGUI::Shop::Credit
|
||||
WebGUI::Shop::AddressBook
|
||||
WebGUI::Shop::Admin
|
||||
WebGUI::Shop::PayDriver
|
||||
WebGUI::Shop::Products
|
||||
WebGUI::Shop::PayDriver::Cash
|
||||
WebGUI::Shop::PayDriver::ITransact
|
||||
WebGUI::Shop::Address
|
||||
WebGUI::Shop::ShipDriver
|
||||
WebGUI::Shop::Tax
|
||||
WebGUI::Shop::ShipDriver::FlatRate
|
||||
WebGUI::Content::Shop
|
||||
WebGUI::Macro::AOIHits
|
||||
WebGUI::Macro::AOIRank
|
||||
WebGUI::Macro::AdminText
|
||||
WebGUI::Macro::CanEditText
|
||||
WebGUI::Macro::CartItemCount
|
||||
WebGUI::Macro::EditableToggle
|
||||
WebGUI::Macro::Execute
|
||||
WebGUI::Macro::FormParam
|
||||
WebGUI::Macro::GroupAdd
|
||||
WebGUI::Macro::GroupDelete
|
||||
WebGUI::Macro::GroupText
|
||||
WebGUI::Macro::Include
|
||||
WebGUI::Macro::LastModified
|
||||
WebGUI::Macro::MiniCart
|
||||
WebGUI::Macro::Quote
|
||||
WebGUI::Macro::RootTitle
|
||||
WebGUI::Macro::SQL
|
||||
WebGUI::Macro::SpectreCheck
|
||||
WebGUI::Macro::Splat_random
|
||||
WebGUI::Macro::URLEncode
|
||||
WebGUI::Macro::ViewCart
|
||||
WebGUI::Macro::Widget
|
||||
|
|
@ -1,62 +1,24 @@
|
|||
use strict;
|
||||
|
||||
my $webguiRoot = '/data/WebGUI';
|
||||
use WebGUI::Paths -preload;
|
||||
|
||||
@INC = grep { $_ ne q{.} } @INC;
|
||||
use Log::Log4perl;
|
||||
Log::Log4perl->init( WebGUI::Paths->logConfig );
|
||||
|
||||
unshift @INC, "$webguiRoot/lib";
|
||||
use DBI;
|
||||
DBI->install_driver("mysql");
|
||||
|
||||
# add custom lib directories to library search path
|
||||
unshift @INC, grep {
|
||||
if (!-d $_) {
|
||||
warn "WARNING: Not adding lib directory '$_' from $webguiRoot/sbin/preload.custom: Directory does not exist.\n";
|
||||
0;
|
||||
}
|
||||
else {
|
||||
1;
|
||||
}
|
||||
} readLines($webguiRoot."/sbin/preload.custom");
|
||||
|
||||
#----------------------------------------
|
||||
# Logger
|
||||
#----------------------------------------
|
||||
require Log::Log4perl;
|
||||
Log::Log4perl->init( $webguiRoot."/etc/log.conf" );
|
||||
|
||||
#----------------------------------------
|
||||
# Database connectivity.
|
||||
#----------------------------------------
|
||||
#require Apache::DBI; # Uncomment if you want to enable connection pooling. Not recommended on servers with many sites, or those using db slaves.
|
||||
require DBI;
|
||||
DBI->install_driver("mysql"); # Change to match your database driver.
|
||||
|
||||
#----------------------------------------
|
||||
# WebGUI modules.
|
||||
#----------------------------------------
|
||||
require WebGUI;
|
||||
require WebGUI::Config;
|
||||
require WebGUI::Pluggable;
|
||||
|
||||
# these modules should always be skipped
|
||||
my @excludes;
|
||||
push @excludes, readLines($webguiRoot."/sbin/preload.exclude");
|
||||
|
||||
WebGUI::Pluggable::findAndLoad( "WebGUI",
|
||||
{
|
||||
exclude => \@excludes,
|
||||
onLoadFail => sub { warn sprintf 'Error loading %s: %s', @_ },
|
||||
}
|
||||
);
|
||||
|
||||
require APR::Request::Apache2;
|
||||
require Apache2::Cookie;
|
||||
require Apache2::ServerUtil;
|
||||
use WebGUI;
|
||||
use WebGUI::Config;
|
||||
use APR::Request::Apache2;
|
||||
use Apache2::Cookie;
|
||||
use Apache2::ServerUtil;
|
||||
|
||||
if ( $ENV{MOD_PERL} ) {
|
||||
# Add WebGUI to Apache version tokens
|
||||
my $server = Apache2::ServerUtil->server;
|
||||
$server->push_handlers(PerlPostConfigHandler => sub {
|
||||
$server->add_version_component("WebGUI/".$WebGUI::VERSION);
|
||||
$server->add_version_component('WebGUI/' . $WebGUI::VERSION);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -64,28 +26,7 @@ $| = 1;
|
|||
|
||||
print "\nStarting WebGUI ".$WebGUI::VERSION."\n";
|
||||
|
||||
#----------------------------------------
|
||||
# Preload all site configs.
|
||||
#----------------------------------------
|
||||
WebGUI::Config->loadAllConfigs($webguiRoot);
|
||||
|
||||
|
||||
# reads lines from a file into an array, trimming white space and ignoring commented lines
|
||||
sub readLines {
|
||||
my $file = shift;
|
||||
my @lines;
|
||||
if (open(my $fh, '<', $file)) {
|
||||
while (my $line = <$fh>) {
|
||||
$line =~ s/#.*//;
|
||||
$line =~ s/^\s+//;
|
||||
$line =~ s/\s+$//;
|
||||
next if !$line;
|
||||
push @lines, $line;
|
||||
}
|
||||
close $fh;
|
||||
}
|
||||
return @lines;
|
||||
}
|
||||
WebGUI::Config->loadAllConfigs;
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,16 +10,11 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use File::Find ();
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Config;
|
||||
|
||||
local $| = 1; #disable output buffering
|
||||
|
|
@ -31,8 +26,7 @@ GetOptions(
|
|||
pod2usage( verbose => 2 ) if $help;
|
||||
pod2usage() if $configFile eq '';
|
||||
|
||||
my $config = WebGUI::Config->new($webguiRoot,$configFile);
|
||||
use File::Find;
|
||||
my $config = WebGUI::Config->new($configFile);
|
||||
|
||||
print "\tRemoving unnecessary .wgaccess files.\n";
|
||||
my $uploadsPath = $config->get('uploadsPath');
|
||||
|
|
|
|||
|
|
@ -10,22 +10,14 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
|
||||
$| = 1;
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use strict;
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Utility;
|
||||
|
||||
$| = 1;
|
||||
my $configFile;
|
||||
my $help;
|
||||
my $quiet;
|
||||
|
|
@ -40,7 +32,7 @@ pod2usage( verbose => 2 ) if $help;
|
|||
pod2usage() unless (defined($configFile) && $configFile ne '');
|
||||
|
||||
print "Starting..." unless ($quiet);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
my $session = WebGUI::Session->open($configFile);
|
||||
print "OK\n" unless ($quiet);
|
||||
|
||||
print "Looking for descendant replationships...\n" unless ($quiet);
|
||||
|
|
|
|||
|
|
@ -10,15 +10,9 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Config;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -47,7 +41,7 @@ GetOptions(
|
|||
pod2usage( verbose => 2 ) if $help;
|
||||
|
||||
if ($configFile) {
|
||||
my $session = WebGUI::Session->open($webguiRoot, $configFile);
|
||||
my $session = WebGUI::Session->open($configFile);
|
||||
if ($indexsite) {
|
||||
reindexSite($session);
|
||||
} elsif ($updatesite) {
|
||||
|
|
@ -67,10 +61,10 @@ if ($configFile) {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub reindexAllSites {
|
||||
my $configs = WebGUI::Config->readAllConfigs($webguiRoot);
|
||||
my $configs = WebGUI::Config->readAllConfigs;
|
||||
foreach my $site (keys %{$configs}) {
|
||||
print "Indexing ".$site."...\n";
|
||||
my $session = WebGUI::Session->open($webguiRoot,$site);
|
||||
my $session = WebGUI::Session->open($site);
|
||||
reindexSite($session);
|
||||
$session->var->end;
|
||||
$session->close;
|
||||
|
|
|
|||
|
|
@ -10,19 +10,14 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use Pod::Usage;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Pod::Usage;
|
||||
use Getopt::Long;
|
||||
use File::Spec;
|
||||
use POE::Component::IKC::ClientLite;
|
||||
use Spectre::Admin;
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Config;
|
||||
use JSON;
|
||||
|
||||
|
|
@ -52,9 +47,7 @@ GetOptions(
|
|||
pod2usage( verbose => 2 ) if $help;
|
||||
pod2usage() unless ($ping||$shutdown||$daemon||$run||$test||$status);
|
||||
|
||||
require File::Spec;
|
||||
# Convert to absolute since we'll be changing directory
|
||||
my $config = WebGUI::Config->new(File::Spec->rel2abs($webguiRoot),"spectre.conf",1);
|
||||
my $config = WebGUI::Config->new( WebGUI::Paths->spectreConfig, 1);
|
||||
unless (defined $config) {
|
||||
print <<STOP;
|
||||
|
||||
|
|
|
|||
12
sbin/syncToCdn.pl
Normal file → Executable file
12
sbin/syncToCdn.pl
Normal file → Executable file
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -8,16 +10,10 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our $webguiRoot;
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift( @INC, $webguiRoot . "/lib" );
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Fcntl ':flock';
|
||||
use Getopt::Long;
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Storage;
|
||||
use Pod::Usage;
|
||||
|
|
@ -51,7 +47,7 @@ if ( !( $^O =~ /^Win/i ) && $> != 0 && !$override ) {
|
|||
}
|
||||
|
||||
print "Starting..." unless ($quiet);
|
||||
my $session = WebGUI::Session->open( $webguiRoot, $configFile );
|
||||
my $session = WebGUI::Session->open( $configFile );
|
||||
$session->user( { userId => 3 } );
|
||||
print "OK\n" unless ($quiet);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,13 +10,6 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
#-----------------------------------------
|
||||
# A little utility to generate WebGUI
|
||||
# thumbnails.
|
||||
|
|
@ -29,6 +22,7 @@ use Pod::Usage;
|
|||
use Image::Magick;
|
||||
|
||||
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::Utility;
|
||||
|
||||
my $thumbnailSize;
|
||||
|
|
|
|||
|
|
@ -10,29 +10,16 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Cwd ();
|
||||
use File::Path ();
|
||||
use File::Spec;
|
||||
use Getopt::Long ();
|
||||
use Pod::Usage ();
|
||||
use WebGUI::Paths -inc;
|
||||
|
||||
foreach my $libDir ( readLines( "$webguiRoot/sbin/preload.custom" ) ) {
|
||||
if ( !-d $libDir ) {
|
||||
warn "WARNING: Not adding lib directory '$libDir' from $webguiRoot/sbin/preload.custom: Directory does not exist.\n";
|
||||
next;
|
||||
}
|
||||
unshift @INC, $libDir;
|
||||
}
|
||||
|
||||
require WebGUI::Config;
|
||||
require WebGUI::Session;
|
||||
use WebGUI::Config;
|
||||
use WebGUI::Session;
|
||||
|
||||
my $help;
|
||||
my $history;
|
||||
|
|
@ -108,14 +95,14 @@ if ($^O =~ /^Win/i) {
|
|||
} else {
|
||||
$slash = "/";
|
||||
}
|
||||
our $upgradesPath = $webguiRoot.$slash."docs".$slash."upgrades".$slash;
|
||||
our $upgradesPath = WebGUI::Paths->upgrades;
|
||||
our (%upgrade, %config);
|
||||
|
||||
|
||||
## Find site configs.
|
||||
|
||||
print "\nGetting site configs...\n" unless ($quiet);
|
||||
my $configs = WebGUI::Config->readAllConfigs($webguiRoot);
|
||||
my $configs = WebGUI::Config->readAllConfigs;
|
||||
foreach my $filename (keys %{$configs}) {
|
||||
print "\tProcessing $filename.\n" unless ($quiet);
|
||||
$config{$filename}{configFile} = $filename;
|
||||
|
|
@ -130,7 +117,7 @@ foreach my $filename (keys %{$configs}) {
|
|||
$config{$filename}{mysqlCLI} = $configs->{$filename}->get("mysqlCLI");
|
||||
$config{$filename}{mysqlDump} = $configs->{$filename}->get("mysqlDump");
|
||||
$config{$filename}{backupPath} = $configs->{$filename}->get("backupPath");
|
||||
my $session = WebGUI::Session->open($webguiRoot,$filename);
|
||||
my $session = WebGUI::Session->open($filename);
|
||||
($config{$filename}{version}) = $session->db->quickArray("select webguiVersion from webguiVersion order by
|
||||
dateApplied desc, length(webguiVersion) desc, webguiVersion desc limit 1");
|
||||
unless ($history) {
|
||||
|
|
@ -141,10 +128,10 @@ foreach my $filename (keys %{$configs}) {
|
|||
}
|
||||
unless ($skipDelete) {
|
||||
print "\tDeleting temp files.\n" unless ($quiet);
|
||||
my $path = $configs->{$filename}->get("uploadsPath").$slash."temp";
|
||||
my $path = File::Spec->catdir($configs->{$filename}->get("uploadsPath"), 'temp');
|
||||
File::Path::rmtree($path) unless ($path eq "" || $path eq "/" || $path eq "/data");
|
||||
print "\tDeleting file cache.\n" unless ($quiet);
|
||||
$path = $configs->{$filename}->get("fileCacheRoot")||"/tmp/WebGUICache";
|
||||
$path = $configs->{$filename}->get("fileCacheRoot") || "/tmp/WebGUICache";
|
||||
File::Path::rmtree($path) unless ($path eq "" || $path eq "/" || $path eq "/data");
|
||||
}
|
||||
}
|
||||
|
|
@ -159,7 +146,7 @@ if ($history) {
|
|||
print "\nDisplaying upgrade history for each site.\n";
|
||||
foreach my $file (keys %config) {
|
||||
print "\n".$file."\n";
|
||||
my $session = WebGUI::Session->open($webguiRoot,$file);
|
||||
my $session = WebGUI::Session->open($file);
|
||||
my $sth = $session->db->read("select * from webguiVersion order by dateApplied asc, webguiVersion asc");
|
||||
while (my $data = $sth->hashRef) {
|
||||
print "\t".sprintf("%-8s %-15s %-15s",
|
||||
|
|
@ -220,7 +207,7 @@ foreach my $filename (keys %config) {
|
|||
$cmd .= " --host=".$config{$filename}{host} if ($config{$filename}{host});
|
||||
$cmd .= " --port=".$config{$filename}{port} if ($config{$filename}{port});
|
||||
$cmd .= " --add-drop-table ".$config{$filename}{db}." --result-file="
|
||||
.$backupTo.$slash.$config{$filename}{db}."_".$upgrade{$upgrade}{from}."_".time.".sql";
|
||||
.File::Spec->catfile($backupTo, $config{$filename}{db}."_".$upgrade{$upgrade}{from}."_".time.".sql");
|
||||
unless (system($cmd)) {
|
||||
print "OK\n" unless ($quiet);
|
||||
} else {
|
||||
|
|
@ -267,7 +254,7 @@ foreach my $filename (keys %config) {
|
|||
sleep 1; # Sleep a second to avoid adding asset revisions too quickly
|
||||
}
|
||||
chdir($currentPath);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$filename);
|
||||
my $session = WebGUI::Session->open($filename);
|
||||
print "\tSetting site upgrade completed..." unless ($quiet);
|
||||
$session->setting->remove('specialState');
|
||||
$session->close();
|
||||
|
|
|
|||
|
|
@ -10,17 +10,11 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Digest::MD5;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use WebGUI::Paths -inc;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Group;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -78,7 +72,7 @@ if (!($^O =~ /^Win/i) && $> != 0 && !$override) {
|
|||
|
||||
|
||||
print "Starting up..." unless ($quiet);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
my $session = WebGUI::Session->open($configFile);
|
||||
$session->user({userId=>3});
|
||||
open(FILE,"<".$usersFile);
|
||||
print "OK\n" unless ($quiet);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue