mirror of
https://github.com/friendica/friendica
synced 2024-11-09 17:02:54 +00:00
Merge pull request #11613 from annando/updated
Only update when new content arrives
This commit is contained in:
commit
90eeacde3c
1 changed files with 12 additions and 1 deletions
|
@ -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