Fix dotted assetIds in the database for the WebGUI 7 Style snippets, navigations,

folder and Image assets.
This commit is contained in:
Colin Kuskie 2009-02-03 23:42:59 +00:00
parent 3433c7c332
commit a8f3d2ea30
2 changed files with 25 additions and 0 deletions

View file

@ -13,6 +13,7 @@
- fixed: Many child assets, including WikiPage, Post and Event, will no longer let you add or paste them in places where they do not belong.
- fixed: Hardcoded extras url in templates and in extra head tags in assets were replaced with the Extras macro.
- fixed: Fixed bad gateway macros in the Matrix templates.
- fixed #9535: Bad characters in dom element ids when generated from assetId
- fixed #9542: Default WebGUI config contains invalid workflow activity
7.6.10

View file

@ -35,6 +35,7 @@ removeBrokenWorkflowInstances($session);
undotBinaryExtensions($session);
removeProcessRecurringPaymentsFromConfig($session);
fixDottedAssetIds($session); ##This one should run last
finish($session); # this line required
@ -81,6 +82,29 @@ sub undotBinaryExtensions {
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub fixDottedAssetIds {
my $session = shift;
print "\tRemoving dots from Asset IDs... " unless $quiet;
my @assetIds = $session->db->buildArray("select distinct(assetId) from asset where assetId like '%.%'");
my %assetIds = map { my $id = $_; $id =~ tr/./-/; $_ => $id } @assetIds;
# and here's our code
while (my ($fromId, $toId) = each %assetIds) {
$session->db->write('UPDATE `assetData` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
$session->db->write('UPDATE `asset` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
$session->db->write('UPDATE `assetIndex` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
$session->db->write('UPDATE `wobject` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
$session->db->write('UPDATE `Folder` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
$session->db->write('UPDATE `Navigation` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
$session->db->write('UPDATE `FileAsset` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
$session->db->write('UPDATE `ImageAsset` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
$session->db->write('UPDATE `snippet` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
$session->db->write('UPDATE `asset` SET `parentId`=? WHERE `parentId`=?', [$toId, $fromId]);
}
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub removeBrokenWorkflowInstances {
my $session = shift;