Remove the headblock property from the Template Asset, and merge

it into extra head tags.  Style templates are not allowed to
have extra head tags.
This commit is contained in:
Colin Kuskie 2008-11-26 21:24:44 +00:00
parent d3f8a075a7
commit 2b3b3fd458
7 changed files with 108 additions and 46 deletions

View file

@ -20,6 +20,7 @@ use Getopt::Long;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Asset;
use WebGUI::Asset;
my $toVersion = "7.6.5"; # make this match what version you're going to
@ -27,12 +28,42 @@ my $quiet; # this line required
my $session = start(); # this line required
fixAccountMisspellings( $session );
fixAccountMisspellings( $session );
removeTemplateHeadBlock( $session );
# upgrade functions go here
finish($session); # this line required
#----------------------------------------------------------------------------
# Describe what our function does
sub removeTemplateHeadBlock {
my $session = shift;
print "\tMerging Template head blocks into the Extra Head Tags field... " unless $quiet;
my $sth = $session->db->prepare('select assetId, revisionDate, headBlock from template');
$sth->execute();
TMPL: while (my $templateData = $sth->hashRef) {
my $template = WebGUI::Asset->new($session,
$templateData->{assetId}, 'WebGUI::Asset::Template',
$templateData->{revisionDate},
);
next TMPL unless defined $template;
if ($template->get('namespace') eq 'style') {
$template->update({
extraHeadTags => '',
});
}
else {
$template->update({
extraHeadTags => $template->getExtraHeadTags . $templateData->{headBlock},
});
}
}
$session->db->write('ALTER TABLE template DROP COLUMN headBlock');
# and here's our code
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
#sub exampleFunction {