externals/discover: try up to 3 times to find a site that actually has content. Then give up until the next queue run.

This commit is contained in:
friendica 2014-03-28 15:58:58 -07:00
parent 6925cf9fe5
commit fc5f3f4800

View File

@ -11,8 +11,13 @@ function externals_run($argv, $argc){
$a = get_app();
$total = 0;
$attempts = 0;
// pull in some public posts
while($total == 0 && $attempts < 3) {
$arr = array('url' => '');
call_hooks('externals_url_select',$arr);
@ -28,8 +33,9 @@ function externals_run($argv, $argc){
$url = $r[0]['site_url'];
}
$attempts ++;
if($url) {
logger('externals: pulling public content from ' . $url, LOGGER_DEBUG);
$days = get_config('externals','since_days');
if($days === false)
$days = 15;
@ -40,7 +46,6 @@ function externals_run($argv, $argc){
$x = z_fetch_url($feedurl);
if(($x) && ($x['success'])) {
$total = 0;
$j = json_decode($x['body'],true);
if($j['success'] && $j['messages']) {
$sys = get_sys_channel();
@ -53,7 +58,7 @@ function externals_run($argv, $argc){
}
}
}
}
}
if (array_search(__file__,get_included_files())===0){