miniflux-legacy/producer.php
Frederic Guillot 82df35a59b Change the database structure to have a single database
This is a major change for the next release of Miniflux.

- There is now only one database that can supports multiple users
- There is no automated schema migration for this release
- A migration procedure is available in the ChangeLog file
2016-12-26 09:51:38 -05:00

32 lines
750 B
PHP

<?php
use Pheanstalk\Pheanstalk;
use Miniflux\Model;
require __DIR__.'/app/common.php';
if (php_sapi_name() !== 'cli') {
die('This script can run only from the command line.'.PHP_EOL);
}
$options = getopt('', array(
'limit::',
));
$limit = get_cli_option('limit', $options);
$connection = new Pheanstalk(BEANSTALKD_HOST);
foreach (Model\User\get_all_users() as $user) {
foreach (Model\Feed\get_feed_ids($user['id'], $limit) as $feed_id) {
$payload = serialize(array(
'feed_id' => $feed_id,
'user_id' => $user['id'],
));
$connection
->useTube(BEANSTALKD_QUEUE)
->put($payload, Pheanstalk::DEFAULT_PRIORITY, Pheanstalk::DEFAULT_DELAY, BEANSTALKD_TTL);
}
}