Only update when new content arrives
This commit is contained in:
parent
3f711b5301
commit
069c1d0b35
|
@ -38,6 +38,7 @@ use Friendica\Network\HTTPException;
|
|||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
function display_init(App $a)
|
||||
{
|
||||
|
@ -115,9 +116,9 @@ function display_init(App $a)
|
|||
if (\Friendica\Util\Network::isLocalLink($author['url'])) {
|
||||
\Friendica\Model\Profile::load(DI::app(), $author['nick'], false);
|
||||
} else {
|
||||
$a->setProfileOwner($item['uid']);
|
||||
DI::page()['aside'] = Widget\VCard::getHTML($author);
|
||||
}
|
||||
$a->setProfileOwner($item['uid']);
|
||||
}
|
||||
|
||||
function display_fetchauthor($item)
|
||||
|
@ -159,6 +160,16 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
}
|
||||
$parent_uri_id = $item['parent-uri-id'];
|
||||
}
|
||||
$browser_update = intval(DI::pConfig()->get($update_uid, 'system', 'update_interval'));
|
||||
if (!empty($browser_update)) {
|
||||
$update_date = date(DateTimeFormat::MYSQL, time() - ($browser_update / 500));
|
||||
if (!Post::exists(["`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parent_uri_id, 0, $update_uid, $update_date])) {
|
||||
Logger::debug('No updated content', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
|
||||
return '';
|
||||
} else {
|
||||
Logger::debug('Updated content found', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$uri_id = ((DI::args()->getArgc() > 2) ? DI::args()->getArgv()[2] : 0);
|
||||
$parent_uri_id = $uri_id;
|
||||
|
|
Loading…
Reference in a new issue