private static function cache_link($item, $force = false) { $checker = Amber::get_checker(); $status = Amber::get_status(); $fetcher = Amber::get_fetcher(); $availability = Amber::get_availability(); /* Check whether the site is up */ $last_check = $status->get_check($item); if (($update = $checker->check(empty($last_check) ? array('url' => $item) : $last_check, $force)) !== false) { /* There's an updated check result to save */ $status->save_check($update); if ($availability && isset($update['details']) && Amber::get_option('amber_report_availability', AMBER_REPORT_AVAILABILITY_NONE) == AMBER_REPORT_AVAILABILITY_NETCLERK) { $availability->report_status($item, $update['details']); } /* Now cache the item if we should */ $strategy = Amber::get_option('amber_update_strategy', 0); if ($update['status'] && (!$strategy || !$status->has_cache($item))) { /* Save the item to the primary storage location */ $result = Amber::fetch_item($item, $fetcher, $status); /* Save the item to any alternate storage locations */ foreach (Amber::get_alternate_fetchers() as $alternate_fetcher) { Amber::fetch_item($item, $alternate_fetcher, $status); } if ($result) { Amber::disk_space_purge(); return true; } } } else { return false; } }