1
0
Fork 0

Merge pull request #11613 from annando/updated

Only update when new content arrives
This commit is contained in:
Hypolite Petovan 2022-06-06 09:15:58 -04:00 committed by GitHub
commit 90eeacde3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;