Migrate calendars seems to work. Uncomment appropriate lines in upgrade_7.2.3-7.3.0.pl to test. If you get it working, commit the uncommented lines please.
This commit is contained in:
parent
5b29b0dfcb
commit
8da3e259a0
1 changed files with 13 additions and 16 deletions
|
|
@ -226,35 +226,32 @@ sub migrateCalendars {
|
||||||
{
|
{
|
||||||
my $properties = {%{$asset->get}};
|
my $properties = {%{$asset->get}};
|
||||||
$properties->{defaultDate} = delete $properties->{defaultMonth};
|
$properties->{defaultDate} = delete $properties->{defaultMonth};
|
||||||
warn "Found calendar ".$properties->{title};
|
#warn "Found calendar ".$properties->{title};
|
||||||
$properties->{className} = "WebGUI::Asset::Wobject::Calendar";
|
$properties->{className} = "WebGUI::Asset::Wobject::Calendar";
|
||||||
|
|
||||||
|
|
||||||
# Add the new asset
|
# Add the new asset
|
||||||
my $newAsset = $asset->getParent->addChild($properties);
|
my $newAsset = $asset->getParent->addChild($properties);
|
||||||
warn "Added Calendar ".$newAsset->get("title")." ".$newAsset->get("className");
|
#warn "Added Calendar ".$newAsset->get("title")." ".$newAsset->get("className");
|
||||||
|
|
||||||
# Get this calendar's events and change to new parent
|
# Get this calendar's events and change to new parent
|
||||||
my $events = $asset->getLineage(['descendants'],
|
my $events = $asset->getLineage(['descendants'],
|
||||||
{
|
{
|
||||||
includeOnlyClasses => ['WebGUI::Asset::Event'],
|
includeOnlyClasses => ['WebGUI::Asset::Event'],
|
||||||
});
|
});
|
||||||
warn "Got lineage";
|
#warn "Got lineage";
|
||||||
|
|
||||||
|
|
||||||
# Set the new asset's rank
|
|
||||||
$newAsset->swapRank($asset->getRank);
|
|
||||||
warn "Swapped rank";
|
|
||||||
|
|
||||||
|
|
||||||
for my $event (@{$events})
|
for my $event (@{$events})
|
||||||
{
|
{
|
||||||
warn "Got event: $event";
|
#warn "Got event: $event";
|
||||||
|
|
||||||
# Add a child to the new calendar using the properties
|
# Add a child to the new calendar using the properties
|
||||||
# from EventsCalendar_event
|
# from EventsCalendar_event
|
||||||
my %eventProperties = $session->db->quickHash("select * from asset left join assetData on asset.assetId=assetData.assetId left join EventsCalendar_event on asset.assetId = EventsCalendar_event.assetId where asset.assetId = ?",[$event]);
|
my %eventProperties = $session->db->quickHash("select * from asset left join assetData on asset.assetId=assetData.assetId left join EventsCalendar_event on asset.assetId = EventsCalendar_event.assetId where asset.assetId = ?",[$event]);
|
||||||
|
|
||||||
|
delete $eventProperties{assetId};
|
||||||
|
|
||||||
my ($startDate, $startTime) = split / /, WebGUI::DateTime->new(delete $eventProperties{eventStartDate})->toMysql;
|
my ($startDate, $startTime) = split / /, WebGUI::DateTime->new(delete $eventProperties{eventStartDate})->toMysql;
|
||||||
my ($endDate, $endTime) = split / /, WebGUI::DateTime->new(delete $eventProperties{eventEndDate})->toMysql;
|
my ($endDate, $endTime) = split / /, WebGUI::DateTime->new(delete $eventProperties{eventEndDate})->toMysql;
|
||||||
|
|
||||||
|
|
@ -268,18 +265,18 @@ sub migrateCalendars {
|
||||||
$newAsset->addChild(\%eventProperties);
|
$newAsset->addChild(\%eventProperties);
|
||||||
|
|
||||||
# Remove this event from the old calendar
|
# Remove this event from the old calendar
|
||||||
#$session->db->write("delete from EventsCalendar_event where assetId=?",[$event]);
|
$session->db->write("delete from EventsCalendar_event where assetId=?",[$event]);
|
||||||
#$session->db->write("delete from asset where assetId=?",[$event]);
|
$session->db->write("delete from asset where assetId=?",[$event]);
|
||||||
#$session->db->write("delete from assetData where assetId=?",[$event]);
|
$session->db->write("delete from assetData where assetId=?",[$event]);
|
||||||
#$session->db->write("delete from assetIndex where assetId=?",[$event]);
|
$session->db->write("delete from assetIndex where assetId=?",[$event]);
|
||||||
#$session->db->write("delete from assetHistory where assetId=?",[$event]);
|
$session->db->write("delete from assetHistory where assetId=?",[$event]);
|
||||||
}
|
}
|
||||||
warn "Set parents on events";
|
#warn "Set parents on events";
|
||||||
|
|
||||||
|
|
||||||
# Remove the old asset
|
# Remove the old asset
|
||||||
$asset->purge;
|
$asset->purge;
|
||||||
warn "Purged old calendar";
|
#warn "Purged old calendar";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue