Random profiles now moved away from "gcontact" as well

This commit is contained in:
Michael 2020-08-02 08:07:31 +00:00
parent c03cf39c26
commit bb1517a74c
4 changed files with 22 additions and 25 deletions

View file

@ -3259,4 +3259,24 @@ class Contact
$fields = ['failed' => false, 'last_contact' => DateTimeFormat::utcNow(), 'updated' => $last_updated];
DBA::update('contact', $fields, ['nurl' => Strings::normaliseLink($data['url'])]);
}
/**
* Returns a random, global contact of the current node
*
* @return string The profile URL
* @throws Exception
*/
public static function getRandomUrl()
{
$r = DBA::selectFirst('contact', ['url'], [
"`uid` = ? AND `network` = ? AND NOT `failed` AND `last-item` > ?",
0, Protocol::DFRN, DateTimeFormat::utc('now - 1 month'),
], ['order' => ['RAND()']]);
if (DBA::isResult($r)) {
return $r['url'];
}
return '';
}
}