From 8c4785b165c25f52e8c9f17f0e7e0e3e5e170398 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 16 Nov 2010 18:39:37 -0800 Subject: [PATCH] Don't call setParent if the asset is still broken. Alert user if the asset is still broken. Fixes bug #11957. --- docs/changelog/7.x.x.txt | 1 + sbin/findBrokenAssets.pl | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 05330dd94..8bfb7f874 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -8,6 +8,7 @@ - fixed #11965: FriendManager pagination and getUsersNotIn - fixed #11964: files show in trash and in old revisions - fixed #11954: Can't clear packed head tags + - fixed #11957: finBrokenAsset --fix does not fix per se 7.10.4 - Added WebGUI::Fork api diff --git a/sbin/findBrokenAssets.pl b/sbin/findBrokenAssets.pl index 9ecaaab32..048f00c2e 100644 --- a/sbin/findBrokenAssets.pl +++ b/sbin/findBrokenAssets.pl @@ -103,12 +103,15 @@ while ( my %row = $sth->hash ) { } print "Fixed.\n"; + my $asset = WebGUI::Asset->newByDynamicClass( $session, $row{assetId} ); # Make sure we have a valid parent - unless ( WebGUI::Asset->newByDynamicClass( $session, $row{parentId} ) ) { - my $asset = WebGUI::Asset->newByDynamicClass( $session, $row{assetId} ); + unless ( $asset && WebGUI::Asset->newByDynamicClass( $session, $row{parentId} ) ) { $asset->setParent( WebGUI::Asset->getImportNode( $session ) ); print "\tNOTE: Invalid parent. Asset moved to Import Node\n"; } + if (!$asset) { + print "\tWARNING. Asset is still broken.\n"; + } } ## end if ($fix) elsif ($delete) {