diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 447bc6140..128da0054 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -2,6 +2,10 @@ - Fixed a template variable rewriting problem with HTML::Template::Expr - Added a attachment_thumbnail option to the CS RSS feed. - No Reports In/Out Board (perlDreamer Consulting, LLC) + - fix: The 7.2.3-7.3.0 upgrade will no longer orphan EventsCalendars + and Events on the clipboard. + - fix: The upgrade script will remove any orphaned EventsCalendars and + Events. 7.3.7 - Fixed a template variable rewriting problem with Template Toolkit. diff --git a/docs/gotcha.txt b/docs/gotcha.txt index 132ac8872..1406429a8 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -7,6 +7,18 @@ 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. +7.3.8 +-------------------------------------------------------------------- + * For those who upgraded to 7.3.7, any EventsCalendars (with their + attached events) in the trash or on the clipboard during the + 7.2.3 - 7.3.0 upgrade were NOT migrated. This version will delete + those from the database, since it is not possible to recover them + based on their current state. + + Those who are upgrading from 7.2.3 - 7.3.8 will not lose any + data. + + 7.3.7 -------------------------------------------------------------------- * For those who performed a multiple site upgrade from 7.2.3 to diff --git a/docs/upgrades/upgrade_7.2.3-7.3.0.pl b/docs/upgrades/upgrade_7.2.3-7.3.0.pl index 213cda892..931fa5868 100644 --- a/docs/upgrades/upgrade_7.2.3-7.3.0.pl +++ b/docs/upgrades/upgrade_7.2.3-7.3.0.pl @@ -214,6 +214,8 @@ sub migrateCalendars { #EventsCalendar.defaultMonth = Calendar.defaultDate my $calendars = WebGUI::Asset->getRoot($session)->getLineage(['descendents'], { + statesToInclude => ['published','trash','clipboard','clipboard-limbo','trash-limbo'], + statusToInclude => ['pending','approved','deleted','archived'], includeOnlyClasses => ['WebGUI::Asset::Wobject::EventsCalendar'], returnObjects => 1, }); @@ -226,14 +228,21 @@ sub migrateCalendars { #warn "Found calendar ".$properties->{title}; $properties->{className} = "WebGUI::Asset::Wobject::Calendar"; - + use Data::Dumper; + warn Dumper $properties; + # Add the new asset my $newAsset = $asset->getParent->addChild($properties); #warn "Added Calendar ".$newAsset->get("title")." ".$newAsset->get("className"); - + + warn Dumper $asset->get; + warn "\n\n\n\n\n\n\n\n"; + # Get this calendar's events and change to new parent my $events = $asset->getLineage(['descendants'], { + statesToInclude => ['published','trash','clipboard','clipboard-limbo','trash-limbo'], + statusToInclude => ['pending','approved','deleted','archived'], includeOnlyClasses => ['WebGUI::Asset::Event'], }); #warn "Got lineage"; diff --git a/docs/upgrades/upgrade_7.3.7-7.3.8.pl b/docs/upgrades/upgrade_7.3.7-7.3.8.pl index c14c1076c..b22f9d451 100644 --- a/docs/upgrades/upgrade_7.3.7-7.3.8.pl +++ b/docs/upgrades/upgrade_7.3.7-7.3.8.pl @@ -21,6 +21,8 @@ my $quiet; # this line required my $session = start(); # this line required # upgrade functions go here +removeOrphanedEventsCalendars($session); +removeOrphanedEvents($session); finish($session); # this line required @@ -32,6 +34,49 @@ finish($session); # this line required # # and here's our code #} +##------------------------------------------------- +sub removeOrphanedEventsCalendars { + my $session = shift; + print "\tRemoving orphaned Events Calendars... "; + + # Remove Events Calendars from asset, assetData, assetIndex, wobject + my @assetIds + = $session->db->buildArray( + qq{select assetId from asset where className="WebGUI::Asset::Wobject::EventsCalendar"} + ); + + for my $assetId (@assetIds) { + for my $table (qw( assetData assetIndex wobject asset )) { + $session->db->write("delete from $table where assetId=?",[$assetId]); + } + } + + print "OK!\n"; +} + + + +##------------------------------------------------- +sub removeOrphanedEvents { + my $session = shift; + print "\tRemoving orphaned Events... "; + + # Remove Events from asset, assetData, assetIndex that do not exist in the Event table + my @assetIds + = $session->db->buildArray( + qq{select assetId from asset where className="WebGUI::Asset::Event" } + . qq{and assetId NOT IN (select assetId from Event)} + ); + + for my $assetId (@assetIds) { + for my $table (qw( assetData assetIndex asset )) { + $session->db->write("delete from $table where assetId=?",[$assetId]); + } + } + + + print "OK!\n"; +} # ---- DO NOT EDIT BELOW THIS LINE ----