eliminated the purgeBranch method, cuz purge() should always do that anyway.

This commit is contained in:
JT Smith 2006-02-15 04:31:29 +00:00
parent a4578d1d7d
commit 18e24618e7
4 changed files with 8 additions and 22 deletions

View file

@ -67,24 +67,6 @@ sub duplicateBranch {
}
#-------------------------------------------------------------------
=head2 purgeBranch ( )
Returns 1. Purges self and all descendants.
=cut
sub purgeBranch {
my $self = shift;
my $descendants = $self->getLineage(["self","descendants"],{returnObjects=>1, invertTree=>1, statesToInclude=>['published', 'clipboard', 'clipboard-limbo','trash','trash-limbo']});
foreach my $descendant (@{$descendants}) {
$descendant->purge;
}
return 1;
}
#-------------------------------------------------------------------
=head2 www_editBranch ( )

View file

@ -90,13 +90,17 @@ sub getAssetsInTrash {
=head2 purge ( )
Deletes an asset from tables and removes anything bound to that asset.
Deletes an asset from tables and removes anything bound to that asset, including descendants.
=cut
sub purge {
my $self = shift;
return undef if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage"));
return undef if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage") || $self->get("isSystem");
my $kids = $self->getLineage(["children"],{returnObjects=>1, statesToInclude=>['published', 'clipboard', 'clipboard-limbo','trash','trash-limbo']});
foreach my $kid (@{$kids}) {
$kid->purge;
}
$self->session->db->beginTransaction;
foreach my $definition (@{$self->definition($self->session)}) {
$self->session->db->write("delete from ".$definition->{tableName}." where assetId=".$self->session->db->quote($self->getId));

View file

@ -210,7 +210,7 @@ sub purgeRevision {
$self->purgeCache;
$self->updateHistory("purged revision ".$self->get("revisionDate"));
} else {
$self->purgeBranch;
$self->purge;
}
}