Added a better mechanism for calculating when content was last modified for cache headers.
This commit is contained in:
parent
0e18071411
commit
f951bbed37
7 changed files with 27 additions and 78 deletions
|
|
@ -1,6 +1,8 @@
|
|||
7.6.3
|
||||
- fixed #8989: Missing profile field "showOnline" for the UsersOnline macro.
|
||||
- Added DataTable to WebGUI.conf.original
|
||||
- Added a better mechanism for calculating when content was last modified for
|
||||
cache headers.
|
||||
- The Syndicated Content asset was rewritten, and now uses 35% less memory
|
||||
and is 400% faster.
|
||||
- fixed #9025: Testing function of UsersOnline macro fails.
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ save you many hours of grief.
|
|||
there will be problems that the migration cannot handle. Check your
|
||||
Syndicated Content assets after upgrade to ensure they are still
|
||||
working as expected.
|
||||
|
||||
* You must upgrade to 7.6.2 before you can upgrade to 7.6.3.
|
||||
|
||||
|
||||
7.6.1
|
||||
|
|
|
|||
|
|
@ -29,12 +29,21 @@ my $quiet; # this line required
|
|||
|
||||
my $session = start(); # this line required
|
||||
# upgrade functions go here
|
||||
|
||||
createLastUpdatedField($session);
|
||||
createFieldShowOnline($session);
|
||||
upgradeSyndicatedContentTemplates($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub createLastUpdatedField {
|
||||
my $session = shift;
|
||||
print "\tAdding last updated field to all assets... " unless $quiet;
|
||||
my $db = $session->db;
|
||||
$db->write("alter table assetData add column lastModified bigint");
|
||||
$db->write("update assetData set lastModified=revisionDate");
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub upgradeSyndicatedContentTemplates {
|
||||
|
|
|
|||
|
|
@ -475,6 +475,11 @@ sub definition {
|
|||
fieldType=>'hidden',
|
||||
defaultValue=>'pending'
|
||||
},
|
||||
lastModified=>{
|
||||
noFormPost=>1,
|
||||
fieldType=>'hidden',
|
||||
defaultValue=>time(),
|
||||
},
|
||||
assetSize=>{
|
||||
noFormPost=>1,
|
||||
fieldType=>'hidden',
|
||||
|
|
@ -1450,14 +1455,14 @@ sub getUrl {
|
|||
|
||||
Returns the overall modification time of the object and its content in Unix
|
||||
epoch format, for the purpose of the Last-Modified HTTP header. Override this
|
||||
for subclasses that contain content that is not solely dependent on the
|
||||
revisionDate of the asset.
|
||||
for subclasses that contain content that is not solely lastModified property,
|
||||
which gets updated every time update() is called.
|
||||
|
||||
=cut
|
||||
|
||||
sub getContentLastModified {
|
||||
my $self = shift;
|
||||
return $self->get("revisionDate");
|
||||
return $self->get("lastModified");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2238,6 +2243,7 @@ to set the keywords for this asset.
|
|||
sub update {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
$properties->{lastModified} = time();
|
||||
|
||||
# if keywords were specified, then let's set them the right way
|
||||
if (exists $properties->{keywords}) {
|
||||
|
|
|
|||
|
|
@ -324,12 +324,6 @@ sub formatContent {
|
|||
return $msg;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# Too slow to try to find out children, just always assume new data
|
||||
sub getContentLastModified {
|
||||
return time();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getAutoCommitWorkflowId {
|
||||
my $self = shift;
|
||||
|
|
|
|||
|
|
@ -810,12 +810,6 @@ sub duplicate {
|
|||
return $newAsset;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# Too slow to try to find out children, just always assume new data
|
||||
sub getContentLastModified {
|
||||
return time();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getEditTabs
|
||||
|
|
|
|||
|
|
@ -200,6 +200,10 @@ sub generateFeed {
|
|||
|
||||
# limit the feed to the maxium number of headlines
|
||||
$feed->limit_item($self->get('maxHeadlines'));
|
||||
|
||||
# mark this asset as updated
|
||||
$self->update({lastModified=>time});
|
||||
|
||||
return $feed;
|
||||
}
|
||||
|
||||
|
|
@ -327,68 +331,6 @@ sub view {
|
|||
$cache->set($out,$self->get("cacheTimeout"));
|
||||
}
|
||||
return $out;
|
||||
|
||||
|
||||
|
||||
my $rssFlavor = shift;
|
||||
if ($rssFlavor eq "" && !$self->session->var->isAdminOn && $self->get("cacheTimeout") > 10) {
|
||||
my $out = WebGUI::Cache->new($self->session,"view_".$self->getId)->get;
|
||||
return $out if $out;
|
||||
}
|
||||
my $maxHeadlines = $self->_getMaxHeadlines;
|
||||
my @validatedUrls = $self->_getValidatedUrls;
|
||||
return $self->processTemplate({},$self->get('templateId')) unless (scalar(@validatedUrls));
|
||||
my $title=$self->get('title');
|
||||
|
||||
#We came into this subroutine as
|
||||
my $rssObject=($rssFlavor) ? XML::RSS::Creator->new(version=>$rssFlavor) : undef;
|
||||
|
||||
my %var;
|
||||
|
||||
my($item_loop,$rss_feeds)=$self->_get_items(\@validatedUrls, $maxHeadlines);
|
||||
|
||||
if (scalar(@$rss_feeds) < 1) {
|
||||
return $self->processTemplate(\%var,undef,$self->{_viewTemplate});
|
||||
}
|
||||
|
||||
if(@$rss_feeds == 1){
|
||||
if(@$rss_feeds == 1){
|
||||
#One feed. Put in the info from the feed.
|
||||
# Make sure we have a channel to avoid runtime errors
|
||||
my $channel = $rss_feeds->[0]->{channel};
|
||||
if ( $channel && ref $channel eq "HASH" ) {
|
||||
$var{'channel.title'} = $channel->{title} || $title;
|
||||
$var{'channel.link'} = $channel->{link};
|
||||
$var{'channel.description'} = $channel->{description};
|
||||
}
|
||||
else {
|
||||
$var{'channel.title'} = $title;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$self->_createRSSURLs(\%var);
|
||||
$var{item_loop} = $item_loop;
|
||||
|
||||
if ($rssObject) {
|
||||
$self->_constructRSS($rssObject,\%var);
|
||||
my $rss=$rssObject->as_string;
|
||||
$self->session->http->setMimeType('text/xml');
|
||||
|
||||
#Looks like a kludge, but what this does is put in the proper
|
||||
#XSLT stylesheet so the RSS doesn't look like total ass.
|
||||
my $siteURL=$self->session->url->getSiteURL().$self->session->url->gateway();
|
||||
$rss=~s|<\?xml version="1\.0" encoding="UTF\-8"\?>|<\?xml version="1\.0" encoding="UTF\-8"\?>\n<?xml\-stylesheet type="text/xsl" href="${siteURL}xslt/rss$rssFlavor.xsl"\?>\n|;
|
||||
return $rss;
|
||||
|
||||
} else {
|
||||
my $out = $self->processTemplate(\%var,undef,$self->{_viewTemplate});
|
||||
if (!$self->session->var->isAdminOn && $self->get("cacheTimeout") > 10) {
|
||||
WebGUI::Cache->new($self->session,"view_".$self->getId)->set($out,$self->get("cacheTimeout"));
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue