Fix version tag rollback.
This commit is contained in:
parent
5c3a3d440b
commit
348b34d307
1 changed files with 14 additions and 14 deletions
|
|
@ -599,26 +599,26 @@ A subroutine for reporting the status of the rollback. Typically used by WebGUI
|
|||
=cut
|
||||
|
||||
sub rollback {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $options = shift || {};
|
||||
my $outputSub = exists $options->{outputSub} ? $options->{outputSub} : sub {};
|
||||
my $tagId = $self->getId;
|
||||
if ($tagId eq "pbversion0000000000001") {
|
||||
$session->errorHandler->warn("You cannot rollback a tag that is required for the system to operate.");
|
||||
return 0;
|
||||
}
|
||||
my $sth = $session->db->read("select asset.className, asset.assetId, assetData.revisionDate from assetData left join asset on asset.assetId=assetData.assetId where assetData.tagId = ? order by asset.lineage desc, assetData.revisionDate desc", [ $tagId ]);
|
||||
my $tagId = $self->getId;
|
||||
if ($tagId eq "pbversion0000000000001") {
|
||||
$session->errorHandler->warn("You cannot rollback a tag that is required for the system to operate.");
|
||||
return 0;
|
||||
}
|
||||
my $sth = $session->db->read("select asset.assetId, assetData.revisionDate from assetData left join asset using(assetId) where assetData.tagId = ? order by asset.lineage desc, assetData.revisionDate desc", [ $tagId ]);
|
||||
my $i18n = WebGUI::International->new($session, 'VersionTag');
|
||||
REVISION: while (my ($class, $id, $revisionDate) = $sth->array) {
|
||||
my $revision = WebGUI::Asset->new($session,$id, $class, $revisionDate);
|
||||
REVISION: while (my ($id, $revisionDate) = $sth->array) {
|
||||
my $revision = WebGUI::Asset->newById($session, $id, $revisionDate);
|
||||
next REVISION unless $revision;
|
||||
$outputSub->(sprintf $i18n->get('Rolling back %s'), $revision->getTitle);
|
||||
$revision->purgeRevision;
|
||||
}
|
||||
$session->db->write("delete from assetVersionTag where tagId=?", [$tagId]);
|
||||
$self->clearWorking;
|
||||
return 1;
|
||||
$revision->purgeRevision;
|
||||
}
|
||||
$session->db->write("delete from assetVersionTag where tagId=?", [$tagId]);
|
||||
$self->clearWorking;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue