style and page template migrations complete
This commit is contained in:
parent
de758d8dfe
commit
5d0faf0e3f
12 changed files with 354 additions and 409 deletions
|
|
@ -7,6 +7,15 @@ upgrading from one version to the next, or even between multiple
|
|||
versions. Be sure to heed the warnings contained herein as they will
|
||||
save you many hours of grief.
|
||||
|
||||
6.0.0
|
||||
--------------------------------------------------------------------
|
||||
* You MUST clear your filesystem cache or WebGUI will crash. It is
|
||||
typically in /tmp/FileCache. A command like the following
|
||||
run as the super user will do the job nicely:
|
||||
|
||||
rm -Rf /tmp/FileCache
|
||||
|
||||
|
||||
5.5.0
|
||||
--------------------------------------------------------------------
|
||||
* If you have any custom Message Board templates they will be
|
||||
|
|
|
|||
3
docs/temp.sql
Normal file
3
docs/temp.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# add this stuff to previousVersion.sql just before 6.0 release
|
||||
|
||||
delete from style where styleId < 0;
|
||||
126
docs/upgrades/upgrade_5.5.3-6.0.0.pl
Normal file
126
docs/upgrades/upgrade_5.5.3-6.0.0.pl
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use lib "../../lib";
|
||||
use Getopt::Long;
|
||||
use Parse::PlainConfig;
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
my $configFile;
|
||||
my $quiet;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile,
|
||||
'quiet'=>\$quiet
|
||||
);
|
||||
WebGUI::Session::open("../..",$configFile);
|
||||
|
||||
|
||||
#--------------------------------------------
|
||||
print "\tMigrating styles.\n" unless ($quiet);
|
||||
my $sth = WebGUI::SQL->read("select * from style");
|
||||
while (my $style = $sth->hashRef) {
|
||||
my ($header,$footer) = split(/\^\-\;/,$style->{body});
|
||||
my ($newStyleId) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='style'");
|
||||
if ($style->{styleId} > 0 && $style->{styleId} < 25) {
|
||||
$newStyleId = $style->{styleId};
|
||||
} elsif ($newStyleId > 999) {
|
||||
$newStyleId++;
|
||||
} else {
|
||||
$newStyleId = 1000;
|
||||
}
|
||||
my $newStyle = $session{setting}{docTypeDec}.'
|
||||
<html>
|
||||
<head>
|
||||
<title><tmpl_var session.page.title> - <tmpl_var session.setting.companyName></title>
|
||||
<tmpl_var head.tags>
|
||||
'.$style->{styleSheet}.'
|
||||
</head>
|
||||
'.$header.'
|
||||
<tmpl_var body.content>
|
||||
'.$footer.'
|
||||
</html>
|
||||
';
|
||||
WebGUI::SQL->write("insert into template (templateId, name, template, namespace) values (".$newStyleId.",
|
||||
".quote($style->{name}).", ".quote($newStyle).", 'style')");
|
||||
WebGUI::SQL->write("update page set styleId=".$newStyleId." where styleId=".$style->{styleId});
|
||||
WebGUI::SQL->write("update themeComponent set id=".$newStyleId.", type='template' where id=".$style->{styleId}." and type='style'");
|
||||
}
|
||||
$sth->finish;
|
||||
WebGUI::SQL->write("delete from incrementer where incrementerId='styleId'");
|
||||
WebGUI::SQL->write("delete from settings where name='docTypeDec'");
|
||||
WebGUI::SQL->write("drop table style");
|
||||
|
||||
|
||||
#--------------------------------------------
|
||||
print "\tMigrating page templates.\n" unless ($quiet);
|
||||
my $sth = WebGUI::SQL->read("select * from template where namespace='Page'");
|
||||
while (my $template = $sth->hashRef) {
|
||||
#eliminate the need for compatibility with old-style page templates
|
||||
$template->{template} =~ s/\^(\d+)\;/_positionFormat5x($1)/eg;
|
||||
$template->{template} = '
|
||||
<tmpl_if session.var.adminOn>
|
||||
<style>
|
||||
div.wobject:hover {
|
||||
border: 1px outset #cccccc;
|
||||
}
|
||||
</style>
|
||||
</tmpl_if>
|
||||
<tmpl_if session.var.adminOn> <tmpl_if page.canEdit>
|
||||
<tmpl_var page.toolbar>
|
||||
</tmpl_if> </tmpl_if>
|
||||
'.$template->{template};
|
||||
$template->{template} =~ s/\<tmpl_var page\.position(\d+)\>/_positionFormat6x($1)/eg;
|
||||
WebGUI::SQL->write("update template set namespace='page', template=".quote($template->{template})
|
||||
." where templateId=".$template->{templateId}." and namespace='Page'");
|
||||
}
|
||||
$sth->finish;
|
||||
|
||||
#--------------------------------------------
|
||||
#print "\tUpdating config file.\n" unless ($quiet);
|
||||
#my $pathToConfig = '../../etc/'.$configFile;
|
||||
#my $conf = Parse::PlainConfig->new('DELIM' => '=', 'FILE' => $pathToConfig);
|
||||
#my $wobjects = $conf->get("wobjects");
|
||||
#$conf->set("wobjects"=>$wobjects);
|
||||
#$conf->write;
|
||||
|
||||
|
||||
|
||||
#--------------------------------------------
|
||||
print "\tRemoving unneeded files.\n" unless ($quiet);
|
||||
unlink("../../lib/WebGUI/Operation/Style.pm");
|
||||
#unlink("../../lib/WebGUI/Wobject/LinkList.pm");
|
||||
#unlink("../../lib/WebGUI/Wobject/FAQ.pm");
|
||||
|
||||
|
||||
|
||||
|
||||
WebGUI::Session::close();
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _positionFormat5x {
|
||||
return "<tmpl_var page.position".($_[0]+1).">";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _positionFormat6x {
|
||||
my $newPositionCode = '
|
||||
<tmpl_loop position'.$_[0].'_loop>
|
||||
<tmpl_if wobject.canView>
|
||||
<div class="wobject"> <div class="wobject<tmpl_var wobject.namespace>" id="wobjectId<tmpl_var wobject.id>">
|
||||
<tmpl_if session.var.adminOn> <tmpl_if wobject.canEdit>
|
||||
<tmpl_var wobject.toolbar>
|
||||
</tmpl_if> </tmpl_if>
|
||||
<tmpl_if wobject.isInDateRange>
|
||||
<a name="<tmpl_var wobject.id>"></a>
|
||||
<tmpl_var wobject.content>
|
||||
</tmpl_if wobject.isInDateRange>
|
||||
</div> </div>
|
||||
</tmpl_if>
|
||||
</tmpl_loop>
|
||||
';
|
||||
return $newPositionCode;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,2 +1,14 @@
|
|||
insert into webguiVersion values ('6.0.0','upgrade',unix_timestamp());
|
||||
|
||||
delete from international where internationalId=158 and namespace='WebGUI';
|
||||
delete from international where internationalId=803 and namespace='WebGUI';
|
||||
delete from international where internationalId=804 and namespace='WebGUI';
|
||||
delete from international where internationalId=805 and namespace='WebGUI';
|
||||
delete from international where internationalId=814 and namespace='WebGUI';
|
||||
delete from international where internationalId=156 and namespace='WebGUI';
|
||||
delete from international where internationalId=155 and namespace='WebGUI';
|
||||
delete from international where internationalId=380 and namespace='WebGUI';
|
||||
delete from international where internationalId=151 and namespace='WebGUI';
|
||||
delete from international where internationalId=501 and namespace='WebGUI';
|
||||
delete from international where internationalId=154 and namespace='WebGUI';
|
||||
delete from international where internationalId=157 and namespace='WebGUI';
|
||||
delete from style where name='Reserved';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue