From de696427ad56edeb2dd982e41eda1e6e43e1062c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 11 Feb 2006 14:52:17 +0100 Subject: [PATCH] initial work on update daemon --- backend.php | 2 +- config.php-dist | 6 +++- db-prefs.php | 10 +++--- schema/ttrss_schema_mysql.sql | 9 ++++- schema/ttrss_schema_pgsql.sql | 7 +++- update_daemon.php | 65 +++++++++++++++++++++++++++++++++++ update_feeds.php | 2 ++ 7 files changed, 93 insertions(+), 8 deletions(-) create mode 100644 update_daemon.php diff --git a/backend.php b/backend.php index 3ba723d2..55f2fa99 100644 --- a/backend.php +++ b/backend.php @@ -1,6 +1,6 @@ diff --git a/db-prefs.php b/db-prefs.php index 1b6262d9..80d890fb 100644 --- a/db-prefs.php +++ b/db-prefs.php @@ -2,10 +2,12 @@ require_once "config.php"; require_once "db.php"; - session_start(); - - if (!$_SESSION["prefs_cache"]) - $_SESSION["prefs_cache"] = array(); + if (! DISABLE_SESSIONS) { + session_start(); + + if (!$_SESSION["prefs_cache"]) + $_SESSION["prefs_cache"] = array(); + } function get_pref($link, $pref_name, $user_id = false) { diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql index 8b62cd83..8bfd4886 100644 --- a/schema/ttrss_schema_mysql.sql +++ b/schema/ttrss_schema_mysql.sql @@ -170,7 +170,7 @@ create table ttrss_tags (id integer primary key auto_increment, create table ttrss_version (schema_version int not null) TYPE=InnoDB; -insert into ttrss_version values (4); +insert into ttrss_version values (5); create table ttrss_prefs_types (id integer not null primary key, type_name varchar(100) not null) TYPE=InnoDB; @@ -246,4 +246,11 @@ create table ttrss_user_prefs ( index (pref_name), foreign key (pref_name) references ttrss_prefs(pref_name) ON DELETE CASCADE) TYPE=InnoDB; +create table ttrss_scheduled_updates (id integer not null primary key auto_increment, + owner_uid integer not null, + feed_id integer default null, + entered datetime not null, + foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE, + foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE) TYPE=InnoDB; + commit; diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql index a0d570d3..d948fa56 100644 --- a/schema/ttrss_schema_pgsql.sql +++ b/schema/ttrss_schema_pgsql.sql @@ -152,7 +152,7 @@ create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid); create table ttrss_version (schema_version int not null); -insert into ttrss_version values (4); +insert into ttrss_version values (5); create table ttrss_prefs_types (id integer not null primary key, type_name varchar(100) not null); @@ -223,4 +223,9 @@ create table ttrss_user_prefs ( create index ttrss_user_prefs_owner_uid_index on ttrss_user_prefs(owner_uid); create index ttrss_user_prefs_value_index on ttrss_user_prefs(value); +create table ttrss_scheduled_updates (id serial not null primary key, + owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE, + feed_id integer default null references ttrss_feeds(id) ON DELETE CASCADE, + entered timestamp not null default NOW()); + commit; diff --git a/update_daemon.php b/update_daemon.php new file mode 100644 index 00000000..4f30cb53 --- /dev/null +++ b/update_daemon.php @@ -0,0 +1,65 @@ +#!/usr/bin/php4 + ($upd_intl * 60))) { + + print "Updating...\n"; + + update_rss_feed($link, $line["feed_url"], $line["id"], true); + + } + } + + sleep(SLEEP_INTERVAL); + + db_close($link); + +?> diff --git a/update_feeds.php b/update_feeds.php index b2836a44..31e3a128 100644 --- a/update_feeds.php +++ b/update_feeds.php @@ -4,6 +4,8 @@ // directory defined in config.php won't be accessible define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache-cli'); + define('DISABLE_SESSIONS', true); + require_once "sanity_check.php"; require_once "config.php"; require_once "db.php"; -- 2.39.5