2013-02-18 03:48:21 +01:00
|
|
|
<?php
|
2013-05-21 12:25:13 +02:00
|
|
|
|
2014-02-08 20:13:14 +01:00
|
|
|
require __DIR__.'/common.php';
|
2013-02-18 03:48:21 +01:00
|
|
|
|
2013-05-22 13:13:56 +02:00
|
|
|
if (php_sapi_name() === 'cli') {
|
2013-05-21 12:25:13 +02:00
|
|
|
|
2013-05-18 20:35:16 +02:00
|
|
|
$options = getopt('', array(
|
|
|
|
'limit::',
|
|
|
|
'call-interval::',
|
2014-04-06 02:24:13 +02:00
|
|
|
'update-interval::',
|
|
|
|
'database::',
|
2013-05-18 20:35:16 +02:00
|
|
|
));
|
2013-05-22 13:13:56 +02:00
|
|
|
}
|
|
|
|
else {
|
2013-05-18 20:35:16 +02:00
|
|
|
|
2013-05-22 13:13:56 +02:00
|
|
|
$options = $_GET;
|
2013-05-21 20:18:19 +02:00
|
|
|
}
|
2013-05-18 20:35:16 +02:00
|
|
|
|
2014-04-06 02:24:13 +02:00
|
|
|
if (! empty($options['database'])) {
|
2015-01-17 19:35:59 +01:00
|
|
|
if (! Model\Database\select($options['database'])) {
|
|
|
|
die("Database ".$options['database']." not found\r\n");
|
|
|
|
}
|
2014-04-06 02:24:13 +02:00
|
|
|
}
|
|
|
|
|
2013-12-23 02:55:53 +01:00
|
|
|
$limit = ! empty($options['limit']) && ctype_digit($options['limit']) ? (int) $options['limit'] : Model\Feed\LIMIT_ALL;
|
2013-05-22 13:13:56 +02:00
|
|
|
$update_interval = ! empty($options['update-interval']) && ctype_digit($options['update-interval']) ? (int) $options['update-interval'] : null;
|
|
|
|
$call_interval = ! empty($options['call-interval']) && ctype_digit($options['call-interval']) ? (int) $options['call-interval'] : null;
|
|
|
|
|
2013-12-23 02:55:53 +01:00
|
|
|
if ($update_interval !== null && $call_interval !== null && $limit === Model\Feed\LIMIT_ALL && $update_interval >= $call_interval) {
|
2015-08-15 03:33:39 +02:00
|
|
|
$feeds_count = PicoDb\Database::getInstance('db')->table('feeds')->count();
|
2013-05-22 13:13:56 +02:00
|
|
|
$limit = ceil($feeds_count / ($update_interval / $call_interval));
|
2013-05-18 20:35:16 +02:00
|
|
|
}
|
2013-05-21 20:18:19 +02:00
|
|
|
|
2013-12-23 02:55:53 +01:00
|
|
|
Model\Feed\refresh_all($limit);
|
2014-12-16 02:38:35 +01:00
|
|
|
Model\Item\autoflush_read();
|
|
|
|
Model\Item\autoflush_unread();
|
2013-12-23 02:55:53 +01:00
|
|
|
Model\Config\write_debug();
|