added a few utility methods to the config system, and updated the upgrade to reflect that
This commit is contained in:
parent
bbd17516e8
commit
45b11e0a1a
2 changed files with 123 additions and 11 deletions
|
|
@ -32,8 +32,7 @@ changeCache();
|
||||||
templateParsers();
|
templateParsers();
|
||||||
removeFiles();
|
removeFiles();
|
||||||
addSearchEngine();
|
addSearchEngine();
|
||||||
addEMSTemplates();
|
addEMS();
|
||||||
addEMSTables();
|
|
||||||
updateTemplates();
|
updateTemplates();
|
||||||
updateDatabaseLinksAndSQLReport();
|
updateDatabaseLinksAndSQLReport();
|
||||||
ipsToCIDR();
|
ipsToCIDR();
|
||||||
|
|
@ -144,9 +143,7 @@ sub addAdManager {
|
||||||
renderedAd text
|
renderedAd text
|
||||||
)");
|
)");
|
||||||
$session->db->write("alter table advertisement add index adSpaceId_isActive (adSpaceId, isActive)");
|
$session->db->write("alter table advertisement add index adSpaceId_isActive (adSpaceId, isActive)");
|
||||||
my $macros = $session->config->get("macros");
|
my $macros = $session->config->addToHash("macros","AdSpace","AdSpace");
|
||||||
$macros->{AdSpace} = "AdSpace";
|
|
||||||
$session->config->set("macros",$macros);
|
|
||||||
my $group = WebGUI::Group->new($session, "new", "pbgroup000000000000017");
|
my $group = WebGUI::Group->new($session, "new", "pbgroup000000000000017");
|
||||||
$group->name("Ad Manager");
|
$group->name("Ad Manager");
|
||||||
$group->description("These users will be able to manage advertisements.");
|
$group->description("These users will be able to manage advertisements.");
|
||||||
|
|
@ -600,7 +597,7 @@ sub updateTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
sub addEMSTemplates {
|
sub addEMS {
|
||||||
print "\tAdding Event Management System Templates.\n" unless ($quiet);
|
print "\tAdding Event Management System Templates.\n" unless ($quiet);
|
||||||
|
|
||||||
## Display Template ##
|
## Display Template ##
|
||||||
|
|
@ -925,11 +922,6 @@ EOT4
|
||||||
}, "EventManagerTmpl000004"
|
}, "EventManagerTmpl000004"
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------
|
|
||||||
sub addEMSTables {
|
|
||||||
|
|
||||||
print "\t Creating Event Management System tables.\n" unless ($quiet);
|
print "\t Creating Event Management System tables.\n" unless ($quiet);
|
||||||
|
|
||||||
my $sql1 = <<SQL1;
|
my $sql1 = <<SQL1;
|
||||||
|
|
@ -1046,6 +1038,7 @@ SQL8
|
||||||
$session->db->write($sql6);
|
$session->db->write($sql6);
|
||||||
$session->db->write($sql7);
|
$session->db->write($sql7);
|
||||||
$session->db->write($sql8);
|
$session->db->write($sql8);
|
||||||
|
$session->config->addToArray("assets","WebGUI::Asset::Wobject::EventManagementSystem");
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,13 @@ This package parses the WebGUI config file.
|
||||||
|
|
||||||
my $value = $config->get($param);
|
my $value = $config->get($param);
|
||||||
$config->set($param,$value);
|
$config->set($param,$value);
|
||||||
|
|
||||||
$config->delete($param);
|
$config->delete($param);
|
||||||
|
$config->deleteFromHash($name, $key);
|
||||||
|
$config->deleteFromArray($name, $value);
|
||||||
|
|
||||||
|
$config->addToHash($name, $key, $value);
|
||||||
|
$config->addToArray($name, $value);
|
||||||
|
|
||||||
my $configFileName = $config->getFilename;
|
my $configFileName = $config->getFilename;
|
||||||
my $webguiRoot = $config->getWebguiRoot;
|
my $webguiRoot = $config->getWebguiRoot;
|
||||||
|
|
@ -52,6 +58,63 @@ These subroutines are available from this package:
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 addToArray ( property, value )
|
||||||
|
|
||||||
|
Adds a value to an array property in the config file.
|
||||||
|
|
||||||
|
=head3 property
|
||||||
|
|
||||||
|
The name of the array.
|
||||||
|
|
||||||
|
=head3 value
|
||||||
|
|
||||||
|
The value to add.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub addToArray {
|
||||||
|
my $self = shift;
|
||||||
|
my $property = shift;
|
||||||
|
my $value = shift;
|
||||||
|
my $array = $self->get($property);
|
||||||
|
push(@{$array}, $value);
|
||||||
|
$self->set($property, $array);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 addToHash ( property, key, value )
|
||||||
|
|
||||||
|
Adds a value to a hash property in the config file.
|
||||||
|
|
||||||
|
=head3 property
|
||||||
|
|
||||||
|
The name of the hash.
|
||||||
|
|
||||||
|
=head3 key
|
||||||
|
|
||||||
|
The key to add.
|
||||||
|
|
||||||
|
=head3 value
|
||||||
|
|
||||||
|
The value to add.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub addToHash {
|
||||||
|
my $self = shift;
|
||||||
|
my $property = shift;
|
||||||
|
my $key = shift;
|
||||||
|
my $value = shift;
|
||||||
|
my $hash = $self->get($property);
|
||||||
|
$hash->{$key} = $value;
|
||||||
|
$self->set($property, $hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 delete ( param )
|
=head2 delete ( param )
|
||||||
|
|
@ -75,6 +138,62 @@ sub delete {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 deleteFromArray ( property, value )
|
||||||
|
|
||||||
|
Deletes a value from an array property in the config file.
|
||||||
|
|
||||||
|
=head3 property
|
||||||
|
|
||||||
|
The name of the array.
|
||||||
|
|
||||||
|
=head3 value
|
||||||
|
|
||||||
|
The value to delete.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub deleteFromArray {
|
||||||
|
my $self = shift;
|
||||||
|
my $property = shift;
|
||||||
|
my $value = shift;
|
||||||
|
my $array = $self->get($property);
|
||||||
|
for (my $i = 0; $i < scalar(@{$array}); $i++) {
|
||||||
|
if ($array->[$i] eq $value) {
|
||||||
|
splice(@{$array}, $i, 1);
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$self->set($property, $array);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 deleteFromHash ( property, key )
|
||||||
|
|
||||||
|
Delete a key from a hash property in the config file.
|
||||||
|
|
||||||
|
=head3 property
|
||||||
|
|
||||||
|
The name of the hash.
|
||||||
|
|
||||||
|
=head3 key
|
||||||
|
|
||||||
|
The key to delete.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub deleteFromHash {
|
||||||
|
my $self = shift;
|
||||||
|
my $property = shift;
|
||||||
|
my $key = shift;
|
||||||
|
my $hash = $self->get($property);
|
||||||
|
delete $hash->{$key};
|
||||||
|
$self->set($property, $hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 DESTROY ( )
|
=head2 DESTROY ( )
|
||||||
|
|
||||||
Deconstructor.
|
Deconstructor.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue