Merge branch 'master' of git@github.com:plainblack/webgui
This commit is contained in:
commit
9db3e02444
38 changed files with 898 additions and 228 deletions
Binary file not shown.
Binary file not shown.
|
|
@ -22,6 +22,7 @@ use Getopt::Long;
|
|||
use WebGUI::Session;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Utility;
|
||||
|
||||
|
||||
my $toVersion = '7.8.3';
|
||||
|
|
@ -33,25 +34,49 @@ my $session = start(); # this line required
|
|||
# upgrade functions go here
|
||||
reKeyTemplateAttachments($session);
|
||||
addSelectPaymentGatewayTemplateToSettings($session);
|
||||
addClipboardAdminSetting($session);
|
||||
addTrashAdminSetting($session);
|
||||
addPickLanguageMacro($session);
|
||||
installSetLanguage($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addClipboardAdminSetting {
|
||||
my $session = shift;
|
||||
print "\tAdding clipboard admin setting... " unless $quiet;
|
||||
$session->setting->add('groupIdAdminClipboard', 3);
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addTrashAdminSetting {
|
||||
my $session = shift;
|
||||
print "\tAdding trash admin setting... " unless $quiet;
|
||||
$session->setting->add('groupIdAdminTrash', 3);
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Describe what our function does
|
||||
sub reKeyTemplateAttachments {
|
||||
my $session = shift;
|
||||
print "\tChanging the key structure for the template attachments table... " unless $quiet;
|
||||
# and here's our code
|
||||
$session->db->write('ALTER TABLE template_attachments ADD COLUMN attachId CHAR(22) BINARY NOT NULL');
|
||||
my $rh = $session->db->read('select url, templateId, revisionDate from template_attachments');
|
||||
my $wh = $session->db->prepare('update template_attachments set attachId=? where url=? and templateId=? and revisionDate=?');
|
||||
while (my @key = $rh->array) {
|
||||
$wh->execute([$session->id->generate, @key ]);
|
||||
my $columnExists = $session->db->dbh->column_info(undef, undef, 'template_attachments', 'attachId')->fetchrow_hashref;
|
||||
if (! $columnExists) {
|
||||
# and here's our code
|
||||
$session->db->write('ALTER TABLE template_attachments ADD COLUMN attachId CHAR(22) BINARY NOT NULL');
|
||||
my $rh = $session->db->read('select url, templateId, revisionDate from template_attachments');
|
||||
my $wh = $session->db->prepare('update template_attachments set attachId=? where url=? and templateId=? and revisionDate=?');
|
||||
while (my @key = $rh->array) {
|
||||
$wh->execute([$session->id->generate, @key ]);
|
||||
}
|
||||
$rh->finish;
|
||||
$wh->finish;
|
||||
$session->db->write('ALTER TABLE template_attachments DROP PRIMARY KEY');
|
||||
$session->db->write('ALTER TABLE template_attachments ADD PRIMARY KEY (attachId)');
|
||||
}
|
||||
$rh->finish;
|
||||
$wh->finish;
|
||||
$session->db->write('ALTER TABLE template_attachments DROP PRIMARY KEY');
|
||||
$session->db->write('ALTER TABLE template_attachments ADD PRIMARY KEY (attachId)');
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +85,7 @@ sub reKeyTemplateAttachments {
|
|||
sub addSelectPaymentGatewayTemplateToSettings {
|
||||
my $session = shift;
|
||||
print "\tAdding select payment gateway template to settings... " unless $quiet;
|
||||
$session->db->write("insert into settings values ('selectGatewayTemplateId', '2GxjjkRuRkdUg_PccRPjpA');");
|
||||
$session->setting->add('selectGatewayTemplateId', '2GxjjkRuRkdUg_PccRPjpA') unless $session->setting->has('selectGatewayTemplateId');
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
|
|
@ -71,6 +96,30 @@ sub addSelectPaymentGatewayTemplateToSettings {
|
|||
# print "DONE!\n" unless $quiet;
|
||||
#}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
sub addPickLanguageMacro {
|
||||
my $session = shift;
|
||||
print "\tAdding Pick Language macro... " unless $quiet;
|
||||
$session->config->set('macros/PickLanguage', 'PickLanguage');
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
sub installSetLanguage {
|
||||
my $session = shift;
|
||||
print "\tAdding SetLanguage content handler... " unless $quiet;
|
||||
##Content Handler
|
||||
my $contentHandlers = $session->config->get('contentHandlers');
|
||||
if (!isIn('WebGUI::Content::SetLanguage', @{ $contentHandlers }) ) {
|
||||
my @newHandlers = ();
|
||||
foreach my $handler (@{ $contentHandlers }) {
|
||||
push @newHandlers, $handler;
|
||||
push @newHandlers, 'WebGUI::Content::SetLanguage' if
|
||||
$handler eq 'WebGUI::Content::PassiveAnalytics';
|
||||
}
|
||||
$session->config->set('contentHandlers', \@newHandlers);
|
||||
}
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue