deprecate RSS_BACKEND_TYPE

This commit is contained in:
Andrew Dolgov 2006-12-25 09:00:41 +01:00
parent be832a1a56
commit 49f9c92303
3 changed files with 22 additions and 104 deletions

View file

@ -9,9 +9,6 @@
define('DB_PASS', "XXXXXX"); define('DB_PASS', "XXXXXX");
//define('DB_PORT', '5432'); // when neeeded, PG-only //define('DB_PORT', '5432'); // when neeeded, PG-only
define('RSS_BACKEND_TYPE', "magpie");
// magpie (stable) or simplepie (EXPERIMENTAL!)
define('MAGPIE_FETCH_TIME_OUT', 60); define('MAGPIE_FETCH_TIME_OUT', 60);
// Magpie's default timeout is 5 seconds. Some RSS feeds, // Magpie's default timeout is 5 seconds. Some RSS feeds,
// such as from large Trac installs, can take significantly // such as from large Trac installs, can take significantly
@ -21,9 +18,6 @@
define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache'); define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache');
// Local cache directory for RSS feeds // Local cache directory for RSS feeds
define('SIMPLEPIE_CACHE_DIR', '/var/tmp/simplepie-ttrss-cache');
// Local cache directory for RSS feeds (simplepie)
define('WEB_DEMO_MODE', false); define('WEB_DEMO_MODE', false);
// Demo mode with reduced functionality. // Demo mode with reduced functionality.
// Warning: this option is obsolete. Don't rely on it being // Warning: this option is obsolete. Don't rely on it being

View file

@ -12,16 +12,12 @@
require_once 'errors.php'; require_once 'errors.php';
require_once 'version.php'; require_once 'version.php';
if (RSS_BACKEND_TYPE == "magpie") { define('MAGPIE_USER_AGENT_EXT', ' (Tiny Tiny RSS/' . VERSION . ')');
define('MAGPIE_USER_AGENT_EXT', ' (Tiny Tiny RSS/' . VERSION . ')');
require_once "magpierss/rss_fetch.inc";
require_once 'magpierss/rss_utils.inc';
} else if (RSS_BACKEND_TYPE == "simplepie") {
require_once 'simplepie/simplepie.inc';
}
define('MAGPIE_OUTPUT_ENCODING', 'UTF-8'); define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
require_once "magpierss/rss_fetch.inc";
require_once 'magpierss/rss_utils.inc';
function purge_feed($link, $feed_id, $purge_interval, $debug = false) { function purge_feed($link, $feed_id, $purge_interval, $debug = false) {
$rows = -1; $rows = -1;
@ -336,8 +332,6 @@
function update_rss_feed($link, $feed_url, $feed, $ignore_daemon = false) { function update_rss_feed($link, $feed_url, $feed, $ignore_daemon = false) {
if (WEB_DEMO_MODE) return;
if (DAEMON_REFRESH_ONLY && !$_GET["daemon"] && !$ignore_daemon) { if (DAEMON_REFRESH_ONLY && !$_GET["daemon"] && !$ignore_daemon) {
return; return;
} }
@ -366,31 +360,13 @@
} }
if (RSS_BACKEND_TYPE == "magpie") { error_reporting(0);
error_reporting(0); $rss = fetch_rss($fetch_url);
$rss = fetch_rss($fetch_url); error_reporting (DEFAULT_ERROR_LEVEL);
error_reporting (DEFAULT_ERROR_LEVEL);
} else if (RSS_BACKEND_TYPE == "simplepie") {
if (!file_exists(SIMPLEPIE_CACHE_DIR)) {
mkdir(SIMPLEPIE_CACHE_DIR);
}
$rss = new SimplePie();
$rss->feed_url($fetch_url);
$rss->cache_location(SIMPLEPIE_CACHE_DIR);
$rss->init();
}
$feed = db_escape_string($feed); $feed = db_escape_string($feed);
$rss_check = $rss; if ($rss) {
if (RSS_BACKEND_TYPE == "simplepie") {
$rss_check = $rss->data;
}
if ($rss_check) {
// db_query($link, "BEGIN"); // db_query($link, "BEGIN");
@ -409,23 +385,15 @@
if (!$registered_title || $registered_title == "[Unknown]") { if (!$registered_title || $registered_title == "[Unknown]") {
if (RSS_BACKEND_TYPE == "magpie") { $feed_title = db_escape_string($rss->channel["title"]);
$feed_title = db_escape_string($rss->channel["title"]);
} else {
$feed_title = $rss->get_feed_title();
}
db_query($link, "UPDATE ttrss_feeds SET db_query($link, "UPDATE ttrss_feeds SET
title = '$feed_title' WHERE id = '$feed'"); title = '$feed_title' WHERE id = '$feed'");
} }
if (RSS_BACKEND_TYPE == "magpie") { $site_url = $rss->channel["link"];
$site_url = $rss->channel["link"]; // weird, weird Magpie
// weird, weird Magpie if (!$site_url) $site_url = db_escape_string($rss->channel["link_"]);
if (!$site_url) $site_url = db_escape_string($rss->channel["link_"]);
} else {
$site_url = $rss->get_feed_link();
}
if ($site_url && $orig_site_url != db_escape_string($site_url)) { if ($site_url && $orig_site_url != db_escape_string($site_url)) {
db_query($link, "UPDATE ttrss_feeds SET db_query($link, "UPDATE ttrss_feeds SET
@ -434,11 +402,7 @@
// print "I: " . $rss->channel["image"]["url"]; // print "I: " . $rss->channel["image"]["url"];
if (RSS_BACKEND_TYPE == "magpie") { $icon_url = $rss->image["url"];
$icon_url = $rss->image["url"];
} else {
$icon_url = $rss->get_image_url(); # FIXME
}
if ($icon_url && !$orig_icon_url != db_escape_string($icon_url)) { if ($icon_url && !$orig_icon_url != db_escape_string($icon_url)) {
$icon_url = db_escape_string($icon_url); $icon_url = db_escape_string($icon_url);
@ -469,15 +433,10 @@
array_push($filters[$line["name"]], $filter); array_push($filters[$line["name"]], $filter);
} }
if (RSS_BACKEND_TYPE == "magpie") { $iterator = $rss->items;
$iterator = $rss->items;
if (!$iterator || !is_array($iterator)) $iterator = $rss->entries; if (!$iterator || !is_array($iterator)) $iterator = $rss->entries;
if (!$iterator || !is_array($iterator)) $iterator = $rss; if (!$iterator || !is_array($iterator)) $iterator = $rss;
} else {
$iterator = $rss->get_items();
}
if (!is_array($iterator)) { if (!is_array($iterator)) {
/* db_query($link, "UPDATE ttrss_feeds /* db_query($link, "UPDATE ttrss_feeds

View file

@ -9,45 +9,16 @@
require_once "config.php"; require_once "config.php";
if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
print _("<b>Fatal Error</b>: Your configuration file has
wrong version. Please copy new options from <b>config.php-dist</b> and
update CONFIG_VERSION directive.\n");
exit;
}
if (!defined('RSS_BACKEND_TYPE')) {
print _("<b>Fatal error</b>: RSS backend type is not defined
(config variable <b>RSS_BACKEND_TYPE</b>) - please check your
configuration file.\n");
exit;
}
if (RSS_BACKEND_TYPE == "magpie" && !file_exists("magpierss/rss_fetch.inc")) {
print _("<b>Fatal Error</b>: You forgot to place
<a href=\"http://magpierss.sourceforge.net\">MagpieRSS</a>
distribution in <b>magpierss/</b>
subdirectory of TT-RSS tree.\n");
exit;
}
if (RSS_BACKEND_TYPE == "simplepie" && !file_exists("simplepie/simplepie.inc")) {
print _("<b>Fatal Error</b>: You forgot to place
<a href=\"http://simplepie.org\">SimplePie</a>
distribution in <b>simplepie/</b>
subdirectory of TT-RSS tree.\n");
exit;
}
if (RSS_BACKEND_TYPE != "simplepie" && RSS_BACKEND_TYPE != "magpie") {
print _("<b>Fatal Error</b>: Invalid RSS_BACKEND_TYPE\n");
exit;
}
if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) { if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
return _("config: your config file version is incorrect. See config.php-dist.\n"); return _("config: your config file version is incorrect. See config.php-dist.\n");
} }
if (defined('RSS_BACKEND_TYPE')) {
print _("<b>Fatal error</b>: RSS_BACKEND_TYPE is deprecated. Please remove this
option from config.php\n");
exit;
}
if (file_exists("xml-export.php") || file_exists("xml-import.php")) { if (file_exists("xml-export.php") || file_exists("xml-import.php")) {
print _("<b>Fatal Error</b>: XML Import/Export tools (<b>xml-export.php</b> print _("<b>Fatal Error</b>: XML Import/Export tools (<b>xml-export.php</b>
and <b>xml-import.php</b>) could be used maliciously. Please remove them and <b>xml-import.php</b>) could be used maliciously. Please remove them
@ -55,12 +26,6 @@
exit; exit;
} }
if (RSS_BACKEND_TYPE != "magpie") {
print _("<b>Fatal Error</b>: RSS backends other than magpie are not
supported now.\n");
exit;
}
if (SINGLE_USER_MODE && DAEMON_UPDATE_LOGIN_LIMIT > 0) { if (SINGLE_USER_MODE && DAEMON_UPDATE_LOGIN_LIMIT > 0) {
print _("<b>Fatal Error</b>: Please set DAEMON_UPDATE_LOGIN_LIMIT print _("<b>Fatal Error</b>: Please set DAEMON_UPDATE_LOGIN_LIMIT
to 0 in single user mode.\n"); to 0 in single user mode.\n");