package importing fixes
This commit is contained in:
parent
93b5ca16e4
commit
f22646625b
9 changed files with 36 additions and 46 deletions
|
|
@ -35,7 +35,8 @@
|
|||
- fix: Make the Owner in editBranch to be the same as addEdit, allowing
|
||||
any user to be selected (perlDreamer Consulting, LLC.)
|
||||
- Added a simple SMTPD for use in testing (t/smtpd.pl)
|
||||
- importPackage can now skip autocommit functions in the site settings
|
||||
- autocommit for packages is handled by web method, not API method
|
||||
- fix: importing packages generates orphaned duplicates of all attached storage locations
|
||||
|
||||
7.5.0
|
||||
- rfe: Search Asset returns URLs
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ sub addPackage {
|
|||
$storage->addFileFromFilesystem( $file );
|
||||
|
||||
# Import the package into the import node
|
||||
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage, { skipAutoCommit => 1 } );
|
||||
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
|
||||
|
||||
# Make the package not a package anymore
|
||||
$package->update({ isPackage => 0 });
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ sub addPackage {
|
|||
$storage->addFileFromFilesystem( $file );
|
||||
|
||||
# Import the package into the import node
|
||||
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage, { skipAutoCommit => 0 } );
|
||||
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
|
||||
|
||||
# Make the package not a package anymore
|
||||
$package->update({ isPackage => 0 });
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ sub addPackage {
|
|||
$storage->addFileFromFilesystem( $file );
|
||||
|
||||
# Import the package into the import node
|
||||
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage, { skipAutoCommit => 0 } );
|
||||
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
|
||||
|
||||
# Make the package not a package anymore
|
||||
$package->update({ isPackage => 0 });
|
||||
|
|
|
|||
|
|
@ -56,15 +56,13 @@ Override the default method in order to deal with attachments.
|
|||
|
||||
sub addRevision {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
|
||||
if ($self->get("storageId") ne "") {
|
||||
my $newSelf = $self->SUPER::addRevision(@_);
|
||||
|
||||
if ($self->getRevisionCount > 1 && $self->get("storageId")) {
|
||||
my $newStorage = $self->getStorageClass->get($self->session,$self->get("storageId"))->copy;
|
||||
$properties->{storageId} = $newStorage->getId;
|
||||
$newSelf->update({storageId => $newStorage->getId});
|
||||
}
|
||||
|
||||
my $newSelf = $self->SUPER::addRevision($properties, @_);
|
||||
|
||||
|
||||
return $newSelf;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ Override the default method in order to deal with attachments.
|
|||
sub addRevision {
|
||||
my $self = shift;
|
||||
my $newSelf = $self->SUPER::addRevision(@_);
|
||||
if ($self->get("storageId")) {
|
||||
if ($newSelf->getRevisionCount > 1 && $self->get("storageId")) {
|
||||
my $newStorage = WebGUI::Storage->get($self->session,$self->get("storageId"))->copy;
|
||||
$newSelf->update({storageId=>$newStorage->getId});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ Override the default method in order to deal with attachments.
|
|||
sub addRevision {
|
||||
my $self = shift;
|
||||
my $newSelf = $self->SUPER::addRevision(@_);
|
||||
if ($self->get("storageId")) {
|
||||
if ($newSelf->getRevisionCount > 1 && $self->get("storageId")) {
|
||||
my $newStorage = WebGUI::Storage->get($self->session,$self->get("storageId"))->copy;
|
||||
$newSelf->update({storageId=>$newStorage->getId});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,13 +46,15 @@ Override the default method in order to deal with attachments.
|
|||
sub addRevision {
|
||||
my $self = shift;
|
||||
my $newSelf = $self->SUPER::addRevision(@_);
|
||||
foreach my $field (qw(image1 image2 image3 brochure manual warranty)) {
|
||||
if ($self->get($field)) {
|
||||
my $newStorage = WebGUI::Storage->get($self->session,$self->get($field))->copy;
|
||||
$newSelf->update({$field=>$newStorage->getId});
|
||||
}
|
||||
}
|
||||
return $newSelf;
|
||||
if ($newSelf->getRevisionCount > 1) {
|
||||
foreach my $field (qw(image1 image2 image3 brochure manual warranty)) {
|
||||
if ($self->get($field)) {
|
||||
my $newStorage = WebGUI::Storage->get($self->session,$self->get($field))->copy;
|
||||
$newSelf->update({$field=>$newStorage->getId});
|
||||
}
|
||||
}
|
||||
}
|
||||
return $newSelf;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -116,13 +116,9 @@ sub getPackageList {
|
|||
|
||||
=head2 importAssetData ( hashRef )
|
||||
|
||||
Imports the data exported by the exportAssetData method. If the asset
|
||||
already exists, a new revision will be created with these properties. If it
|
||||
doesn't exist then a child will be added to the current asset.
|
||||
Imports the data exported by the exportAssetData method. If the asset already exists, a new revision will be created with these properties. If it doesn't exist then a child will be added to the current asset. Returns a reference to the created asset.
|
||||
|
||||
Returns a reference to the created asset.
|
||||
|
||||
=head3 assetData
|
||||
=head3 hashRef
|
||||
|
||||
A hash reference containing the exported data.
|
||||
|
||||
|
|
@ -191,7 +187,7 @@ sub importAssetCollateralData {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 importPackage ( storageLocation [, options] )
|
||||
=head2 importPackage ( storageLocation )
|
||||
|
||||
Imports the data from a webgui package file.
|
||||
|
||||
|
|
@ -199,19 +195,11 @@ Imports the data from a webgui package file.
|
|||
|
||||
A reference to a WebGUI::Storage object that contains a webgui package file.
|
||||
|
||||
=head3 options
|
||||
|
||||
An optional hashref of options with the following possible keys:
|
||||
|
||||
skipAutoCommit : If true, will skip any automatic commit in
|
||||
the site's settings.
|
||||
|
||||
=cut
|
||||
|
||||
sub importPackage {
|
||||
my $self = shift;
|
||||
my $storage = shift;
|
||||
my $options = shift;
|
||||
my $decompressed = $storage->untar($storage->getFiles->[0]);
|
||||
my %assets = (); # All the assets we've imported
|
||||
my $package = undef; # The asset package
|
||||
|
|
@ -243,16 +231,6 @@ sub importPackage {
|
|||
}
|
||||
}
|
||||
|
||||
# Handle autocommit workflows
|
||||
if (!$options->{skipAutoCommit} && $self->session->setting->get("autoRequestCommit")) {
|
||||
if ($self->session->setting->get("skipCommitComments")) {
|
||||
WebGUI::VersionTag->getWorking($self->session)->requestCommit;
|
||||
}
|
||||
else {
|
||||
$self->session->http->setRedirect($self->getUrl("op=commitVersionTag;tagId=".WebGUI::VersionTag->getWorking($self->session)->getId));
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
|
@ -329,7 +307,18 @@ sub www_importPackage {
|
|||
my $i18n = WebGUI::International->new($self->session, "Asset");
|
||||
return $self->session->style->userStyle($i18n->get("package corrupt"));
|
||||
}
|
||||
return $self->www_manageAssets();
|
||||
# Handle autocommit workflows
|
||||
if ($self->session->setting->get("autoRequestCommit")) {
|
||||
if ($self->session->setting->get("skipCommitComments")) {
|
||||
WebGUI::VersionTag->getWorking($self->session)->requestCommit;
|
||||
}
|
||||
else {
|
||||
$self->session->http->setRedirect($self->getUrl("op=commitVersionTag;tagId=".WebGUI::VersionTag->getWorking($self->session)->getId));
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
return $self->www_manageAssets();
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue