Make sure $webguiRoot is setup consistently in all utility scripts.
Some scripts had a hardcoded use lib "../lib" and "../.." on Session/Config method calls. This was changed to a BEGIN prologue where @INC gets $webguiRoot added, and the method calls use $webguiRoot instead. This eases the creation of patches for filesystem reorganization of the installed files (e.g. for Debian packages).
This commit is contained in:
parent
8dc4216edd
commit
8be24aec80
8 changed files with 59 additions and 17 deletions
|
|
@ -8,7 +8,13 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use lib "../lib";
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use strict;
|
||||
|
|
@ -46,7 +52,7 @@ finish($session);
|
|||
|
||||
#-------------------------------------------------
|
||||
sub start {
|
||||
my $session = WebGUI::Session->open("../",$configFile);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
$session->user({userId=>3});
|
||||
return $session;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,13 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use lib "../lib";
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
|
@ -84,7 +90,7 @@ sub start {
|
|||
pod2usage("$0: Must specify a --configFile");
|
||||
}
|
||||
|
||||
my $session = WebGUI::Session->open("..",$configFile);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
$session->user({userId=>3});
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,13 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use lib "../lib";
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
|
@ -84,7 +90,7 @@ sub start {
|
|||
pod2usage("$0: Must specify a --configFile");
|
||||
}
|
||||
|
||||
my $session = WebGUI::Session->open("..",$configFile);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
$session->user({userId=>3});
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,13 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use lib "../lib";
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
|
@ -23,7 +29,7 @@ GetOptions(
|
|||
pod2usage( verbose => 2 ) if $help;
|
||||
pod2usage() if $configFile eq '';
|
||||
|
||||
my $config = WebGUI::Config->new("..",$configFile);
|
||||
my $config = WebGUI::Config->new($webguiRoot,$configFile);
|
||||
use File::Find;
|
||||
|
||||
print "\tRemoving unnecessary .wgaccess files.\n";
|
||||
|
|
|
|||
|
|
@ -8,8 +8,14 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use lib '../lib';
|
||||
use Getopt::Long;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Config;
|
||||
|
|
@ -39,7 +45,7 @@ GetOptions(
|
|||
pod2usage( verbose => 2 ) if $help;
|
||||
|
||||
if ($configFile) {
|
||||
my $session = WebGUI::Session->open("..", $configFile);
|
||||
my $session = WebGUI::Session->open($webguiRoot, $configFile);
|
||||
if ($indexsite) {
|
||||
reindexSite($session);
|
||||
} elsif ($updatesite) {
|
||||
|
|
@ -59,10 +65,10 @@ if ($configFile) {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub reindexAllSites {
|
||||
my $configs = WebGUI::Config->readAllConfigs("..");
|
||||
my $configs = WebGUI::Config->readAllConfigs($webguiRoot);
|
||||
foreach my $site (keys %{$configs}) {
|
||||
print "Indexing ".$site."...\n";
|
||||
my $session = WebGUI::Session->open("..",$site);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$site);
|
||||
reindexSite($session);
|
||||
$session->var->end;
|
||||
$session->close;
|
||||
|
|
|
|||
|
|
@ -8,10 +8,16 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use Pod::Usage;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
use Getopt::Long;
|
||||
use POE::Component::IKC::ClientLite;
|
||||
use Spectre::Admin;
|
||||
|
|
@ -42,7 +48,7 @@ pod2usage( verbose => 2 ) if $help;
|
|||
pod2usage() unless ($ping||$shutdown||$daemon||$run||$test||$status);
|
||||
|
||||
require File::Spec;
|
||||
my $config = WebGUI::Config->new(File::Spec->rel2abs(".."),"spectre.conf",1);
|
||||
my $config = WebGUI::Config->new($webguiRoot,"spectre.conf",1);
|
||||
unless (defined $config) {
|
||||
print <<STOP;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,13 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
#-----------------------------------------
|
||||
# A little utility to generate WebGUI
|
||||
# thumbnails.
|
||||
|
|
@ -32,7 +39,6 @@ BEGIN {
|
|||
}
|
||||
}
|
||||
|
||||
use lib "../lib";
|
||||
use WebGUI::Utility;
|
||||
|
||||
my $thumbnailSize;
|
||||
|
|
|
|||
|
|
@ -149,7 +149,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("../..",$file);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$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",
|
||||
|
|
@ -237,7 +237,7 @@ foreach my $filename (keys %config) {
|
|||
$notRun = 0;
|
||||
sleep 1; # Sleep a second to avoid adding asset revisions too quickly
|
||||
}
|
||||
my $session = WebGUI::Session->open("../..",$filename);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$filename);
|
||||
print "\tSetting site upgrade completed..." unless ($quiet);
|
||||
$session->setting->remove('specialState');
|
||||
$session->close();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue