fix: 7.2.3-7.3.0 upgrade now migrates EC and Events in the Trash and Clipboard

This commit is contained in:
Doug Bell 2007-01-26 00:18:36 +00:00
parent bd7ef8d14e
commit 6e06db64a2
4 changed files with 72 additions and 2 deletions

View file

@ -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.

View file

@ -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

View file

@ -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";

View file

@ -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 ----