miniflux-legacy/worker.php

27 lines
727 B
PHP
Raw Normal View History

2016-05-02 04:03:21 +02:00
<?php
use Miniflux\Handler;
2016-08-25 03:17:58 +02:00
use Miniflux\Model;
use Pheanstalk\Pheanstalk;
2016-05-02 04:03:21 +02:00
2016-08-19 03:02:49 +02:00
require __DIR__.'/app/common.php';
2016-05-02 04:03:21 +02:00
if (php_sapi_name() !== 'cli') {
die('This script can run only from the command line.'.PHP_EOL);
}
2016-05-02 04:03:21 +02:00
$connection = new Pheanstalk(BEANSTALKD_HOST);
while ($job = $connection->reserveFromTube(BEANSTALKD_QUEUE)) {
$payload = unserialize($job->getData());
echo 'Processing feed_id=', $payload['feed_id'], ' for user_id=', $payload['user_id'],PHP_EOL;
Handler\Feed\update_feed($payload['user_id'], $payload['feed_id']);
Model\Item\autoflush_read($payload['user_id']);
Model\Item\autoflush_unread($payload['user_id']);
Miniflux\Helper\write_debug_file();
2016-05-17 03:58:56 +02:00
2016-05-02 04:03:21 +02:00
$connection->delete($job);
}