miniflux-legacy/worker.php

30 lines
831 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());
2016-12-27 03:49:53 +01:00
$start_time = microtime(true);
2016-12-27 03:49:53 +01:00
echo 'Processing feed_id=', $payload['feed_id'], ' for user_id=', $payload['user_id'];
Handler\Feed\update_feed($payload['user_id'], $payload['feed_id']);
Model\Item\autoflush_read($payload['user_id']);
Model\Item\autoflush_unread($payload['user_id']);
2016-05-17 03:58:56 +02:00
2016-12-27 03:49:53 +01:00
echo ', duration='.(microtime(true) - $start_time).' seconds', PHP_EOL;
Miniflux\Helper\write_debug_file();
2016-05-02 04:03:21 +02:00
$connection->delete($job);
}