fixed an inefficiency in pasting

This commit is contained in:
JT Smith 2005-03-24 21:53:00 +00:00
parent 076a9e2704
commit ca1cf60d47
2 changed files with 15 additions and 11 deletions

View file

@ -1,5 +1,7 @@
6.5.5 6.5.5
- Fixed a bug in the collaboration system that caused replies to fail. - Fixed a bug in the collaboration system that caused replies to fail.
- Fixed an inefficency in the asset system that caused a lot of extra work on
the server when pasting.
6.5.4 6.5.4

View file

@ -254,20 +254,22 @@ If not present, asset's existing lineage is used.
=cut =cut
sub cascadeLineage { sub cascadeLineage {
my $self = shift; my $self = shift;
my $newLineage = shift; my $newLineage = shift;
my $oldLineage = shift || $self->get("lineage"); my $oldLineage = shift || $self->get("lineage");
WebGUI::Cache->new($self->getId)->deleteByRegex(/^asset_/); my $now = time();
WebGUI::Cache->new($self->getId)->deleteByRegex(/^lineage_$oldLineage/); my $prepared = WebGUI::SQL->prepare("update asset set lineage=?, lastUpdatedBy=".quote($session{user}{userId}).", lastUpdated=$now where assetId=?");
WebGUI::SQL->write("update asset set my $descendants = WebGUI::SQL->read("select assetId,lineage from asset where lineage like ".quote($oldLineage.'%'));
lineage=concat(".quote($newLineage).",substring(lineage from ".(length($oldLineage)+1).")), while (my ($assetId, $lineage) = $descendants->array) {
lastUpdatedBy=".quote($session{user}{userId}).", WebGUI::Cache->new("asset_".$assetId)->delete;
lastUpdated=".time()." WebGUI::Cache->new("lineage_".$lineage)->delete;
where lineage like ".quote($oldLineage.'%')); my $fixedLineage = $newLineage.substr($lineage,length($oldLineage));
$prepared->execute([$fixedLineage,$assetId]);
}
$descendants->finish;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 checkExportPath ( ) =head2 checkExportPath ( )