If the User Function Style template is cut or deleted, use the Fail Safe template instead. Fixes bug #11729

This commit is contained in:
Colin Kuskie 2010-07-26 09:01:21 -07:00
parent 5426ea4575
commit 5bc83c4b17
3 changed files with 70 additions and 1 deletions

View file

@ -47,6 +47,24 @@ These methods are available from this class:
#-------------------------------------------------------------------
=head2 cut ( )
Extend the base method to handle cutting the User Function Style template and destroying your site.
If the current template is the User Function Style template with the Fail Safe template.
=cut
sub cut {
my ( $self ) = @_;
my $returnValue = $self->SUPER::cut();
if ($returnValue && $self->getId eq $self->session->setting->get('userFunctionStyleId')) {
$self->session->setting->set('userFunctionStyleId', 'PBtmpl0000000000000060');
}
return $returnValue;
}
#-------------------------------------------------------------------
=head2 definition ( session, definition )
Defines the properties of this asset.
@ -658,6 +676,24 @@ sub processRaw {
#-------------------------------------------------------------------
=head2 purge ( )
Extend the base method to handle purging the User Function Style template and destroying your site.
If the current template is the User Function Style template with the Fail Safe template.
=cut
sub purge {
my $self = shift;
my $returnValue = $self->SUPER::purge;
if ($returnValue && $self->getId eq $self->session->setting->get('userFunctionStyleId')) {
$self->session->setting->set('userFunctionStyleId', 'PBtmpl0000000000000060');
}
return $returnValue;
}
#-------------------------------------------------------------------
=head2 update
Override update from Asset.pm to handle backwards compatibility with the old