diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 1280b7576..cf98860b6 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -6,6 +6,8 @@ - Converted site maps to navigation assets. - Converted file managers to layout assets with file and image assets attached. + - Added a new upgrade mechanism that will display a maintenence message + during upgrades. No need to set up anything special for this any longer. - Added AssetProxy macro, which replaces the Navigation, I, Snippet, and File macros. - Added Folder asset type. diff --git a/docs/gotcha.txt b/docs/gotcha.txt index 7b45f9a25..3d8dd793b 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -9,6 +9,13 @@ save you many hours of grief. 6.3.0 -------------------------------------------------------------------- + * This upgrade process will run for a very long time and output a + lot of debug information which will be useful if something + goes wrong. You may wish to pipe the debug info to a log + file like this: + + perl upgrade.pl --yourcommandlineoptions > /tmp/upgrade.log + * If you're using languages other than English, you'll need to get new versions of those language files before upgrading. The language file format has a new requirement. Also, the diff --git a/docs/maintenance.html b/docs/maintenance.html new file mode 100644 index 000000000..d626843c9 --- /dev/null +++ b/docs/maintenance.html @@ -0,0 +1,13 @@ + + +
++ This site is currently undergoing maintenance. Please check back again shortly. +
+ + diff --git a/docs/upgrades/upgrade_6.2.11-6.3.0.pl b/docs/upgrades/upgrade_6.2.11-6.3.0.pl index 4c2a60dd7..0de3ca4ed 100644 --- a/docs/upgrades/upgrade_6.2.11-6.3.0.pl +++ b/docs/upgrades/upgrade_6.2.11-6.3.0.pl @@ -171,17 +171,6 @@ walkTree('0','PBasset000000000000001','000001','2'); mapProductCollateral(); print "\t\tMaking second round of table structure changes\n" unless ($quiet); -foreach my $namespace (@allWobjects) { - if (isIn($namespace, @wobjects)) { - WebGUI::SQL->write("alter table ".$namespace." drop column wobjectId"); - WebGUI::SQL->write("alter table ".$namespace." add primary key (assetId)"); - } elsif (isIn($namespace, qw(Navigation Layout))) { - # do nothing - } else { - WebGUI::SQL->write("alter table ".$namespace." drop primary key"); - WebGUI::SQL->write("alter table ".$namespace." add primary key (assetId)"); - } -} WebGUI::SQL->write("alter table WobjectProxy add column shortcutToAssetId varchar(22) not null"); my $sth = WebGUI::SQL->read("select proxiedWobjectId from WobjectProxy"); while (my ($wobjectId) = $sth->array) { @@ -189,6 +178,21 @@ while (my ($wobjectId) = $sth->array) { WebGUI::SQL->write("update WobjectProxy set shortcutToAssetId=".quote($assetId)." where wobjectId=".quote($wobjectId)); } $sth->finish; +foreach my $namespace (@allWobjects) { + if (isIn($namespace, qw(SiteMap USS FileManager))) { + # do nothing because these are going away + } elsif (isIn($namespace, @wobjects)) { + WebGUI::SQL->write("delete from ".$namespace." where assetId is null or assetId = ''"); # protect ourselves from crap + WebGUI::SQL->write("alter table ".$namespace." drop column wobjectId"); + WebGUI::SQL->write("alter table ".$namespace." add primary key (assetId)"); + } elsif (isIn($namespace, qw(Navigation Layout Collaboration Folder))) { + # do nothing because these are new + } else { + WebGUI::SQL->write("delete from ".$namespace." where assetId is null or assetId = ''"); # protect ourselves from crap + WebGUI::SQL->write("alter table ".$namespace." drop primary key"); + WebGUI::SQL->write("alter table ".$namespace." add primary key (assetId)"); + } +} WebGUI::SQL->write("alter table WobjectProxy drop proxiedWobjectId"); WebGUI::SQL->write("alter table WobjectProxy change proxiedTemplateId overrideTemplateId varchar(22) not null"); WebGUI::SQL->write("alter table WobjectProxy change proxyByCriteria shortcutByCriteria int not null"); @@ -1598,12 +1602,12 @@ sub walkTree { WebGUI::SQL->write("update wobject set namespace='Collaboration' where wobjectId=".quote($wobject->{wobjectId})); print "\t\t\tMigrating submissions for USS ".$wobject->{wobjectId}."\n" unless ($quiet); my $ussId = $namespace->{USS_id}; - my $sth = WebGUI::SQL->read("select * from USS_submission where USS_id=".quote($ussId)); my $usssubrank = 1; my $collabReplyCounter; my $collabViewCounter; my $collabThreadCounter; my %oldestForumPost; + my $sth = WebGUI::SQL->read("select * from USS_submission where USS_id=".quote($ussId)); while (my $submission = $sth->hashRef) { $collabThreadCounter++; $collabViewCounter += $submission->{views}; @@ -1662,9 +1666,9 @@ sub walkTree { subscriptionGroupId=>$threadSubscriptionGroup->groupId }, undef, $id); my %oldestThreadPost; - my $posts = WebGUI::SQL->read("select forumPost.* from forumPost left join forumThread on forumPost.forumThreadId=forumThread.forumThreadId where forumId=".quote($submission->{forumId})); my $postRank = 1; my $threadReplyCounter; + my $posts = WebGUI::SQL->read("select forumPost.* from forumPost left join forumThread on forumPost.forumThreadId=forumThread.forumThreadId where forumId=".quote($submission->{forumId})); while (my $post = $posts->hashRef) { $collabViewCounter += $post->{views}; $threadReplyCounter++; @@ -1738,6 +1742,7 @@ sub walkTree { WebGUI::SQL->write("update WobjectProxy set description=".quote($wobject->{description})." where assetId=".quote($wobjectId)); } elsif ($wobject->{namespace} eq "MessageBoard") { + print "\t\t\tMigrating Message Board forums\n" unless ($quiet); my $forums = WebGUI::SQL->read("select forumId, title, description from MessageBoard_forums where wobjectId=".quote($wobject->{wobjectId})." order by sequenceNumber"); my $i = 1; while (my ($fid, $title, $desc) = $forums->array) { @@ -1921,9 +1926,14 @@ sub migrateForum { my $ratingprep = WebGUI::SQL->prepare("insert into Post_rating (assetId, userId, ipAddress, dateOfRating, rating) values (?,?,?,?,?)"); print "\t\t\t\t\t Migrating threads for forum $originalId\n"; my $threads = WebGUI::SQL->read("select * from forumThread left join forumPost on forumThread.rootPostId=forumPost.forumPostId where - forumThread.forumId=".quote($originalId)); + forumThread.forumId=".quote($originalId)." and forumPost.status<>'deleted'"); my $threadRank = 1; - while (my ($thread) = $threads->hashRef) { + if ($threads->errorCode>0) { + print "\t\t\t\tWARNING: There was a problem migrating the threads for $originalId\n"; + return; + } + while (($threads->errorCode < 1) && (my ($thread) = $threads->hashRef)) { + next if ($thread->{forumThreadId} eq ""); print "\t\t\t\t\t\t Migrating thread ".$thread->{forumThreadId}."\n"; my $threadLineage = $lineage.sprintf("%06d",$threadRank); my $threadId = WebGUI::SQL->setRow("asset","assetId",{ @@ -1979,9 +1989,14 @@ sub migrateForum { # we're going to give up hierarchy during the upgrade for the sake of simplicity print "\t\t\t\t\t\t Migrating posts for thread ".$thread->{forumThreadId}."\n"; my %oldestThreadPost; - my $posts = WebGUI::SQL->read("select * from forumPost where forumThreadId=".quote($thread->{forumThreadId})." and parentId<>''"); + my $posts = WebGUI::SQL->read("select * from forumPost where forumThreadId=".quote($thread->{forumThreadId})." and parentId<>'' and forumPost.status<>'deleted'"); my $postRank = 1; + if ($posts->errorCode>0) { + print "\t\t\t\tWARNING: There was a problem migrating the posts for ".$thread->{forumThreadId}."\n"; + next; + } while (my $post = $posts->hashRef) { + next if ($thread->{forumPostId} eq ""); print "\t\t\t\t\t\t\t Migrating post ".$post->{forumPostId}."\n"; my $postId = WebGUI::SQL->setRow("asset","assetId",{ assetId=>"new", @@ -2026,6 +2041,7 @@ sub migrateForum { $postRank++; } $posts->finish; + print "\t\t\t\t\t\t\t Setting oldest post for thread ".$thread->{forumThreadId}."\n"; WebGUI::SQL->setRow("Thread","assetId",{ assetId=>$threadId, lastPostId=>$oldestThreadPost{id}, @@ -2037,8 +2053,10 @@ sub migrateForum { } $threadRank++; } + print "\t\t\t\t WARNING: Couldn't finish processing threads for $originalId because something nasty occured in the database." if ($threads->errorCode > 0); $threads->finish; $ratingprep->finish; + print "\t\t\t\t\t\t Setting oldest post for forum ".$originalId."\n"; WebGUI::SQL->setRow("Collaboration","assetId",{ assetId=>$newId, lastPostId=>$oldestForumPost{id}, @@ -2049,6 +2067,9 @@ sub migrateForum { sub fixUrl { my $id = shift; my $url = shift; + if (length($url) > 250) { + $url = substr($url,220); + } $url = WebGUI::Id::generate() unless (defined $url); $url = WebGUI::URL::urlize($url); my ($test) = WebGUI::SQL->quickArray("select url from asset where assetId<>".quote($id)." and url=".quote($url)); diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm index eb8790998..5589ad0cc 100644 --- a/lib/WebGUI.pm +++ b/lib/WebGUI.pm @@ -53,6 +53,20 @@ sub _processOperations { return $output; } +#------------------------------------------------------------------- +sub _upgrading { + my $webguiRoot = shift; + my $output = WebGUI::HTTP::getHeader(); + open(FILE,"<".$webguiRoot."/docs/maintenance.html"); + while (