Commit fa6aa8b7 authored by dawehner's avatar dawehner Committed by tim.plunkett
Browse files

Refactor some code in cache_time to look nicer and fix some undefined variable problems.

parent 7f3fd058
......@@ -83,11 +83,18 @@ function summary_title() {
foreach ($custom_fields as $field) {
${$field} = $this->options[$field] == 'custom' ? $this->options[$field . '_custom'] : $this->options[$field];
}
$results_lifespan = $this->get_lifespan('results');
$output_lifespan = $this->get_lifespan('output');
return format_interval($results_lifespan, 1) . '/' . format_interval($output_lifespan, 1);
}
function cache_expire($type) {
function get_lifespan($type) {
$lifespan = $this->options[$type . '_lifespan'] == 'custom' ? $this->options[$type . '_lifespan_custom'] : $this->options[$type . '_lifespan'];
return $lifespan;
}
function cache_expire($type) {
$lifespan = $this->get_lifespan($type);
if ($lifespan) {
$cutoff = REQUEST_TIME - $lifespan;
return $cutoff;
......@@ -98,7 +105,7 @@ function cache_expire($type) {
}
function cache_set_expire($type) {
$lifespan = $this->options[$type . '_lifespan'] == 'custom' ? $this->options[$type . '_lifespan_custom'] : $this->options[$type . '_lifespan'];
$lifespan = $this->get_lifespan($type);
if ($lifespan) {
return time() + $lifespan;
}
......
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