Random profiles now moved away from "gcontact" as well
This commit is contained in:
parent
c03cf39c26
commit
bb1517a74c
|
@ -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 '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -205,27 +205,4 @@ class GContact
|
|||
/// @TODO Check all calling-findings of this function if they properly use DBA::isResult()
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a random, global contact of the current node
|
||||
*
|
||||
* @return string The profile URL
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getRandomUrl()
|
||||
{
|
||||
$r = DBA::selectFirst('gcontact', ['url'], [
|
||||
'`network` = ?
|
||||
AND NOT `failed`
|
||||
AND `updated` > ?',
|
||||
Protocol::DFRN,
|
||||
DateTimeFormat::utc('now - 1 month'),
|
||||
], ['order' => ['RAND()']]);
|
||||
|
||||
if (DBA::isResult($r)) {
|
||||
return $r['url'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ namespace Friendica\Module;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
|
||||
/**
|
||||
* Redirects to a random Friendica profile this node knows about
|
||||
|
@ -35,7 +34,7 @@ class RandomProfile extends BaseModule
|
|||
{
|
||||
$a = DI::app();
|
||||
|
||||
$contactUrl = GContact::getRandomUrl();
|
||||
$contactUrl = Contact::getRandomUrl();
|
||||
|
||||
if ($contactUrl) {
|
||||
$link = Contact::magicLink($contactUrl);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
{{* Additional links *}}
|
||||
<div class="side-link" id="side-match-link"><a href="match" >{{$nv.similar}}</a></div>
|
||||
<div class="side-link" id="side-suggest-link"><a href="suggest" >{{$nv.suggest}}</a></div>
|
||||
<div class="side-link" id="side-random-profile-link" ><a href="randprof" target="extlink" >{{$nv.random}}</a></div>
|
||||
|
||||
{{if $nv.inv}}
|
||||
<div class="side-link" id="side-invite-link" ><button type="button" class="btn-link" onclick="addToModal('invite'); return false;">{{$nv.inv}}</button></div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user