cache canShowDebug a little differently to allow for mime type changes
This commit is contained in:
parent
90247ac13c
commit
e7e46ed865
1 changed files with 11 additions and 4 deletions
|
|
@ -112,14 +112,21 @@ This method caches its value, so long processes may need to manually clear the c
|
||||||
sub canShowDebug {
|
sub canShowDebug {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
|
# if we have a cached false value, we can use it
|
||||||
|
# true values need additional checks
|
||||||
|
if (exists $self->{_canShowDebug} && !$self->{_canShowDebug}) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
##This check prevents in infinite loop during startup.
|
##This check prevents in infinite loop during startup.
|
||||||
return 0 unless ($self->session->hasSettings);
|
return 0 unless ($self->session->hasSettings);
|
||||||
return $self->{_canShowDebug} if exists ($self->{_canShowDebug});
|
|
||||||
my $canShow = $self->session->setting->get("showDebug")
|
my $canShow = $self->session->setting->get("showDebug")
|
||||||
&& substr($self->session->http->getMimeType(),0,9) eq "text/html"
|
&& $self->canShowBasedOnIP('debugIp');
|
||||||
&& $self->canShowBasedOnIP('debugIp');
|
|
||||||
$self->{_canShowDebug} = $canShow;
|
$self->{_canShowDebug} = $canShow;
|
||||||
return $canShow;
|
|
||||||
|
return $canShow
|
||||||
|
&& substr($self->session->http->getMimeType(),0,9) eq "text/html";
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue