- Made Weather Data asset more fault tollerant.
- Made CS related upgrades more fault tollerant. - Enhanced HTTP caching directives.
This commit is contained in:
parent
9031a17c35
commit
3a8bd77cde
6 changed files with 58 additions and 32 deletions
|
|
@ -1,6 +1,9 @@
|
|||
7.3.12
|
||||
- Performance enhancement added to Page Layouts to make them do template
|
||||
processing twice as fast.
|
||||
- Made Weather Data asset more fault tollerant.
|
||||
- Made CS related upgrades more fault tollerant.
|
||||
- Enhanced HTTP caching directives.
|
||||
- fix: Fixing bad link on the Event page to the search engine. Added a new
|
||||
Event template variable called urlSearch to handle it. (perlDreamer Consulting, LLC)
|
||||
- fix: Set default groupIdEditEvent to groupIdEdit during upgrade (perlDreamer Consulting, LLC)
|
||||
|
|
|
|||
|
|
@ -126,13 +126,21 @@ sub contentHandler {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$out = page($session);
|
||||
if ($r->headers_in->{'If-Modified-Since'} ne "" && $session->var->get("userId") eq "1") {
|
||||
$http->setStatus("304","Content Not Modified");
|
||||
$http->sendHeader;
|
||||
$session->close;
|
||||
return Apache2::Const::OK();
|
||||
} else {
|
||||
$out = page($session);
|
||||
}
|
||||
}
|
||||
my $filename = $http->getStreamedFile();
|
||||
if ((defined $filename) && ($config->get("enableStreamingUploads") eq "1")) {
|
||||
my $ct = guess_media_type($filename);
|
||||
my $oldContentType = $r->content_type($ct);
|
||||
if ($r->sendfile($filename) ) {
|
||||
$session->close;
|
||||
return Apache2::Const::OK();
|
||||
} else {
|
||||
$r->content_type($oldContentType);
|
||||
|
|
|
|||
|
|
@ -792,7 +792,12 @@ select sum(Post.rating) from Post
|
|||
EOSQL
|
||||
my ($sum) = $self->session->db->quickArray($ratingSumSQL, [$self->getId]);
|
||||
$self->update({threadRating=>$sum});
|
||||
$self->getParent->recalculateRating;
|
||||
my $parent = $self->getParent;
|
||||
if (defined $parent) {
|
||||
$parent->recalculateRating;
|
||||
} else {
|
||||
$self->session->errorHandler->error("Couldn't get parent for thread ".$self->getId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -190,23 +190,26 @@ to be displayed within the page style
|
|||
sub view {
|
||||
my $self = shift;
|
||||
my %var;
|
||||
foreach my $location (split("\n", $self->get("locations"))) {
|
||||
my $weather = Weather::Com::Simple->new({
|
||||
'partner_id' => $self->get("partnerId"),
|
||||
'license' => $self->get("licenseKey"),
|
||||
'place' => $location,
|
||||
'cache' => '/tmp',
|
||||
});
|
||||
foreach my $foundLocation (@{$weather->get_weather}) {
|
||||
push(@{$var{'ourLocations.loop'}}, {
|
||||
query => $location,
|
||||
cityState => $foundLocation->{place} || $location,
|
||||
sky => $foundLocation->{conditions} || 'N/A',
|
||||
tempF => $foundLocation->{temperature_fahrenheit} || 'N/A',
|
||||
tempC => $foundLocation->{temperature_celsius} || 'N/A',
|
||||
iconUrl => $self->session->url->extras("wobject/WeatherData/".$self->_chooseWeatherConditionsIcon($foundLocation->{conditions}).'.jpg'),
|
||||
iconAlt => $foundLocation->{conditions},
|
||||
});
|
||||
if ($self->get("partnerId") ne "" && $self->get("licenseKey") ne "") {
|
||||
foreach my $location (split("\n", $self->get("locations"))) {
|
||||
my $weather = Weather::Com::Simple->new({
|
||||
'partner_id' => $self->get("partnerId"),
|
||||
'license' => $self->get("licenseKey"),
|
||||
'place' => $location,
|
||||
'cache' => '/tmp',
|
||||
});
|
||||
next unless defined $weather;
|
||||
foreach my $foundLocation (@{$weather->get_weather}) {
|
||||
push(@{$var{'ourLocations.loop'}}, {
|
||||
query => $location,
|
||||
cityState => $foundLocation->{place} || $location,
|
||||
sky => $foundLocation->{conditions} || 'N/A',
|
||||
tempF => $foundLocation->{temperature_fahrenheit} || 'N/A',
|
||||
tempC => $foundLocation->{temperature_celsius} || 'N/A',
|
||||
iconUrl => $self->session->url->extras("wobject/WeatherData/".$self->_chooseWeatherConditionsIcon($foundLocation->{conditions}).'.jpg'),
|
||||
iconAlt => $foundLocation->{conditions},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return $self->processTemplate(\%var, undef, $self->{_viewTemplate});
|
||||
|
|
|
|||
|
|
@ -266,21 +266,26 @@ sub sendHeader {
|
|||
$request->content_type($self->getMimeType || "text/html; charset=UTF-8");
|
||||
my $cacheControl = $self->getCacheControl;
|
||||
my $date = ($userId eq "1") ? $datetime->epochToHttp($self->getLastModified) : $datetime->epochToHttp;
|
||||
$request->headers_out->set('Cache-Control' => "must-revalidate");
|
||||
$request->headers_out->set('Last-Modified' => $date);
|
||||
if ($cacheControl eq "none" || $self->session->setting->get("preventProxyCache") || ($cacheControl eq "" && $userId ne "1")) {
|
||||
$request->headers_out->set("Cache-Control" => "private");
|
||||
$request->no_cache(1);
|
||||
} elsif ($cacheControl ne "" && $request->protocol =~ /(\d\.\d)/ && $1 >= 1.1){
|
||||
my $extras = "";
|
||||
$extras .= ", private" unless ($userId eq "1");
|
||||
$request->headers_out->set('Cache-Control' => "max-age=" . $cacheControl.$extras);
|
||||
} elsif ($cacheControl ne "") {
|
||||
$request->headers_out->set("Cache-Control" => "private") unless ($userId eq "1");
|
||||
my $date = $datetime->epochToHttp(time() + $cacheControl);
|
||||
$request->headers_out->set('Expires' => $date);
|
||||
}
|
||||
# if ($cacheControl eq "none" || $self->session->setting->get("preventProxyCache") || ($cacheControl eq "" && $userId ne "1")) {
|
||||
# $request->headers_out->set("Cache-Control" => "private");
|
||||
# $request->no_cache(1);
|
||||
# } elsif ($cacheControl ne "" && $request->protocol =~ /(\d\.\d)/ && $1 >= 1.1){
|
||||
# my $extras = "";
|
||||
# $extras .= ", private" unless ($userId eq "1");
|
||||
# $request->headers_out->set('Cache-Control' => "must-revalidate, max-age=" . $cacheControl.$extras);
|
||||
# } elsif ($cacheControl ne "") {
|
||||
# if ($userId eq "1") {
|
||||
# $request->headers_out->set("Cache-Control" => "must-revalidate");
|
||||
# } else {
|
||||
# $request->headers_out->set("Cache-Control" => "private");
|
||||
# }
|
||||
# my $date = $datetime->epochToHttp(time() + $cacheControl);
|
||||
# $request->headers_out->set('Expires' => $date);
|
||||
# }
|
||||
if ($self->getFilename) {
|
||||
$request->headers_out->set('Content-Disposition' => qq!attachment; filename="!.$self->getFilename().'"');
|
||||
$request->headers_out->set('Content-Disposition' => qq{attachment; filename="}.$self->getFilename().'"');
|
||||
}
|
||||
$request->status($self->getStatus());
|
||||
$request->status_line($self->getStatus().' '.$self->getStatusDescription());
|
||||
|
|
|
|||
|
|
@ -191,6 +191,8 @@ if ($self->session->user->isInGroup(2) || $self->session->setting->get("preventP
|
|||
<meta http-equiv="Expires" content="0" />
|
||||
';
|
||||
$self->session->http->setCacheControl("none");
|
||||
} else {
|
||||
$var{'head.tags'} .= '<meta http-equiv="Cache-Control" content="must-revalidate" />'
|
||||
}
|
||||
my $style = WebGUI::Asset::Template->new($self->session,$templateId);
|
||||
my $output;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue