Fix FilePump parsing of lastModified times when fetching files via HTTP, using DateTime::Format::HTTP. Fixes bug #11373.

This commit is contained in:
Colin Kuskie 2010-01-26 10:39:20 -08:00
parent 38e6bfad3e
commit 5a346afd9e
5 changed files with 30 additions and 14 deletions

View file

@ -3,6 +3,7 @@
- fixed #11364: Notify About Low Stock workflow activity email is not user friendly
- fixed #11371: Spaces in the names of custom profile fields
- fixed #11372: All Search Forms should use GET
- fixed #11373: Problem creating FilePump bundles
7.8.10
- fixed #11332: Pagination in webgui.org forum urls

View file

@ -7,6 +7,10 @@ upgrading from one version to the next, or even between multiple
versions. Be sure to heed the warnings contained herein as they will
save you many hours of grief.
7.8.11
--------------------------------------------------------------------
* WebGUI now requires DateTime::Format::HTTP, to handle parsing HTTP dates.
7.8.6
--------------------------------------------------------------------
* WebGUI now requires LWP 5.833 or higher, to fix a bug in that module.

View file

@ -10,6 +10,7 @@ use File::Basename;
use CSS::Minifier::XS;
use JavaScript::Minifier::XS;
use LWP;
use DateTime::Format::HTTP;
use Data::Dumper;
#-------------------------------------------------------------------
@ -105,6 +106,8 @@ sub build {
}
$concatenatedJS .= $results->{content};
$jsFile->{lastModified} = $results->{lastModified};
$self->session->log->warn($jsFile->{uri});
$self->session->log->warn($jsFile->{lastModified});
}
return (0, $error) if ($error);
@ -161,6 +164,7 @@ sub build {
##Minimize files, and write them out.
$self->session->log->warn($concatenatedJS);
my $minimizedJS = JavaScript::Minifier::XS::minify($concatenatedJS);
undef $concatenatedJS;
@ -618,9 +622,10 @@ sub fetchHttp {
if (! $response->is_success) {
return {};
}
my $lastModified =
my $guts = {
content => $response->content,
lastModified => $response->header('last-modified'),
lastModified => DateTime::Format::HTTP->parse_datetime($response->header('last-modified'))->epoch,
};
return $guts;
}

View file

@ -88,6 +88,7 @@ checkModule("DateTime", 0.4501 );
checkModule("Time::HiRes", 1.9719 );
checkModule("DateTime::Format::Strptime", 1.0800 );
checkModule("DateTime::Format::Mail", 0.3001 );
checkModule("DateTime::Format::Http", 0.38 );
checkModule("Image::Magick", "6.0" );
checkModule("Log::Log4perl", 1.20 );
checkModule("Net::LDAP", 0.39 );

View file

@ -18,6 +18,7 @@ use strict;
use lib "$FindBin::Bin/../lib";
use Test::More;
use Test::Deep;
use Test::Exception;
use Data::Dumper;
use URI;
use WebGUI::Test; # Must use this before any other WebGUI modules
@ -33,17 +34,12 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
my $tests = 62; # Increment this number for each test you create
plan tests => 1 + $tests; # 1 for the use_ok
plan tests => 64;
#----------------------------------------------------------------------------
# put your tests here
my $loaded = use_ok('WebGUI::FilePump::Bundle');
SKIP: {
skip 'Unable to load module WebGUI::FilePump::Bundle', $tests unless $loaded;
use WebGUI::FilePump::Bundle;
my $bundle = WebGUI::FilePump::Bundle->create($session);
isa_ok($bundle, 'WebGUI::FilePump::Bundle');
@ -438,11 +434,20 @@ ok($bundle->get('otherFiles')->[1]->{lastModified}, '... updated OTHER directory
$bundle->delete;
ok(!-e $buildDir->stringify, 'delete deletes the current build directory');
}
###################################################################
#
# File checks
#
###################################################################
#----------------------------------------------------------------------------
# Cleanup
END {
$session->db->write('delete from filePumpBundle');
##Test a number of files that live in WebGUI to make sure the minifiers do
##the right job. All paths are relative to the extras directory.
my @jsFiles = qw/hoverhelp.js inputcheck.js/;
foreach my $jsFile (@jsFiles) {
my $bundle = WebGUI::FilePump::Bundle->create($session);
$bundle->addFile('JS', 'file:extras/'.$jsFile);
lives_ok { $bundle->build } "built file $jsFile";
$bundle->delete;
}
#vim:ft=perl