Revision 769
Added by thorn over 16 years ago
search.php | ||
---|---|---|
193 | 193 |
} else { $fetch_cfg_enable_flush['value'] = 'false'; } |
194 | 194 |
if($fetch_cfg_enable_flush['value'] == 'false') { $cfg_enable_flush = false; |
195 | 195 |
} else { $cfg_enable_flush = true; } |
196 |
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'time_limit' LIMIT 1"); // time-limit per module |
|
197 |
if($query->numRows() > 0) { $fetch_search_time_limit = $query->fetchRow(); |
|
198 |
} else { $fetch_search_time_limit['value'] = 'false'; } |
|
199 |
$search_time_limit = (int)($fetch_search_time_limit['value']); |
|
200 |
if($search_time_limit < 1) $search_time_limit = 0; |
|
196 | 201 |
// Replace vars in search settings with values |
197 | 202 |
$vars = array('[SEARCH_STRING]', '[WB_URL]', '[PAGE_EXTENSION]', '[TEXT_RESULTS_FOR]'); |
198 | 203 |
$values = array($search_display_string, WB_URL, PAGE_EXTENSION, $TEXT['RESULTS_FOR']); |
... | ... | |
309 | 314 |
$seen_pages = array(); // seen pages per module. |
310 | 315 |
$pages_listed = array(); // seen pages. |
311 | 316 |
foreach($sorted_modules AS $module_name) { |
317 |
$start_time = time(); // get start-time to check time-limit; not very accurate, but ok |
|
312 | 318 |
$seen_pages[$module_name] = array(); |
313 | 319 |
if(!isset($search_funcs[$module_name])) { |
314 | 320 |
continue; // there is no search_func for this module |
... | ... | |
326 | 332 |
"); |
327 | 333 |
if($sections_query->numRows() > 0) { |
328 | 334 |
while($res = $sections_query->fetchRow()) { |
335 |
// check if time-limit is exceeded for this module |
|
336 |
if($search_time_limit > 0 && (time()-$start_time > $search_time_limit)) { |
|
337 |
break; |
|
338 |
} |
|
329 | 339 |
// Only show this section if it is not "out of publication-date" |
330 | 340 |
$now = time(); |
331 | 341 |
if( !( $now<$res['publ_end'] && ($now>$res['publ_start'] || $res['publ_start']==0) || |
Also available in: Unified diff
search: added search_time_limit in settings (mainly for sites with PHP < 4.3.3 and slow search)