Commit 2ba1c056 authored by Ad Schellevis's avatar Ad Schellevis

(filter, alias) fix empty update frequency, excessive downloads

parent 25485266
...@@ -458,9 +458,13 @@ function process_alias_urltable($name, $url, $freq, $forceupdate=false) { ...@@ -458,9 +458,13 @@ function process_alias_urltable($name, $url, $freq, $forceupdate=false) {
unlink($urltable_prefix); unlink($urltable_prefix);
mkdir($urltable_prefix); mkdir($urltable_prefix);
} }
if (empty($freq)) {
$update_freq = 86400 - 90;
} else {
$update_freq = $freq * 86400 - 90;
}
// If the file doesn't exist or is older than update_freq days, fetch a new copy. // If the file doesn't exist or is older than update_freq days, fetch a new copy.
if (!file_exists($urltable_filename) || ((time() - filemtime($urltable_filename)) > ($freq * 86400 - 90)) || $forceupdate) { if (!file_exists($urltable_filename) || ((time() - filemtime($urltable_filename)) > $update_freq) || $forceupdate) {
// open file handle to output file, in case the process takes a lot of time, make sure there's a file before // open file handle to output file, in case the process takes a lot of time, make sure there's a file before
// filter starts to load. Also helps for tracking progress. // filter starts to load. Also helps for tracking progress.
// //
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment