Minors cleanup
This commit is contained in:
parent
11e4703d20
commit
d21b061b95
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
|||||||
update*
|
update*
|
||||||
make-archive.sh
|
make-archive.sh
|
||||||
*.sqlite
|
*.sqlite
|
||||||
*.db
|
|
@ -69,26 +69,25 @@ FAQ
|
|||||||
|
|
||||||
You just need to be inside the directory `miniflux` and run the script `cronjob.php`.
|
You just need to be inside the directory `miniflux` and run the script `cronjob.php`.
|
||||||
|
|
||||||
Prameters | Type | Value
|
Parameters | Type | Value
|
||||||
-------------------|--------------------------------|-----------------------------
|
--------------------|--------------------------------|-----------------------------
|
||||||
--limit | optional | time in minutes
|
--limit | optional | time in minutes
|
||||||
--call-interval | optional, exclude by --limit, requires --update-interval |time in minutes < update inteval time
|
--call-interval | optional, excluded by --limit, require --update-interval | time in minutes < update interval time
|
||||||
--update-interval | optional, exclude by --limit, requires --call-interval |time in minutes >= call interval time
|
--update-interval | optional, excluded by --limit, require --call-interval | time in minutes >= call interval time
|
||||||
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
crontab -e
|
crontab -e
|
||||||
|
|
||||||
|
# Update all feeds
|
||||||
0 */4 * * * cd /path/to/miniflux && php cronjob.php >/dev/null 2>&1
|
0 */4 * * * cd /path/to/miniflux && php cronjob.php >/dev/null 2>&1
|
||||||
|
|
||||||
# Updates the 10 oldest feeds each time
|
# Update the 10 oldest feeds each time
|
||||||
|
|
||||||
0 */4 * * * cd /path/to/miniflux && php cronjob.php --limit=10 >/dev/null 2>&1
|
0 */4 * * * cd /path/to/miniflux && php cronjob.php --limit=10 >/dev/null 2>&1
|
||||||
|
|
||||||
# Updates all feeds in 60mn (updates the 8 oldest feeds each time with a total of 120 feeds).
|
# Update all feeds in 60 minutes (updates the 8 oldest feeds each time with a total of 120 feeds).
|
||||||
|
* */4 * * * cd /path/to/miniflux && php cronjob.php --call-interval=4 --update-interval=60 >/dev/null 2>&1
|
||||||
0 */4 * * * cd /path/to/miniflux && php cronjob.php --call-interval=4 --update-interval=60 >/dev/null 2>&1
|
|
||||||
|
|
||||||
### How Miniflux update my feeds from the user interface?
|
### How Miniflux update my feeds from the user interface?
|
||||||
|
|
||||||
|
@ -16,16 +16,19 @@ const APP_USERAGENT = 'Miniflux - http://miniflux.net';
|
|||||||
const HTTP_TIMEOUT = 5;
|
const HTTP_TIMEOUT = 5;
|
||||||
const LIMIT_ALL = -1;
|
const LIMIT_ALL = -1;
|
||||||
|
|
||||||
|
|
||||||
function get_db_filename()
|
function get_db_filename()
|
||||||
{
|
{
|
||||||
return 'data/db.sqlite';
|
return 'data/db.sqlite';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function is_console()
|
function is_console()
|
||||||
{
|
{
|
||||||
return php_sapi_name() === 'cli';
|
return php_sapi_name() === 'cli';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PicoTools\container('db', function() {
|
PicoTools\container('db', function() {
|
||||||
|
|
||||||
$db = new PicoDb\Database(array(
|
$db = new PicoDb\Database(array(
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require 'common.php';
|
require 'common.php';
|
||||||
|
|
||||||
if (is_console()) {
|
if (is_console()) {
|
||||||
|
|
||||||
$options = getopt('', array(
|
$options = getopt('', array(
|
||||||
'limit::',
|
'limit::',
|
||||||
'call-interval::',
|
'call-interval::',
|
||||||
|
@ -107,6 +107,7 @@ function import_feed($url)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function update_feeds($limit = LIMIT_ALL)
|
function update_feeds($limit = LIMIT_ALL)
|
||||||
{
|
{
|
||||||
$feeds_id = get_feeds_id($limit);
|
$feeds_id = get_feeds_id($limit);
|
||||||
@ -135,6 +136,7 @@ function update_feed($feed_id)
|
|||||||
APP_USERAGENT
|
APP_USERAGENT
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Update the `last_checked` column each time, HTTP cache or not
|
||||||
update_feed_last_checked($feed_id);
|
update_feed_last_checked($feed_id);
|
||||||
|
|
||||||
if (! $resource->isModified()) {
|
if (! $resource->isModified()) {
|
||||||
@ -172,7 +174,6 @@ function get_feeds_id($limit = LIMIT_ALL)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $table_feeds->listing('id', 'id');
|
return $table_feeds->listing('id', 'id');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -193,15 +194,18 @@ function get_feed($feed_id)
|
|||||||
->findOne();
|
->findOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_feed_last_checked($feed_id) {
|
|
||||||
|
function update_feed_last_checked($feed_id)
|
||||||
|
{
|
||||||
\PicoTools\singleton('db')
|
\PicoTools\singleton('db')
|
||||||
->table('feeds')
|
->table('feeds')
|
||||||
->eq('id', $feed_id)
|
->eq('id', $feed_id)
|
||||||
->save(array(
|
->save(array(
|
||||||
'last_checked' => time(),
|
'last_checked' => time()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function update_feed_cache_infos($feed_id, $last_modified, $etag)
|
function update_feed_cache_infos($feed_id, $last_modified, $etag)
|
||||||
{
|
{
|
||||||
\PicoTools\singleton('db')
|
\PicoTools\singleton('db')
|
||||||
@ -209,8 +213,7 @@ function update_feed_cache_infos($feed_id, $last_modified, $etag)
|
|||||||
->eq('id', $feed_id)
|
->eq('id', $feed_id)
|
||||||
->save(array(
|
->save(array(
|
||||||
'last_modified' => $last_modified,
|
'last_modified' => $last_modified,
|
||||||
'etag' => $etag,
|
'etag' => $etag
|
||||||
'last_checked' => time(),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,13 @@
|
|||||||
|
|
||||||
namespace Schema;
|
namespace Schema;
|
||||||
|
|
||||||
|
|
||||||
function version_5($pdo)
|
function version_5($pdo)
|
||||||
{
|
{
|
||||||
$pdo->exec('ALTER TABLE feeds ADD COLUMN last_checked INTEGER');
|
$pdo->exec('ALTER TABLE feeds ADD COLUMN last_checked INTEGER');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function version_4($pdo)
|
function version_4($pdo)
|
||||||
{
|
{
|
||||||
$pdo->exec("CREATE INDEX idx_status ON items(status)");
|
$pdo->exec("CREATE INDEX idx_status ON items(status)");
|
||||||
|
Loading…
Reference in New Issue
Block a user