Allow cronjob.php to be called from web.

This commit is contained in:
Neck 2013-05-21 19:18:19 +01:00
parent 9f896babe5
commit 1bd79b27d6
1 changed files with 12 additions and 7 deletions

View File

@ -13,12 +13,17 @@ if (is_console()) {
$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 {
if ($update_interval !== null && $call_interval !== null && $limit === LIMIT_ALL && $update_interval >= $call_interval) {
$feeds_count = \PicoTools\singleton('db')->table('feeds')->count();
$limit = ceil($feeds_count / ($update_interval / $call_interval)); // compute new limit
}
Model\update_feeds($limit);
$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'];
}
if ($update_interval !== null && $call_interval !== null && $limit === LIMIT_ALL && $update_interval >= $call_interval) {
$feeds_count = \PicoTools\singleton('db')->table('feeds')->count();
$limit = ceil($feeds_count / ($update_interval / $call_interval)); // compute new limit
}
Model\update_feeds($limit);