unset package flag recursively during upgrades
This commit is contained in:
parent
8a412312d3
commit
2f4d9079f0
1 changed files with 7 additions and 9 deletions
|
|
@ -60,21 +60,19 @@ sub addPackage {
|
||||||
# Import the package into the import node
|
# Import the package into the import node
|
||||||
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
|
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
|
||||||
|
|
||||||
# Make the package not a package anymore
|
# Turn off the package flag, and set the default flag for templates added
|
||||||
$package->update({ isPackage => 0 });
|
my $assetIds = $package->getLineage( ['self','descendants'] );
|
||||||
|
|
||||||
# Set the default flag for templates added
|
|
||||||
my $assetIds
|
|
||||||
= $package->getLineage( ['self','descendants'], {
|
|
||||||
includeOnlyClasses => [ 'WebGUI::Asset::Template' ],
|
|
||||||
} );
|
|
||||||
for my $assetId ( @{ $assetIds } ) {
|
for my $assetId ( @{ $assetIds } ) {
|
||||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
|
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
|
||||||
if ( !$asset ) {
|
if ( !$asset ) {
|
||||||
print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n";
|
print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
$asset->update( { isDefault => 1 } );
|
my $properties = { isPackage => 0 };
|
||||||
|
if ($asset->isa('WebGUI::Asset::Template')) {
|
||||||
|
$properties->{isDefault} = 1;
|
||||||
|
}
|
||||||
|
$asset->update( $properties );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue