summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Update.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-05-03 02:14:13 +0200
committerlpsolit%gmail.com <>2008-05-03 02:14:13 +0200
commitc94d4a0566ebddbd8d1ff21e44daee8e637feda3 (patch)
tree2de8c897399095c57e8e40f4f309f00cf7280040 /Bugzilla/Update.pm
parenta0ff879d4f771a39e4c25485c1dc6b83be484244 (diff)
downloadbugzilla-c94d4a0566ebddbd8d1ff21e44daee8e637feda3.tar.gz
bugzilla-c94d4a0566ebddbd8d1ff21e44daee8e637feda3.tar.xz
2nd attempt to fix bug 414726: Bugzilla::Update never updates bugzilla-update.xml if the file already exists locally - Patch by me r=mkanat
Diffstat (limited to 'Bugzilla/Update.pm')
-rw-r--r--Bugzilla/Update.pm17
1 files changed, 2 insertions, 15 deletions
diff --git a/Bugzilla/Update.pm b/Bugzilla/Update.pm
index e9da91afb..d3f780570 100644
--- a/Bugzilla/Update.pm
+++ b/Bugzilla/Update.pm
@@ -40,20 +40,9 @@ sub get_notifications {
if (!-e $local_file || (time() - (stat($local_file))[9] > TIME_INTERVAL)) {
# Are we sure we didn't try to refresh this file already
# but we failed because we cannot modify its timestamp?
- my $can_alter = 1;
- if (-e $local_file) {
- # 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);
- }
+ my $can_alter = (-e $local_file) ? utime(undef, undef, $local_file) : 1;
if ($can_alter) {
+ unlink $local_file; # Make sure the old copy is away.
my $error = _synchronize_data();
# If an error is returned, leave now.
return $error if $error;
@@ -156,8 +145,6 @@ 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