mirror of
https://github.com/friendica/friendica
synced 2025-04-25 14:30:10 +00:00
Moved functionality in new model class
This commit is contained in:
parent
5a1e1c1ec9
commit
61824119e4
4 changed files with 36 additions and 18 deletions
30
src/Model/PushSubscriber.php
Normal file
30
src/Model/PushSubscriber.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* @file src/Model/PushSubscriber.php
|
||||
*/
|
||||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\Core\Worker;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
class PushSubscriber
|
||||
{
|
||||
/**
|
||||
* @param string $priority Priority for push workers
|
||||
*/
|
||||
public static function publishFeed($priority = PRIORITY_HIGH)
|
||||
{
|
||||
// We'll push to each subscriber that has push > 0,
|
||||
// i.e. there has been an update (set in notifier.php).
|
||||
$subscribers = dba::select('push_subscriber', ['id', 'callback_url'], ["`push` > 0 AND `next_try` < UTC_TIMESTAMP()"]);
|
||||
|
||||
while ($subscriber = dba::fetch($subscribers)) {
|
||||
logger("Publish feed to " . $subscriber["callback_url"], LOGGER_DEBUG);
|
||||
Worker::add($priority, 'PubSubPublish', (int)$subscriber["id"]);
|
||||
}
|
||||
|
||||
dba::close($subscribers);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue