bug fixes
This commit is contained in:
parent
0026b1e73f
commit
0dd6b7b660
12 changed files with 1151 additions and 219 deletions
|
|
@ -693,8 +693,6 @@ sub getIcon {
|
|||
my $small = shift;
|
||||
my $definition = $self->definition;
|
||||
my $icon = $definition->[0]{icon} || "assets.gif";
|
||||
return $session{config}{extrasURL}."/adminConsole/small/assets.gif" if ($small and $icon eq "assets.gif");
|
||||
return $session{config}{extrasURL}."/adminConsole/assets.gif" if ($icon eq "assets.gif");
|
||||
return $session{config}{extrasURL}.'/assets/small/'.$icon if ($small);
|
||||
return $session{config}{extrasURL}.'/assets/'.$icon;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,21 +68,27 @@ These functions are available from this package:
|
|||
|
||||
sub epochToDate {
|
||||
my $secs = shift;
|
||||
my $cache = WebGUI::Cache->new(["epochToDate",$secs],"DateTime");
|
||||
my $value = $cache->get;
|
||||
my ($cache, $value);
|
||||
if ($session{config}{enableDateCache}) {
|
||||
$cache = WebGUI::Cache->new(["epochToDate",$secs],"DateTime");
|
||||
$value = $cache->get;
|
||||
}
|
||||
return $value if ($value);
|
||||
my $converted = &ParseDateString("epoch $secs");
|
||||
$cache->set($converted);
|
||||
$cache->set($converted) if ($session{config}{enableDateCache});
|
||||
return $converted;
|
||||
}
|
||||
|
||||
sub dateToEpoch {
|
||||
my $date = shift;
|
||||
my $cache = WebGUI::Cache->new(["dateToEpoch",$date],"DateTime");
|
||||
my $value = $cache->get;
|
||||
my ($cache, $value);
|
||||
if ($session{config}{enableDateCache}) {
|
||||
$cache = WebGUI::Cache->new(["dateToEpoch",$date],"DateTime");
|
||||
$value = $cache->get;
|
||||
}
|
||||
return $value if ($value);
|
||||
my $converted = &UnixDate($date,"%s");
|
||||
$cache->set($converted);
|
||||
$cache->set($converted) if ($session{config}{enableDateCache});
|
||||
return $converted;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,45 @@ sub audit {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head canShowDebug ( )
|
||||
|
||||
Returns true if the user meets the condition to see debugging information and debug mode is enabled.
|
||||
|
||||
=cut
|
||||
|
||||
sub canShowDebug {
|
||||
return (
|
||||
(
|
||||
$WebGUI::Session::session{setting}{showDebug}
|
||||
) && (
|
||||
$WebGUI::Session::session{setting}{debugIp} =~ /^$WebGUI::Session::session{env}{REMOTE_ADDR}/ ||
|
||||
$WebGUI::Session::session{setting}{debugIp} eq ""
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head canShowPerformanceIndicators ()
|
||||
|
||||
Returns true if the user meets the conditions to see performance indicators and performance indicators are enabled.
|
||||
|
||||
=cut
|
||||
|
||||
sub canShowPerformanceIndicators {
|
||||
return (
|
||||
(
|
||||
$WebGUI::Session::session{setting}{showPerformanceIndicators}
|
||||
) && (
|
||||
$WebGUI::Session::session{setting}{debugIp} =~ /^$session{env}{REMOTE_ADDR}/ ||
|
||||
$WebGUI::Session::session{setting}{debugIp} eq ""
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 debug ( message )
|
||||
|
|
|
|||
|
|
@ -386,6 +386,16 @@ our $HELP = {
|
|||
description => '400 description',
|
||||
namespace => 'WebGUI',
|
||||
},
|
||||
{
|
||||
title => 'debug ip',
|
||||
description => 'debug ip description',
|
||||
namespace => 'WebGUI',
|
||||
},
|
||||
{
|
||||
title => 'show performance indicators',
|
||||
description => 'show performance indicators description',
|
||||
namespace => 'WebGUI',
|
||||
},
|
||||
{
|
||||
title => '707',
|
||||
description => '707 description',
|
||||
|
|
|
|||
|
|
@ -172,11 +172,21 @@ sub www_editSettings {
|
|||
-label=>$i18n->get(400),
|
||||
-value=>$session{setting}{preventProxyCache}
|
||||
);
|
||||
$tabform->getTab("misc")->text(
|
||||
-name=>"debugIp",
|
||||
-label=>$i18n->get("debug ip"),
|
||||
-value=>$session{setting}{debugIp}
|
||||
);
|
||||
$tabform->getTab("misc")->yesNo(
|
||||
-name=>"showDebug",
|
||||
-label=>$i18n->get(707),
|
||||
-value=>$session{setting}{showDebug}
|
||||
);
|
||||
$tabform->getTab("misc")->yesNo(
|
||||
-name=>"showPerformanceIndicators",
|
||||
-label=>$i18n->get('show performance indicators'),
|
||||
-value=>$session{setting}{showPerformanceIndicators}
|
||||
);
|
||||
$tabform->getTab("misc")->selectList(
|
||||
-name=>"hostToUse",
|
||||
-value=>[$session{setting}{hostToUse}],
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ sub prepare {
|
|||
my $class = shift;
|
||||
my $sql = shift;
|
||||
my $dbh = shift || _getDefaultDb();
|
||||
if ($WebGUI::Session::session{setting}{showDebug}) {
|
||||
if (WebGUI::ErrorHandler::canShowDebug()) {
|
||||
push(@{$WebGUI::Session::session{SQLquery}},$sql);
|
||||
}
|
||||
my $sth = $dbh->prepare($sql) or WebGUI::ErrorHandler::fatal("Couldn't prepare statement: ".$sql." : ". DBI->errstr);
|
||||
|
|
@ -777,7 +777,7 @@ sub unconditionalRead {
|
|||
my $sql = shift;
|
||||
my $dbh = shift || _getDefaultDb();
|
||||
my $placeholders = shift;
|
||||
if ($WebGUI::Session::session{setting}{showDebug}) {
|
||||
if (WebGUI::ErrorHandler::canShowDebug()) {
|
||||
push(@{$WebGUI::Session::session{SQLquery}},$sql);
|
||||
}
|
||||
my $sth = $dbh->prepare($sql) or WebGUI::ErrorHandler::warn("Unconditional read failed: ".$sql." : ".DBI->errstr);
|
||||
|
|
@ -808,7 +808,7 @@ sub write {
|
|||
my $class = shift;
|
||||
my $sql = shift;
|
||||
my $dbh = shift || _getDefaultDb();
|
||||
if ($WebGUI::Session::session{setting}{showDebug}) {
|
||||
if (WebGUI::ErrorHandler::canShowDebug()) {
|
||||
push(@{$WebGUI::Session::session{SQLquery}},$sql);
|
||||
}
|
||||
$dbh->do($sql) or WebGUI::ErrorHandler::fatal("Couldn't write to the database: ".$sql." : ". DBI->errstr);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,26 @@
|
|||
package WebGUI::i18n::English::WebGUI;
|
||||
|
||||
our $I18N = {
|
||||
'show performance indicators' => {
|
||||
message => q|Show performance indicators?|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'show performance indicators description' => {
|
||||
message => q|This will display the time (in seconds) it took to build each item on the page. It's useful for debugging performance problems.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'debug ip description' => {
|
||||
message => q|This will limit debugging output to a specific IP address or IP range. To limit the output to anyone in a subnet of 10.0.0.0/24 you'd simply enter '10.0.0.'.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'debug ip' => {
|
||||
message => q|Debug IP|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'304' => {
|
||||
message => q|Language|,
|
||||
lastUpdated => 1031514049
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue