diff --git a/docs/gotcha.txt b/docs/gotcha.txt
index 34e4bdae6..5008ce3ea 100644
--- a/docs/gotcha.txt
+++ b/docs/gotcha.txt
@@ -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
diff --git a/docs/temp.sql b/docs/temp.sql
new file mode 100644
index 000000000..8c28f0b77
--- /dev/null
+++ b/docs/temp.sql
@@ -0,0 +1,3 @@
+# add this stuff to previousVersion.sql just before 6.0 release
+
+delete from style where styleId < 0;
diff --git a/docs/upgrades/upgrade_5.5.3-6.0.0.pl b/docs/upgrades/upgrade_5.5.3-6.0.0.pl
new file mode 100644
index 000000000..144ccf736
--- /dev/null
+++ b/docs/upgrades/upgrade_5.5.3-6.0.0.pl
@@ -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}.'
+
+
+ -
+
+ '.$style->{styleSheet}.'
+
+ '.$header.'
+
+ '.$footer.'
+
+ ';
+ 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} = '
+
+
+
+
+
+
+ '.$template->{template};
+ $template->{template} =~ s/\/_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 "";
+}
+
+#-------------------------------------------------------------------
+sub _positionFormat6x {
+ my $newPositionCode = '
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ';
+ return $newPositionCode;
+}
+
+
diff --git a/docs/upgrades/upgrade_5.5.3-6.0.0.sql b/docs/upgrades/upgrade_5.5.3-6.0.0.sql
index de054314e..5654ead1a 100644
--- a/docs/upgrades/upgrade_5.5.3-6.0.0.sql
+++ b/docs/upgrades/upgrade_5.5.3-6.0.0.sql
@@ -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';
diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm
index 8393b0436..61ef58b82 100644
--- a/lib/WebGUI.pm
+++ b/lib/WebGUI.pm
@@ -16,7 +16,6 @@ use Tie::CPHash;
use WebGUI::Affiliate;
use WebGUI::Cache;
use WebGUI::ErrorHandler;
-use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Macro;
use WebGUI::Operation;
@@ -25,110 +24,28 @@ use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::Style;
use WebGUI::Page;
-use WebGUI::Template;
use WebGUI::URL;
-use WebGUI::Utility;
-#-------------------------------------------------------------------
-sub _generateDebug {
- if ($session{setting}{showDebug} || ($session{form}{debug}==1 && WebGUI::Privilege::isInGroup(3))) {
- return WebGUI::ErrorHandler::showDebug();
- }
- return "";
-}
-
#-------------------------------------------------------------------
sub _generatePage {
- my ($canEdit, $pageEdit, $sth, $wobject, %contentHash, $originalWobject, $sql, $extra, %hash, $cmd, $w, $template,$canEditWobject);
- if (WebGUI::Privilege::canViewPage()) {
- if ($session{var}{adminOn}) {
- $canEdit = WebGUI::Privilege::canEditPage();
- if ($canEdit) {
- $pageEdit = "\n "
- .pageIcon()
- .deleteIcon('op=deletePage')
- .editIcon('op=editPage')
- .moveUpIcon('op=movePageUp')
- .moveDownIcon('op=movePageDown')
- .cutIcon('op=cutPage')
- ."\n";
- }
- }
- $sth = WebGUI::SQL->read("select * from wobject where pageId=$session{page}{pageId}
- order by sequenceNumber, wobjectId");
- while ($wobject = $sth->hashRef) {
- $canEditWobject = WebGUI::Privilege::canEditWobject($wobject->{wobjectId});
- if ($session{var}{adminOn} && $canEditWobject) {
- $contentHash{"page.position".${$wobject}{templatePosition}} .= "\n"
- .wobjectIcon()
- .deleteIcon('func=delete&wid='.${$wobject}{wobjectId})
- .editIcon('func=edit&wid='.${$wobject}{wobjectId})
- .moveUpIcon('func=moveUp&wid='.${$wobject}{wobjectId})
- .moveDownIcon('func=moveDown&wid='.${$wobject}{wobjectId})
- .moveTopIcon('func=moveTop&wid='.${$wobject}{wobjectId})
- .moveBottomIcon('func=moveBottom&wid='.${$wobject}{wobjectId})
- .cutIcon('func=cut&wid='.${$wobject}{wobjectId})
- .copyIcon('func=copy&wid='.${$wobject}{wobjectId});
- if (${$wobject}{namespace} ne "WobjectProxy" && isIn("WobjectProxy",@{$session{config}{wobjects}})) {
- $contentHash{"page.position".${$wobject}{templatePosition}} .=
- shortcutIcon('func=createShortcut&wid='.${$wobject}{wobjectId})
- }
- $contentHash{"page.position".${$wobject}{templatePosition}} .= ' ';
- }
-
- if(!WebGUI::Privilege::canViewWobject($wobject->{wobjectId})){ next; }
- if (${$wobject}{namespace} eq "WobjectProxy") {
- $originalWobject = $wobject;
- my ($wobjectProxy) = WebGUI::SQL->quickHashRef("select * from WobjectProxy where wobjectId=".${$wobject}{wobjectId});
- $wobject = WebGUI::SQL->quickHashRef("select * from wobject where wobject.wobjectId=".$wobjectProxy->{proxiedWobjectId});
- if (${$wobject}{namespace} eq "") {
- $wobject = $originalWobject;
- } else {
- ${$wobject}{startDate} = ${$originalWobject}{startDate};
- ${$wobject}{endDate} = ${$originalWobject}{endDate};
- ${$wobject}{templatePosition} = ${$originalWobject}{templatePosition};
- ${$wobject}{_WobjectProxy} = ${$originalWobject}{wobjectId};
- if ($wobjectProxy->{overrideTitle}) {
- ${$wobject}{title} = ${$originalWobject}{title};
- }
- if ($wobjectProxy->{overrideDisplayTitle}) {
- ${$wobject}{displayTitle} = ${$originalWobject}{displayTitle};
- }
- if ($wobjectProxy->{overrideDescription}) {
- ${$wobject}{description} = ${$originalWobject}{description};
- }
- if ($wobjectProxy->{overrideTemplate}) {
- ${$wobject}{templateId} = $wobjectProxy->{proxiedTemplateId};
- }
- }
- }
- $extra = WebGUI::SQL->quickHashRef("select * from ".$wobject->{namespace}."
- where wobjectId=".$wobject->{wobjectId});
- tie %hash, 'Tie::CPHash';
- %hash = (%{$wobject},%{$extra});
- $wobject = \%hash;
- $cmd = "WebGUI::Wobject::".${$wobject}{namespace};
- $w = eval{$cmd->new($wobject)};
- WebGUI::ErrorHandler::fatalError("Couldn't instanciate wobject: ${$wobject}{namespace}. Root cause: ".$@) if($@);
- if ($w->inDateRange) {
- $contentHash{"page.position".${$wobject}{templatePosition}} .= '