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"),
2 => __("SimplePie"));
if (ENABLE_SIMPLEPIE) {
if (DEFAULT_UPDATE_METHOD == "1") {
$update_methods[0] .= ' (SimplePie)';
} else {
$update_methods[0] .= ' (Magpie)';

View File

@ -107,18 +107,10 @@
// Connection charset for MySQL. Only enable if having charset-related
// errors with MySQL (mangled characters, errors when updating feeds, etc).
define('ENABLE_SIMPLEPIE', false);
// Enables SimplePie RSS parsing library (experimental). When this option
// is disabled, Tiny Tiny RSS defaults to Magpie library.
// 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('DEFAULT_UPDATE_METHOD', 0);
// Which feed parsing library to use as default:
// 0 - Magpie
// 1 - SimplePie
define('SIMPLEPIE_CACHE_DIR', '/var/tmp/simplepie-ttrss-cache');
// Cache directory for RSS feeds when using SimplePie
@ -196,7 +188,7 @@
// intervals is disabled and all articles (which are not starred)
// 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
// 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_pass = db_fetch_result($result, 0, "auth_pass");
if (ALLOW_SELECT_UPDATE_METHOD) {
if (ENABLE_SIMPLEPIE) {
if (DEFAULT_UPDATE_METHOD == "1") {
$use_simplepie = $update_method != 1;
} else {
$use_simplepie = $update_method == 2;
}
} else {
$use_simplepie = ENABLE_SIMPLEPIE;
}
if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) {
_debug("use simplepie: $use_simplepie (feed setting: $update_method)\n");
@ -3961,7 +3957,7 @@
}
error_reporting(0);
if (ENABLE_SIMPLEPIE) {
if (DEFAULT_UPDATE_INTERVAL == "1") {
$rss = new SimplePie();
$rss->set_useragent(SIMPLEPIE_USERAGENT . MAGPIE_USER_AGENT_EXT);
// $rss->set_timeout(MAGPIE_FETCH_TIME_OUT);
@ -3975,7 +3971,7 @@
if ($rss) {
if (ENABLE_SIMPLEPIE) {
if (DEFAULT_UPDATE_METHOD == "1") {
$items = $rss->get_items();
} else {
$items = $rss->items;
@ -3990,7 +3986,7 @@
$latest_item = $items[0];
if (ENABLE_SIMPLEPIE) {
if (DEFAULT_UPDATE_METHOD == "1") {
$last_title = $latest_item->get_title();
} else {
$last_title = $latest_item["title"];
@ -3998,7 +3994,7 @@
$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());
$content = sanitize_rss($link, $latest_item->get_description());
} else {

View File

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

View File

@ -1,7 +1,7 @@
<?php
require_once "functions.php";
define('EXPECTED_CONFIG_VERSION', 18);
define('EXPECTED_CONFIG_VERSION', 19);
define('SCHEMA_VERSION', 66);
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) {
print "<b>Fatal Error</b>: $err_msg\n";
exit;