diff options
author | lpsolit%gmail.com <> | 2008-01-30 08:55:16 +0100 |
---|---|---|
committer | lpsolit%gmail.com <> | 2008-01-30 08:55:16 +0100 |
commit | 3e0d22b53134333bef81139e8eb1265169de879a (patch) | |
tree | 03e23ac4c9d920d91d485a2ce1fea96a561c421a /Bugzilla | |
parent | ac2bbee074d9eae7a6e3983a1c366d1f998db766 (diff) | |
download | bugzilla-3e0d22b53134333bef81139e8eb1265169de879a.tar.gz bugzilla-3e0d22b53134333bef81139e8eb1265169de879a.tar.xz |
Bug 414726: Bugzilla::Update never updates bugzilla-update.xml if the file already exists locally - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Update.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Bugzilla/Update.pm b/Bugzilla/Update.pm index f2b17a6b0..e9da91afb 100644 --- a/Bugzilla/Update.pm +++ b/Bugzilla/Update.pm @@ -42,8 +42,16 @@ sub get_notifications { # but we failed because we cannot modify its timestamp? my $can_alter = 1; if (-e $local_file) { - # Try to alter its last modification time. + # Try to alter its last modification time. We first save the + # access and modification times of the file to restore them + # right after our test. + my $atime = (stat($local_file))[8]; + my $mtime = (stat($local_file))[9]; $can_alter = utime(undef, undef, $local_file); + # Restore the access and modification times to their + # original values, else LWP::UserAgent will never see the + # updated file on the server as newer than our local one. + utime($atime, $mtime, $local_file); } if ($can_alter) { my $error = _synchronize_data(); @@ -148,6 +156,8 @@ sub _synchronize_data { else { $ua->env_proxy; } + # Download the file from the server if its modification time is newer + # than the local one. $ua->mirror(REMOTE_FILE, $local_file); # $ua->mirror() forces the modification time of the local XML file |