miniflux-legacy/producer.php

24 lines
615 B
PHP
Raw Normal View History

2016-05-02 04:03:21 +02:00
<?php
use Pheanstalk\Pheanstalk;
2016-08-25 03:17:58 +02:00
use Miniflux\Model;
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:32:50 +02:00
$options = getopt('', array(
'limit::',
));
$limit = ! empty($options['limit']) && ctype_digit($options['limit']) ? (int) $options['limit'] : Model\Feed\LIMIT_ALL;
2016-05-02 04:03:21 +02:00
$connection = new Pheanstalk(BEANSTALKD_HOST);
2016-05-02 04:32:50 +02:00
foreach (Model\Feed\get_ids($limit) as $feed_id) {
2016-05-02 04:03:21 +02:00
$connection
->useTube(BEANSTALKD_QUEUE)
->put($feed_id, Pheanstalk::DEFAULT_PRIORITY, Pheanstalk::DEFAULT_DELAY, BEANSTALKD_TTL);
}