prune old suggested channels

This commit is contained in:
friendica 2013-08-05 20:15:33 -07:00
parent c2f97f7490
commit 8d2debca7e

View File

@ -326,9 +326,19 @@ function update_suggestions() {
if(! $url) if(! $url)
return; return;
$ret = z_fetch_url($url); $ret = z_fetch_url($url);
if($ret['success']) { if($ret['success']) {
// We will grab fresh data once a day via the poller. Remove anything over a week old because
// the targets may have changed their preferences and don't want to be suggested - and they
// may have simply gone away.
$r = q("delete from xlink where xlink_xchan = '' and xlink_updated < UTC_TIMESTAMP() - INTERVAL 7 DAY");
$j = json_decode($ret['body'],true); $j = json_decode($ret['body'],true);
if($j && $j['success']) { if($j && $j['success']) {
foreach($j['entries'] as $host) { foreach($j['entries'] as $host) {