From 23546d7b9ac2f19bcbf00dc5bd3fe906f8aafde4 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Wed, 30 Jan 2008 01:57:00 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20414726:=20Bugzilla::Update=20never=20upda?= =?UTF-8?q?tes=20bugzilla-update.xml=20if=20the=20file=20already=20exists?= =?UTF-8?q?=20locally=20-=20Patch=20by=20Fr=C3=83=C2=A9d=C3=83=C2=A9ric=20?= =?UTF-8?q?Buclin=20=20r=3Dmkanat=20a=3DLpSolit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@244427 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/Bugzilla/Update.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mozilla/webtools/bugzilla/Bugzilla/Update.pm b/mozilla/webtools/bugzilla/Bugzilla/Update.pm index f2b17a6b004..e9da91afb37 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Update.pm +++ b/mozilla/webtools/bugzilla/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