config: replace confusing option ENABLE_SIMPLEPIE with DEFAULT_UPDATE_METHOD; bump config version

This commit is contained in:
Andrew Dolgov 2010-06-30 12:57:11 +04:00
parent 442f326bc6
commit 78a5c296ae
5 changed files with 26 additions and 29 deletions

View file

@ -138,7 +138,7 @@
1 => __("Magpie"), 1 => __("Magpie"),
2 => __("SimplePie")); 2 => __("SimplePie"));
if (ENABLE_SIMPLEPIE) { if (DEFAULT_UPDATE_METHOD == "1") {
$update_methods[0] .= ' (SimplePie)'; $update_methods[0] .= ' (SimplePie)';
} else { } else {
$update_methods[0] .= ' (Magpie)'; $update_methods[0] .= ' (Magpie)';

View file

@ -107,18 +107,10 @@
// Connection charset for MySQL. Only enable if having charset-related // Connection charset for MySQL. Only enable if having charset-related
// errors with MySQL (mangled characters, errors when updating feeds, etc). // errors with MySQL (mangled characters, errors when updating feeds, etc).
define('ENABLE_SIMPLEPIE', false); define('DEFAULT_UPDATE_METHOD', 0);
// Enables SimplePie RSS parsing library (experimental). When this option // Which feed parsing library to use as default:
// is disabled, Tiny Tiny RSS defaults to Magpie library. // 0 - Magpie
// 1 - SimplePie
// SimplePie is somewhat faster, more robust and less clunky as Magpie.
// While it doesn't internally support HTTP Digest authentication
// (required for Livejournal protected feeds and such) and SSL, it can
// support it when using CURL.
// To summarize, if your PHP has CURL extension or you aren't subscribed
// to any feeds using HTTP Digest authentication and Magpie XML parsing
// errors are bothering you too much, you can try enabling SimplePie.
define('SIMPLEPIE_CACHE_DIR', '/var/tmp/simplepie-ttrss-cache'); define('SIMPLEPIE_CACHE_DIR', '/var/tmp/simplepie-ttrss-cache');
// Cache directory for RSS feeds when using SimplePie // Cache directory for RSS feeds when using SimplePie
@ -196,7 +188,7 @@
// intervals is disabled and all articles (which are not starred) // intervals is disabled and all articles (which are not starred)
// older than this amount of days are purged. // older than this amount of days are purged.
define('CONFIG_VERSION', 18); define('CONFIG_VERSION', 19);
// Expected config version. Please update this option in config.php // Expected config version. Please update this option in config.php
// if necessary (after migrating all new options from this file). // if necessary (after migrating all new options from this file).

View file

@ -573,15 +573,11 @@
$auth_login = db_fetch_result($result, 0, "auth_login"); $auth_login = db_fetch_result($result, 0, "auth_login");
$auth_pass = db_fetch_result($result, 0, "auth_pass"); $auth_pass = db_fetch_result($result, 0, "auth_pass");
if (ALLOW_SELECT_UPDATE_METHOD) { if (DEFAULT_UPDATE_METHOD == "1") {
if (ENABLE_SIMPLEPIE) {
$use_simplepie = $update_method != 1; $use_simplepie = $update_method != 1;
} else { } else {
$use_simplepie = $update_method == 2; $use_simplepie = $update_method == 2;
} }
} else {
$use_simplepie = ENABLE_SIMPLEPIE;
}
if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) { if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) {
_debug("use simplepie: $use_simplepie (feed setting: $update_method)\n"); _debug("use simplepie: $use_simplepie (feed setting: $update_method)\n");
@ -3961,7 +3957,7 @@
} }
error_reporting(0); error_reporting(0);
if (ENABLE_SIMPLEPIE) { if (DEFAULT_UPDATE_INTERVAL == "1") {
$rss = new SimplePie(); $rss = new SimplePie();
$rss->set_useragent(SIMPLEPIE_USERAGENT . MAGPIE_USER_AGENT_EXT); $rss->set_useragent(SIMPLEPIE_USERAGENT . MAGPIE_USER_AGENT_EXT);
// $rss->set_timeout(MAGPIE_FETCH_TIME_OUT); // $rss->set_timeout(MAGPIE_FETCH_TIME_OUT);
@ -3975,7 +3971,7 @@
if ($rss) { if ($rss) {
if (ENABLE_SIMPLEPIE) { if (DEFAULT_UPDATE_METHOD == "1") {
$items = $rss->get_items(); $items = $rss->get_items();
} else { } else {
$items = $rss->items; $items = $rss->items;
@ -3990,7 +3986,7 @@
$latest_item = $items[0]; $latest_item = $items[0];
if (ENABLE_SIMPLEPIE) { if (DEFAULT_UPDATE_METHOD == "1") {
$last_title = $latest_item->get_title(); $last_title = $latest_item->get_title();
} else { } else {
$last_title = $latest_item["title"]; $last_title = $latest_item["title"];
@ -3998,7 +3994,7 @@
$latest_version = trim(preg_replace("/(Milestone)|(completed)/", "", $last_title)); $latest_version = trim(preg_replace("/(Milestone)|(completed)/", "", $last_title));
if (ENABLE_SIMPLEPIE) { if (DEFAULT_UPDATE_METHOD == "1") {
$release_url = sanitize_rss($link, $latest_item->get_link()); $release_url = sanitize_rss($link, $latest_item->get_link());
$content = sanitize_rss($link, $latest_item->get_description()); $content = sanitize_rss($link, $latest_item->get_description());
} else { } else {

View file

@ -413,7 +413,7 @@
$checked = ""; $checked = "";
} }
if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { if (SIMPLEPIE_CACHE_IMAGES) {
$disabled = ""; $disabled = "";
$label_class = ""; $label_class = "";
} else { } else {
@ -607,7 +607,7 @@
__('Cache images locally')."</label>"; __('Cache images locally')."</label>";
if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { if (SIMPLEPIE_CACHE_IMAGES) {
print "&nbsp;"; batch_edit_cbox("cache_images", "cache_images_l"); print "&nbsp;"; batch_edit_cbox("cache_images", "cache_images_l");
} }
@ -668,7 +668,7 @@
$parent_qpart = 'parent_feed = NULL'; $parent_qpart = 'parent_feed = NULL';
} }
if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) { if (SIMPLEPIE_CACHE_IMAGES) {
$cache_images_qpart = "cache_images = $cache_images,"; $cache_images_qpart = "cache_images = $cache_images,";
} else { } else {
$cache_images_qpart = ""; $cache_images_qpart = "";

View file

@ -1,7 +1,7 @@
<?php <?php
require_once "functions.php"; require_once "functions.php";
define('EXPECTED_CONFIG_VERSION', 18); define('EXPECTED_CONFIG_VERSION', 19);
define('SCHEMA_VERSION', 66); define('SCHEMA_VERSION', 66);
if (!file_exists("config.php")) { if (!file_exists("config.php")) {
@ -91,6 +91,15 @@
} }
if (defined('ENABLE_SIMPLEPIE')) {
$err_msg = "config: ENABLE_SIMPLEPIE is obsolete and replaced with DEFAULT_UPDATE_METHOD. Please adjust your config.php.";
}
if (!defined('DEFAULT_UPDATE_METHOD') || (DEFAULT_UPDATE_METHOD != 0 &&
DEFAULT_UPDATE_METHOD != 1)) {
$err_msg = "config: DEFAULT_UPDATE_METHOD should be either 0 or 1.";
}
if ($err_msg) { if ($err_msg) {
print "<b>Fatal Error</b>: $err_msg\n"; print "<b>Fatal Error</b>: $err_msg\n";
exit; exit;