summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-06-30 12:57:11 +0400
committerAndrew Dolgov <[email protected]>2010-06-30 12:57:11 +0400
commit78a5c296ae8a1f5e54df496fbb42f50b639565cc (patch)
tree6bd71b193d8410a55e79b214c9ebe84ce0c00d10
parent442f326bc6230fbe6f8ca1dbfb774978e1b92bd3 (diff)
config: replace confusing option ENABLE_SIMPLEPIE with DEFAULT_UPDATE_METHOD; bump config version
-rw-r--r--backend.php2
-rw-r--r--config.php-dist18
-rw-r--r--functions.php18
-rw-r--r--modules/pref-feeds.php6
-rw-r--r--sanity_check.php11
5 files changed, 26 insertions, 29 deletions
diff --git a/backend.php b/backend.php
index 8ccc503af..38af31c1c 100644
--- a/backend.php
+++ b/backend.php
@@ -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)';
diff --git a/config.php-dist b/config.php-dist
index 58811646d..ea236ff56 100644
--- a/config.php-dist
+++ b/config.php-dist
@@ -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).
diff --git a/functions.php b/functions.php
index 4bf9cee4c..9bf2bcace 100644
--- a/functions.php
+++ b/functions.php
@@ -573,14 +573,10 @@
$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) {
- $use_simplepie = $update_method != 1;
- } else {
- $use_simplepie = $update_method == 2;
- }
+ if (DEFAULT_UPDATE_METHOD == "1") {
+ $use_simplepie = $update_method != 1;
} else {
- $use_simplepie = ENABLE_SIMPLEPIE;
+ $use_simplepie = $update_method == 2;
}
if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) {
@@ -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 {
diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php
index 74232a670..c0d436cec 100644
--- a/modules/pref-feeds.php
+++ b/modules/pref-feeds.php
@@ -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 = "";
diff --git a/sanity_check.php b/sanity_check.php
index d2f0e3177..b0d7477c7 100644
--- a/sanity_check.php
+++ b/sanity_check.php
@@ -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;