Add progress bars for rollback, trash and their www methods.
This commit is contained in:
parent
ef4afdb9c8
commit
7b5cf7518c
6 changed files with 141 additions and 25 deletions
|
|
@ -7,6 +7,8 @@
|
||||||
- fixed: Add the user's first day of week data to getWebguiProperties and get rid of some inline javascript in the Data and DateTime forms.
|
- fixed: Add the user's first day of week data to getWebguiProperties and get rid of some inline javascript in the Data and DateTime forms.
|
||||||
- fixed #10544: AssetVersioning: child assets versions under uncommitted parent
|
- fixed #10544: AssetVersioning: child assets versions under uncommitted parent
|
||||||
- fixed #10549: EMS import
|
- fixed #10549: EMS import
|
||||||
|
- fixed #10561: pb: purge
|
||||||
|
- fixed #10563: pb: rollback version tag
|
||||||
|
|
||||||
7.7.11
|
7.7.11
|
||||||
- Fixed a bug where empty version tags were not deleted. (Martin Kamerbeek / Oqapi)
|
- Fixed a bug where empty version tags were not deleted. (Martin Kamerbeek / Oqapi)
|
||||||
|
|
|
||||||
|
|
@ -119,15 +119,22 @@ A hash refernece containing options that change the behavior of this method.
|
||||||
|
|
||||||
A boolean that, if true, will skip dealing with exported files.
|
A boolean that, if true, will skip dealing with exported files.
|
||||||
|
|
||||||
|
=head4 outputSub
|
||||||
|
|
||||||
|
A subroutine used to report the status of the purge, most likely used by WebGUI::ProgressBar->update.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub purge {
|
sub purge {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $options = shift;
|
my $options = shift;
|
||||||
my $session = $self->session;
|
my $session = $self->session;
|
||||||
|
my $outputSub = $options->{outputSub} || sub {};
|
||||||
|
my $i18n = WebGUI::International->new($session, 'Asset');
|
||||||
|
|
||||||
# can't delete if it's one of these things
|
# can't delete if it's one of these things
|
||||||
if ($self->getId eq $session->setting->get("defaultPage") || $self->getId eq $session->setting->get("notFoundPage") || $self->get("isSystem")) {
|
if ($self->getId eq $session->setting->get("defaultPage") || $self->getId eq $session->setting->get("notFoundPage") || $self->get("isSystem")) {
|
||||||
|
$outputSub->(sprintf $i18n->get('Trying to delete system page %s. Aborting purge'), $self->getTitle);
|
||||||
$session->errorHandler->security("delete a system protected page (".$self->getId.")");
|
$session->errorHandler->security("delete a system protected page (".$self->getId.")");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -143,26 +150,30 @@ sub purge {
|
||||||
if (defined $kid) {
|
if (defined $kid) {
|
||||||
unless ($kid->purge) {
|
unless ($kid->purge) {
|
||||||
$self->errorHandler->security("delete one of (".$self->getId.")'s children which is a system protected page");
|
$self->errorHandler->security("delete one of (".$self->getId.")'s children which is a system protected page");
|
||||||
|
$outputSub->(sprintf $i18n->get('Trying to delete system page %s. Aborting purge'), $self->getTitle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$outputSub->($i18n->get('Undefined child'));
|
||||||
$session->errorHandler->error("getLineage returned an undefined object in the AssetTrash->purge method. Unable to purge asset.");
|
$session->errorHandler->error("getLineage returned an undefined object in the AssetTrash->purge method. Unable to purge asset.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Delete shortcuts to this asset
|
# Delete shortcuts to this asset
|
||||||
# Also publish any shortcuts to this asset that are in the trash
|
# Also publish any shortcuts to this asset that are in the trash
|
||||||
|
$outputSub->($i18n->get('Purging shortcuts'));
|
||||||
my $shortcuts
|
my $shortcuts
|
||||||
= WebGUI::Asset::Shortcut->getShortcutsForAssetId($self->session, $self->getId, {
|
= WebGUI::Asset::Shortcut->getShortcutsForAssetId($self->session, $self->getId, {
|
||||||
returnObjects => 1,
|
returnObjects => 1,
|
||||||
});
|
});
|
||||||
for my $shortcut ( @$shortcuts ) {
|
for my $shortcut ( @$shortcuts ) {
|
||||||
$shortcut->purge;
|
$shortcut->purge({ outputSub => $outputSub, });
|
||||||
}
|
}
|
||||||
|
|
||||||
# gotta delete stuff we've exported
|
# gotta delete stuff we've exported
|
||||||
unless ($options->{skipExported}) {
|
unless ($options->{skipExported}) {
|
||||||
|
$outputSub->($i18n->get('Deleting exported files'));
|
||||||
$self->_invokeWorkflowOnExportedFiles($self->session->setting->get('purgeWorkflow'), 1);
|
$self->_invokeWorkflowOnExportedFiles($self->session->setting->get('purgeWorkflow'), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -170,16 +181,20 @@ sub purge {
|
||||||
my $tagId = $self->get("tagId");
|
my $tagId = $self->get("tagId");
|
||||||
|
|
||||||
# clean up keywords
|
# clean up keywords
|
||||||
|
$outputSub->($i18n->get('Deleting keywords'));
|
||||||
WebGUI::Keyword->new($session)->deleteKeywordsForAsset($self);
|
WebGUI::Keyword->new($session)->deleteKeywordsForAsset($self);
|
||||||
|
|
||||||
# clean up search engine
|
# clean up search engine
|
||||||
|
$outputSub->($i18n->get('Clearing search index'));
|
||||||
WebGUI::Search::Index->new($self)->delete;
|
WebGUI::Search::Index->new($self)->delete;
|
||||||
|
|
||||||
# clean up cache
|
# clean up cache
|
||||||
|
$outputSub->($i18n->get('Clearing cache'));
|
||||||
WebGUI::Cache->new($session)->deleteChunk(["asset",$self->getId]);
|
WebGUI::Cache->new($session)->deleteChunk(["asset",$self->getId]);
|
||||||
$self->purgeCache;
|
$self->purgeCache;
|
||||||
|
|
||||||
# delete stuff out of the asset tables
|
# delete stuff out of the asset tables
|
||||||
|
$outputSub->($i18n->get('Clearing asset tables'));
|
||||||
$session->db->beginTransaction;
|
$session->db->beginTransaction;
|
||||||
$session->db->write("delete from metaData_values where assetId = ?",[$self->getId]);
|
$session->db->write("delete from metaData_values where assetId = ?",[$self->getId]);
|
||||||
foreach my $definition (@{$self->definition($session)}) {
|
foreach my $definition (@{$self->definition($session)}) {
|
||||||
|
|
@ -382,16 +397,27 @@ Purges a piece of content, including all it's revisions, from the system permane
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub www_purgeList {
|
sub www_purgeList {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
foreach my $id ($self->session->form->param("assetId")) {
|
my $session = $self->session;
|
||||||
my $asset = WebGUI::Asset->newPending($self->session,$id);
|
my $pb = WebGUI::ProgressBar->new($session);
|
||||||
$asset->purge if $asset->canEdit;
|
my $i18n = WebGUI::International->new($session, 'Asset');
|
||||||
|
$pb->start($i18n->get('purge'), $session->url->extras('adminConsole/assets.gif'));
|
||||||
|
|
||||||
|
ASSETID: foreach my $id ($session->form->param("assetId")) {
|
||||||
|
my $asset = eval { WebGUI::Asset->newPending($session,$id); };
|
||||||
|
if ($@) {
|
||||||
|
$pb->update(sprintf $i18n->get('Error getting asset with assetId %s'), $id);
|
||||||
|
next ASSETID;
|
||||||
}
|
}
|
||||||
if ($self->session->form->process("proceed") ne "") {
|
if (! $asset->canEdit) {
|
||||||
my $method = "www_".$self->session->form->process("proceed");
|
$pb->update(sprintf $i18n->get('You cannot edit the asset %s, skipping purge'), $asset->getTitle);
|
||||||
return $self->$method();
|
|
||||||
}
|
}
|
||||||
return $self->www_manageTrash();
|
else {
|
||||||
|
$asset->purge({outputSub => sub { $pb->update(@_); } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
my $method = ($session->form->process("proceed")) ? $session->form->process('proceed') : 'manageTrash';
|
||||||
|
$pb->finish($self->getUrl('func='.$method));
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -850,14 +850,16 @@ sub www_rollbackVersionTag {
|
||||||
return $session->privilege->adminOnly() unless canView($session);
|
return $session->privilege->adminOnly() unless canView($session);
|
||||||
my $tagId = $session->form->process("tagId");
|
my $tagId = $session->form->process("tagId");
|
||||||
return $session->privilege->vitalComponent() if ($tagId eq "pbversion0000000000001");
|
return $session->privilege->vitalComponent() if ($tagId eq "pbversion0000000000001");
|
||||||
|
my $pb = WebGUI::ProgressBar->new($session);
|
||||||
|
my $i18n = WebGUI::International->new($session, 'VersionTag');
|
||||||
|
$pb->start($i18n->get('rollback version tag'), $session->url->extras('adminConsole/versionTags.gif'));
|
||||||
if ($tagId) {
|
if ($tagId) {
|
||||||
my $tag = WebGUI::VersionTag->new($session, $tagId);
|
my $tag = WebGUI::VersionTag->new($session, $tagId);
|
||||||
$tag->rollback if defined $tag;
|
$tag->rollback({ outputSub => sub { $pb->update(@_) }, }) if defined $tag;
|
||||||
}
|
}
|
||||||
if ($session->form->process("proceed") eq "manageCommittedVersions") {
|
my $method = $session->form->process("proceed");
|
||||||
return www_manageCommittedVersions($session);
|
$method = $method eq "manageCommittedVersions" ? $method : 'manageVersions';
|
||||||
}
|
$pb->finish(WebGUI::Asset->getDefault($session)->getUrl('op='.$method));
|
||||||
return www_manageVersions($session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -579,25 +579,39 @@ sub requestCommit {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 rollback ( )
|
=head2 rollback ( [ $options ] )
|
||||||
|
|
||||||
Eliminates all revisions of all assets created under a specific version tag. Also removes the version tag.
|
Eliminates all revisions of all assets created under a specific version tag. Also removes the version tag.
|
||||||
|
|
||||||
|
=head3 options
|
||||||
|
|
||||||
|
A hashref of options for this method
|
||||||
|
|
||||||
|
=head4 outputSub
|
||||||
|
|
||||||
|
A subroutine for reporting the status of the rollback. Typically used by WebGUI::ProgressBar
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub rollback {
|
sub rollback {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $tagId = $self->getId;
|
my $session = $self->session;
|
||||||
|
my $options = shift || {};
|
||||||
|
my $outputSub = exists $options->{outputSub} ? $options->{outputSub} : sub {};
|
||||||
|
my $tagId = $self->getId;
|
||||||
if ($tagId eq "pbversion0000000000001") {
|
if ($tagId eq "pbversion0000000000001") {
|
||||||
$self->session->errorHandler->warn("You cannot rollback a tag that is required for the system to operate.");
|
$session->errorHandler->warn("You cannot rollback a tag that is required for the system to operate.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
my $sth = $self->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 $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 ]);
|
||||||
while (my ($class, $id, $revisionDate) = $sth->array) {
|
my $i18n = WebGUI::International->new($session, 'VersionTag');
|
||||||
my $revision = WebGUI::Asset->new($self->session,$id, $class, $revisionDate);
|
REVISION: while (my ($class, $id, $revisionDate) = $sth->array) {
|
||||||
|
my $revision = WebGUI::Asset->new($session,$id, $class, $revisionDate);
|
||||||
|
next REVISION unless $revision;
|
||||||
|
$outputSub->(sprintf $i18n->get('Rolling back %s'), $revision->getTitle);
|
||||||
$revision->purgeRevision;
|
$revision->purgeRevision;
|
||||||
}
|
}
|
||||||
$self->session->db->write("delete from assetVersionTag where tagId=?", [$tagId]);
|
$session->db->write("delete from assetVersionTag where tagId=?", [$tagId]);
|
||||||
$self->clearWorking;
|
$self->clearWorking;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1298,6 +1298,72 @@ Couldn't open %-s because %-s <br />
|
||||||
context => q{Description of asset property},
|
context => q{Description of asset property},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'Error getting asset with assetId %s' => {
|
||||||
|
message => q{Error getting asset with assetId %s},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{Generic error when an asset cannot be looked up by assetId},
|
||||||
|
},
|
||||||
|
|
||||||
|
'You cannot edit the asset %s, skipping purge' => {
|
||||||
|
message => q{You cannot edit the asset %s, skipping purge},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{Generic error when an asset cannot be deleted},
|
||||||
|
},
|
||||||
|
|
||||||
|
'Purging %s' => {
|
||||||
|
message => q{Purging %s},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{},
|
||||||
|
},
|
||||||
|
|
||||||
|
'Trying to delete system page %s. Aborting purge' => {
|
||||||
|
message => q{Trying to delete system page %s. Aborting purge},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{},
|
||||||
|
},
|
||||||
|
|
||||||
|
'Undefined child' => {
|
||||||
|
message => q{Trying to delete system page %s. Aborting purge},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{},
|
||||||
|
},
|
||||||
|
|
||||||
|
'Purging shortcuts' => {
|
||||||
|
message => q{Purging shortcuts},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{},
|
||||||
|
},
|
||||||
|
|
||||||
|
'Deleting exported files' => {
|
||||||
|
message => q{Deleting exported files},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{},
|
||||||
|
},
|
||||||
|
|
||||||
|
'Deleting keywords' => {
|
||||||
|
message => q{Deleting keywords},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{},
|
||||||
|
},
|
||||||
|
|
||||||
|
'Clearing search index' => {
|
||||||
|
message => q{Clearing search index},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{},
|
||||||
|
},
|
||||||
|
|
||||||
|
'Clearing cache' => {
|
||||||
|
message => q{Clearing cache},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{},
|
||||||
|
},
|
||||||
|
|
||||||
|
'Clearing asset tables' => {
|
||||||
|
message => q{Clearing asset tables},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{},
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
|
|
@ -477,6 +477,12 @@ our $I18N = {
|
||||||
context => q{Explanation of Permission Denied message},
|
context => q{Explanation of Permission Denied message},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"Rolling back %s" => {
|
||||||
|
message => q{Rolling back %s},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{},
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue