miniflux-legacy/cronjob.php

30 lines
1.1 KiB
PHP
Raw Normal View History

2013-02-18 03:48:21 +01:00
<?php
2013-05-21 12:25:13 +02:00
2013-02-18 03:48:21 +01:00
require 'common.php';
2013-05-21 12:25:13 +02:00
if (is_console()) {
2013-05-18 20:35:16 +02:00
$options = getopt('', array(
'limit::',
'call-interval::',
'update-interval::'
));
2013-05-21 12:25:13 +02:00
$limit = empty($options['limit']) ? LIMIT_ALL : (int)$options['limit'];
$update_interval = empty($options['update-interval']) ? null : (int)$options['update-interval'];
$call_interval = empty($options['call-interval']) ? null : (int)$options['call-interval'];
} else {
2013-05-18 20:35:16 +02:00
$limit = empty($_GET['limit']) ? LIMIT_ALL : (int)$_GET['limit'];
$update_interval = empty($_GET['update-interval']) ? null : (int)$_GET['update-interval'];
$call_interval = empty($_GET['call-interval']) ? null : (int)$_GET['call-interval'];
}
2013-05-18 20:35:16 +02:00
if ($update_interval !== null && $call_interval !== null && $limit === LIMIT_ALL && $update_interval >= $call_interval) {
2013-05-21 12:25:13 +02:00
$feeds_count = \PicoTools\singleton('db')->table('feeds')->count();
$limit = ceil($feeds_count / ($update_interval / $call_interval)); // compute new limit
2013-05-18 20:35:16 +02:00
}
Model\update_feeds($limit);