initial attempt to remove mysql-related stuff from tt-rss

This commit is contained in:
Andrew Dolgov 2025-04-14 12:59:00 +03:00
parent 60606aaa97
commit b154bc7a10
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
159 changed files with 101 additions and 2089 deletions

View File

@ -95,7 +95,6 @@ ENV TTRSS_DB_TYPE="pgsql"
ENV TTRSS_DB_HOST="db"
ENV TTRSS_DB_PORT="5432"
ENV TTRSS_MYSQL_CHARSET="UTF8"
ENV TTRSS_PHP_EXECUTABLE="/usr/bin/php${PHP_SUFFIX}"
ENV TTRSS_PLUGINS="auth_internal, note, nginx_xaccel"

View File

@ -85,15 +85,13 @@ class Article extends Handler_Protected {
content = ?, content_hash = ? WHERE id = ?");
$sth->execute([$content, $content_hash, $ref_id]);
if (Config::get(Config::DB_TYPE) == "pgsql") {
$sth = $pdo->prepare("UPDATE ttrss_entries
SET tsvector_combined = to_tsvector( :ts_content)
WHERE id = :id");
$params = [
":ts_content" => mb_substr(\Soundasleep\Html2Text::convert($content), 0, 900000),
":id" => $ref_id];
$sth->execute($params);
}
$sth = $pdo->prepare("UPDATE ttrss_entries
SET tsvector_combined = to_tsvector( :ts_content)
WHERE id = :id");
$params = [
":ts_content" => mb_substr(\Soundasleep\Html2Text::convert($content), 0, 900000),
":id" => $ref_id];
$sth->execute($params);
$sth = $pdo->prepare("UPDATE ttrss_user_entries SET published = true,
last_published = NOW() WHERE
@ -130,15 +128,15 @@ class Article extends Handler_Protected {
if ($row = $sth->fetch()) {
$ref_id = $row["id"];
if (Config::get(Config::DB_TYPE) == "pgsql"){
$sth = $pdo->prepare("UPDATE ttrss_entries
SET tsvector_combined = to_tsvector( :ts_content)
WHERE id = :id");
$params = [
":ts_content" => mb_substr(\Soundasleep\Html2Text::convert($content), 0, 900000),
":id" => $ref_id];
$sth->execute($params);
}
$sth = $pdo->prepare("UPDATE ttrss_entries
SET tsvector_combined = to_tsvector( :ts_content)
WHERE id = :id");
$params = [
":ts_content" => mb_substr(\Soundasleep\Html2Text::convert($content), 0, 900000),
":id" => $ref_id];
$sth->execute($params);
$sth = $pdo->prepare("INSERT INTO ttrss_user_entries
(ref_id, uuid, feed_id, orig_feed_id, owner_uid, published, tag_cache, label_cache,
last_read, note, unread, last_published)
@ -465,16 +463,9 @@ class Article extends Handler_Protected {
static function _purge_orphans(): void {
// purge orphaned posts in main content table
if (Config::get(Config::DB_TYPE) == "mysql")
$limit_qpart = "LIMIT 5000";
else
$limit_qpart = "";
$pdo = Db::pdo();
$res = $pdo->query("DELETE FROM ttrss_entries WHERE
NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id) $limit_qpart");
NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id)");
if (Debug::enabled()) {
$rows = $res->rowCount();

View File

@ -24,7 +24,7 @@ class Config {
*
*/
/** database type: pgsql or mysql */
/** database type: pgsql */
const DB_TYPE = "DB_TYPE";
/** database server hostname */
@ -42,10 +42,6 @@ class Config {
/** database server port */
const DB_PORT = "DB_PORT";
/** connection charset for MySQL. if you have a legacy database and/or experience
* garbage unicode characters with this option, try setting it to a blank string. */
const MYSQL_CHARSET = "MYSQL_CHARSET";
/** this is a fallback falue for the CLI SAPI, it should be set to a fully-qualified tt-rss URL */
const SELF_URL_PATH = "SELF_URL_PATH";
@ -204,7 +200,6 @@ class Config {
Config::DB_NAME => [ "", Config::T_STRING ],
Config::DB_PASS => [ "", Config::T_STRING ],
Config::DB_PORT => [ "5432", Config::T_STRING ],
Config::MYSQL_CHARSET => [ "UTF8", Config::T_STRING ],
Config::SELF_URL_PATH => [ "https://example.com/tt-rss", Config::T_STRING ],
Config::SINGLE_USER_MODE => [ "", Config::T_BOOL ],
Config::SIMPLE_UPDATE_MODE => [ "", Config::T_BOOL ],
@ -481,25 +476,6 @@ class Config {
}
/* sanity check stuff */
/** checks for mysql tables not using InnoDB (tt-rss is incompatible with MyISAM)
* @return array<int, array<string, string>> A list of entries identifying tt-rss tables with bad config
*/
private static function check_mysql_tables() {
$pdo = Db::pdo();
$sth = $pdo->prepare("SELECT engine, table_name FROM information_schema.tables WHERE
table_schema = ? AND table_name LIKE 'ttrss_%' AND engine != 'InnoDB'");
$sth->execute([self::get(Config::DB_NAME)]);
$bad_tables = [];
while ($line = $sth->fetch()) {
array_push($bad_tables, $line);
}
return $bad_tables;
}
static function sanity_check(): void {
/*
@ -604,29 +580,6 @@ class Config {
}
}
if (self::get(Config::DB_TYPE) == "mysql") {
$bad_tables = self::check_mysql_tables();
if (count($bad_tables) > 0) {
$bad_tables_fmt = [];
foreach ($bad_tables as $bt) {
array_push($bad_tables_fmt, sprintf("%s (%s)", $bt['table_name'], $bt['engine']));
}
$msg = "<p>The following tables use an unsupported MySQL engine: <b>" .
implode(", ", $bad_tables_fmt) . "</b>.</p>";
$msg .= "<p>The only supported engine on MySQL is InnoDB. MyISAM lacks functionality to run
tt-rss.
Please backup your data (via OPML) and re-import the schema before continuing.</p>
<p><b>WARNING: importing the schema would mean LOSS OF ALL YOUR DATA.</b></p>";
array_push($errors, $msg);
}
}
if (count($errors) > 0 && php_sapi_name() != "cli") {
http_response_code(503); ?>

View File

@ -9,9 +9,6 @@ class Db {
ORM::configure('username', Config::get(Config::DB_USER));
ORM::configure('password', Config::get(Config::DB_PASS));
ORM::configure('return_result_sets', true);
if (Config::get(Config::DB_TYPE) == "mysql" && Config::get(Config::MYSQL_CHARSET)) {
ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . Config::get(Config::MYSQL_CHARSET)));
}
}
/**
@ -29,13 +26,8 @@ class Db {
public static function get_dsn(): string {
$db_port = Config::get(Config::DB_PORT) ? ';port=' . Config::get(Config::DB_PORT) : '';
$db_host = Config::get(Config::DB_HOST) ? ';host=' . Config::get(Config::DB_HOST) : '';
if (Config::get(Config::DB_TYPE) == "mysql" && Config::get(Config::MYSQL_CHARSET)) {
$db_charset = ';charset=' . Config::get(Config::MYSQL_CHARSET);
} else {
$db_charset = '';
}
return Config::get(Config::DB_TYPE) . ':dbname=' . Config::get(Config::DB_NAME) . $db_host . $db_port . $db_charset;
return Config::get(Config::DB_TYPE) . ':dbname=' . Config::get(Config::DB_NAME) . $db_host . $db_port;
}
// this really shouldn't be used unless a separate PDO connection is needed
@ -53,20 +45,10 @@ class Db {
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if (Config::get(Config::DB_TYPE) == "pgsql") {
$pdo->query("set client_encoding = 'UTF-8'");
$pdo->query("set datestyle = 'ISO, european'");
$pdo->query("set TIME ZONE 0");
$pdo->query("set cpu_tuple_cost = 0.5");
} else if (Config::get(Config::DB_TYPE) == "mysql") {
$pdo->query("SET time_zone = '+0:0'");
if (Config::get(Config::MYSQL_CHARSET)) {
$pdo->query("SET NAMES " . Config::get(Config::MYSQL_CHARSET));
}
}
$pdo->query("set client_encoding = 'UTF-8'");
$pdo->query("set datestyle = 'ISO, european'");
$pdo->query("set TIME ZONE 0");
$pdo->query("set cpu_tuple_cost = 0.5");
return $pdo;
}
@ -90,15 +72,12 @@ class Db {
}
public static function sql_random_function(): string {
if (Config::get(Config::DB_TYPE) == "mysql") {
return "RAND()";
}
return "RANDOM()";
}
/**
* Helper to build a query part comparing a field against a past datetime (determined by "$now - $some_interval")
*
*
* The example below could be read as "last_digest_sent is older than 1 day ago".
* ```php
* Db::past_comparison_qpart('last_digest_sent', '<', 1, 'day');
@ -106,7 +85,6 @@ class Db {
*
* @todo validate value of $unit and fail if invalid (or massage if practical)?
* @link https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT
* @link https://dev.mysql.com/doc/refman/9.2/en/expressions.html#temporal-intervals
* @param string $field the table field being checked
* @param '<'|'>'|'<='|'>='|'=' $operator the comparison operator
* @param positive-int $quantity the amount of $unit
@ -114,8 +92,6 @@ class Db {
* @return string the query part string
*/
static function past_comparison_qpart(string $field, string $operator, int $quantity, string $unit): string {
if (Config::get(Config::DB_TYPE) == 'pgsql')
return "$field $operator NOW() - INTERVAL '$quantity $unit' ";
return "$field $operator DATE_SUB(NOW(), INTERVAL $quantity $unit) ";
return "$field $operator NOW() - INTERVAL '$quantity $unit' ";
}
}

View File

@ -88,9 +88,7 @@ class Db_Migrations {
$lines = $this->get_lines($version);
if (count($lines) > 0) {
// mysql doesn't support transactions for DDL statements
if (Config::get(Config::DB_TYPE) != "mysql")
$this->pdo->beginTransaction();
$this->pdo->beginTransaction();
foreach ($lines as $line) {
Debug::log($line, Debug::LOG_EXTENDED);
@ -107,8 +105,7 @@ class Db_Migrations {
else
$this->set_version($version);
if (Config::get(Config::DB_TYPE) != "mysql")
$this->pdo->commit();
$this->pdo->commit();
Debug::log("Migration finished, current version: " . $this->get_version(), Debug::LOG_VERBOSE);

View File

@ -91,6 +91,7 @@ abstract class FeedItem_Common extends FeedItem {
$enclosures = $this->xpath->query("media:content", $this->elem);
/** @var DOMElement $enclosure */
foreach ($enclosures as $enclosure) {
$enc = new FeedEnclosure();
$enc->type = clean($enclosure->getAttribute('type'));
@ -143,6 +144,7 @@ abstract class FeedItem_Common extends FeedItem {
$enclosures = $this->xpath->query("media:thumbnail", $this->elem);
/** @var DOMElement $enclosure */
foreach ($enclosures as $enclosure) {
$enc = new FeedEnclosure();
$enc->type = 'image/generic';
@ -193,10 +195,6 @@ abstract class FeedItem_Common extends FeedItem {
$cat = preg_replace('/[,\'\"]/', "", $cat);
if (Config::get(Config::DB_TYPE) == "mysql") {
$cat = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $cat);
}
if (mb_strlen($cat) > 250)
$cat = mb_substr($cat, 0, 250);

View File

@ -217,17 +217,6 @@ class Feeds extends Handler_Protected {
$id = $line["id"];
// frontend doesn't expect pdo returning booleans as strings on mysql
if (Config::get(Config::DB_TYPE) == "mysql") {
foreach (["unread", "marked", "published"] as $k) {
if (is_integer($line[$k])) {
$line[$k] = $line[$k] === 1;
} else {
$line[$k] = $line[$k] === "1";
}
}
}
// normalize archived feed
if ($line['feed_id'] === null) {
$line['feed_id'] = Feeds::FEED_ARCHIVED;
@ -582,7 +571,7 @@ class Feeds extends Handler_Protected {
function search(): void {
print json_encode([
"show_language" => Config::get(Config::DB_TYPE) == "pgsql",
"show_language" => true,
"show_syntax_help" => count(PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEARCH)) == 0,
"all_languages" => Pref_Feeds::get_ts_languages(),
"default_language" => Prefs::get(Prefs::DEFAULT_SEARCH_LANGUAGE, $_SESSION['uid'], $_SESSION['profile'] ?? null)
@ -1407,18 +1396,16 @@ class Feeds extends Handler_Protected {
list($search_query_part, $search_words) = self::_search_to_sql($search, $search_language, $owner_uid, $profile);
}
if (Config::get(Config::DB_TYPE) == "pgsql") {
$test_sth = $pdo->prepare("select $search_query_part
FROM ttrss_entries, ttrss_user_entries WHERE id = ref_id limit 1");
$test_sth = $pdo->prepare("select $search_query_part
FROM ttrss_entries, ttrss_user_entries WHERE id = ref_id limit 1");
try {
$test_sth->execute();
} catch (PDOException $e) {
// looks like tsquery syntax is invalid
$search_query_part = "false";
try {
$test_sth->execute();
} catch (PDOException $e) {
// looks like tsquery syntax is invalid
$search_query_part = "false";
$query_error_override = T_sprintf("Incorrect search syntax: %s.", implode(" ", $search_words));
}
$query_error_override = T_sprintf("Incorrect search syntax: %s.", implode(" ", $search_words));
}
$search_query_part .= " AND ";
@ -1635,11 +1622,7 @@ class Feeds extends Handler_Protected {
$first_id = 0;
if (Config::get(Config::DB_TYPE) == "pgsql") {
$yyiw_qpart = "to_char(date_entered, 'IYYY-IW') AS yyiw";
} else {
$yyiw_qpart = "date_format(date_entered, '%Y-%u') AS yyiw";
}
$yyiw_qpart = "to_char(date_entered, 'IYYY-IW') AS yyiw";
if (is_numeric($feed)) {
// proper override_order applied above
@ -1679,12 +1662,8 @@ class Feeds extends Handler_Protected {
$sanity_interval_qpart = Db::past_comparison_qpart('date_entered', '>=', 1, 'hour') . ' AND ';
if (Config::get(Config::DB_TYPE) == "pgsql") {
$distinct_columns = str_replace("desc", "", strtolower($order_by));
$distinct_qpart = "DISTINCT ON (id, $distinct_columns)";
} else {
$distinct_qpart = "DISTINCT"; //fallback
}
$distinct_columns = str_replace("desc", "", strtolower($order_by));
$distinct_qpart = "DISTINCT ON (id, $distinct_columns)";
// except for Labels category
if (Prefs::get(Prefs::HEADLINES_NO_DISTINCT, $owner_uid, $profile)
@ -1785,12 +1764,8 @@ class Feeds extends Handler_Protected {
if (Prefs::get(Prefs::HEADLINES_NO_DISTINCT, $owner_uid, $profile)) {
$distinct_qpart = "";
} else {
if (Config::get(Config::DB_TYPE) == "pgsql") {
$distinct_columns = str_replace("desc", "", strtolower($order_by));
$distinct_qpart = "DISTINCT ON (id, $distinct_columns)";
} else {
$distinct_qpart = "DISTINCT"; //fallback
}
$distinct_columns = str_replace("desc", "", strtolower($order_by));
$distinct_qpart = "DISTINCT ON (id, $distinct_columns)";
}
$query = "SELECT $distinct_qpart
@ -2099,27 +2074,14 @@ class Feeds extends Handler_Protected {
else
$query_limit = "";
if (Config::get(Config::DB_TYPE) == "pgsql") {
$sth = $pdo->prepare("DELETE FROM ttrss_user_entries
USING ttrss_entries
WHERE ttrss_entries.id = ref_id AND
marked = false AND
feed_id = ? AND
$query_limit
ttrss_entries.date_updated < NOW() - INTERVAL '$purge_interval days'");
$sth->execute([$feed_id]);
} else {
$sth = $pdo->prepare("DELETE FROM ttrss_user_entries
USING ttrss_user_entries, ttrss_entries
WHERE ttrss_entries.id = ref_id AND
marked = false AND
feed_id = ? AND
$query_limit
ttrss_entries.date_updated < DATE_SUB(NOW(), INTERVAL $purge_interval DAY)");
$sth->execute([$feed_id]);
}
$sth = $pdo->prepare("DELETE FROM ttrss_user_entries
USING ttrss_entries
WHERE ttrss_entries.id = ref_id AND
marked = false AND
feed_id = ? AND
$query_limit
ttrss_entries.date_updated < NOW() - INTERVAL '$purge_interval days'");
$sth->execute([$feed_id]);
$rows_deleted = $sth->rowCount();
@ -2286,16 +2248,12 @@ class Feeds extends Handler_Protected {
$k = mb_strtolower($k);
if (Config::get(Config::DB_TYPE) == "pgsql") {
// A hacky way for phrases (e.g. "hello world") to get through PDO quoting.
// Term '"foo bar baz"' becomes '(foo <-> bar <-> baz)' ("<->" meaning "immediately followed by").
if (preg_match('/\s+/', $k))
$k = '(' . preg_replace('/\s+/', ' <-> ', $k) . ')';
// A hacky way for phrases (e.g. "hello world") to get through PDO quoting.
// Term '"foo bar baz"' becomes '(foo <-> bar <-> baz)' ("<->" meaning "immediately followed by").
if (preg_match('/\s+/', $k))
$k = '(' . preg_replace('/\s+/', ' <-> ', $k) . ')';
array_push($search_query_leftover, $not ? "!$k" : $k);
} else {
array_push($search_query_leftover, $not ? "-$k" : $k);
}
array_push($search_query_leftover, $not ? "!$k" : $k);
if (!$not) array_push($search_words, $k);
}
@ -2304,26 +2262,18 @@ class Feeds extends Handler_Protected {
if (count($search_query_leftover) > 0) {
if (Config::get(Config::DB_TYPE) == "pgsql") {
// if there's no joiners consider this a "simple" search and
// concatenate everything with &, otherwise don't try to mess with tsquery syntax
if (preg_match("/[&|]/", implode(" " , $search_query_leftover))) {
$tsquery = $pdo->quote(implode(" ", $search_query_leftover));
} else {
$tsquery = $pdo->quote(implode(" & ", $search_query_leftover));
}
$search_language = $pdo->quote(mb_strtolower($search_language ?: Prefs::get(Prefs::DEFAULT_SEARCH_LANGUAGE, $owner_uid, $profile)));
array_push($query_keywords,
"(tsvector_combined @@ to_tsquery($search_language, $tsquery))");
// if there's no joiners consider this a "simple" search and
// concatenate everything with &, otherwise don't try to mess with tsquery syntax
if (preg_match("/[&|]/", implode(" " , $search_query_leftover))) {
$tsquery = $pdo->quote(implode(" ", $search_query_leftover));
} else {
$ft_query = $pdo->quote(implode(" ", $search_query_leftover));
array_push($query_keywords,
"MATCH (ttrss_entries.title, ttrss_entries.content) AGAINST ($ft_query IN BOOLEAN MODE)");
$tsquery = $pdo->quote(implode(" & ", $search_query_leftover));
}
$search_language = $pdo->quote(mb_strtolower($search_language ?: Prefs::get(Prefs::DEFAULT_SEARCH_LANGUAGE, $owner_uid, $profile)));
array_push($query_keywords,
"(tsvector_combined @@ to_tsquery($search_language, $tsquery))");
}
if (count($query_keywords) > 0)

View File

@ -15,12 +15,8 @@ class Pref_Feeds extends Handler_Protected {
* @return array<int, string>
*/
public static function get_ts_languages(): array {
if (Config::get(Config::DB_TYPE) == 'pgsql') {
return array_map('ucfirst',
array_column(ORM::for_table('pg_ts_config')->select('cfgname')->find_array(), 'cfgname'));
}
return [];
return array_map('ucfirst',
array_column(ORM::for_table('pg_ts_config')->select('cfgname')->find_array(), 'cfgname'));
}
function renameCat(): void {
@ -597,7 +593,7 @@ class Pref_Feeds extends Handler_Protected {
"access_level" => $user->access_level
],
"lang" => [
"enabled" => Config::get(Config::DB_TYPE) == "pgsql",
"enabled" => true,
"default" => Prefs::get(Prefs::DEFAULT_SEARCH_LANGUAGE, $_SESSION['uid'], $profile),
"all" => $this::get_ts_languages(),
]
@ -653,13 +649,11 @@ class Pref_Feeds extends Handler_Protected {
</fieldset>
<?php } ?>
<?php if (Config::get(Config::DB_TYPE) == "pgsql") { ?>
<fieldset>
<label><?= __('Language:') ?></label>
<?= \Controls\select_tag("feed_language", "", $this::get_ts_languages(), ["disabled"=> 1]) ?>
<?= $this->_batch_toggle_checkbox("feed_language") ?>
</fieldset>
<?php } ?>
</section>
<hr/>
@ -1141,12 +1135,6 @@ class Pref_Feeds extends Handler_Protected {
function inactiveFeeds(): void {
if (Config::get(Config::DB_TYPE) == "pgsql") {
$interval_qpart = "NOW() - INTERVAL '3 months'";
} else {
$interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)";
}
$inactive_feeds = ORM::for_table('ttrss_feeds')
->table_alias('f')
->select_many('f.id', 'f.title', 'f.site_url', 'f.feed_url')
@ -1158,7 +1146,7 @@ class Pref_Feeds extends Handler_Protected {
"(SELECT MAX(ttrss_entries.updated)
FROM ttrss_entries
JOIN ttrss_user_entries ON ttrss_entries.id = ttrss_user_entries.ref_id
WHERE ttrss_user_entries.feed_id = f.id) < $interval_qpart")
WHERE ttrss_user_entries.feed_id = f.id) < NOW() - INTERVAL '3 months'")
->group_by('f.title')
->group_by('f.id')
->group_by('f.site_url')

View File

@ -591,10 +591,6 @@ class Pref_Prefs extends Handler_Protected {
continue;
}
if ($pref_name == Prefs::DEFAULT_SEARCH_LANGUAGE && Config::get(Config::DB_TYPE) != "pgsql") {
continue;
}
if (isset($prefs_available[$pref_name])) {
$item = $prefs_available[$pref_name];

View File

@ -252,33 +252,18 @@ class RPC extends Handler_Protected {
$default_interval = (int) Prefs::get_default(Prefs::DEFAULT_UPDATE_INTERVAL);
// Test if the feed need a update (update interval exceded).
if (Config::get(Config::DB_TYPE) == "pgsql") {
$update_limit_qpart = "AND ((
update_interval = 0
AND (p.value IS NULL OR p.value != '-1')
AND last_updated < NOW() - CAST((COALESCE(p.value, '$default_interval') || ' minutes') AS INTERVAL)
) OR (
update_interval > 0
AND last_updated < NOW() - CAST((update_interval || ' minutes') AS INTERVAL)
) OR (
update_interval >= 0
AND (p.value IS NULL OR p.value != '-1')
AND (last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL)
))";
} else {
$update_limit_qpart = "AND ((
update_interval = 0
AND (p.value IS NULL OR p.value != '-1')
AND last_updated < DATE_SUB(NOW(), INTERVAL CONVERT(COALESCE(p.value, '$default_interval'), SIGNED INTEGER) MINUTE)
) OR (
update_interval > 0
AND last_updated < DATE_SUB(NOW(), INTERVAL update_interval MINUTE)
) OR (
update_interval >= 0
AND (p.value IS NULL OR p.value != '-1')
AND (last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL)
))";
}
$update_limit_qpart = "AND ((
update_interval = 0
AND (p.value IS NULL OR p.value != '-1')
AND last_updated < NOW() - CAST((COALESCE(p.value, '$default_interval') || ' minutes') AS INTERVAL)
) OR (
update_interval > 0
AND last_updated < NOW() - CAST((update_interval || ' minutes') AS INTERVAL)
) OR (
update_interval >= 0
AND (p.value IS NULL OR p.value != '-1')
AND (last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL)
))";
// Test if feed is currently being updated by another process.
$updstart_thresh_qpart = 'AND (last_update_started IS NULL OR '

View File

@ -35,11 +35,6 @@ class RSSUtils {
return sha1(implode(",", $pluginhost->get_plugin_names()) . $tmp);
}
// Strips utf8mb4 characters (i.e. emoji) for mysql
static function strip_utf8mb4(string $str): string {
return preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $str);
}
static function cleanup_feed_browser(): void {
$pdo = Db::pdo();
$pdo->query("DELETE FROM ttrss_feedbrowser_cache");
@ -123,33 +118,18 @@ class RSSUtils {
$default_interval = (int) Prefs::get_default(Prefs::DEFAULT_UPDATE_INTERVAL);
if (Config::get(Config::DB_TYPE) == "pgsql") {
$update_limit_qpart = "AND ((
update_interval = 0
AND (p.value IS NULL OR p.value != '-1')
AND last_updated < NOW() - CAST((COALESCE(p.value, '$default_interval') || ' minutes') AS INTERVAL)
) OR (
update_interval > 0
AND last_updated < NOW() - CAST((update_interval || ' minutes') AS INTERVAL)
) OR (
update_interval >= 0
AND (p.value IS NULL OR p.value != '-1')
AND (last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL)
))";
} else {
$update_limit_qpart = "AND ((
update_interval = 0
AND (p.value IS NULL OR p.value != '-1')
AND last_updated < DATE_SUB(NOW(), INTERVAL CONVERT(COALESCE(p.value, '$default_interval'), SIGNED INTEGER) MINUTE)
) OR (
update_interval > 0
AND last_updated < DATE_SUB(NOW(), INTERVAL update_interval MINUTE)
) OR (
update_interval >= 0
AND (p.value IS NULL OR p.value != '-1')
AND (last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL)
))";
}
$update_limit_qpart = "AND ((
update_interval = 0
AND (p.value IS NULL OR p.value != '-1')
AND last_updated < NOW() - CAST((COALESCE(p.value, '$default_interval') || ' minutes') AS INTERVAL)
) OR (
update_interval > 0
AND last_updated < NOW() - CAST((update_interval || ' minutes') AS INTERVAL)
) OR (
update_interval >= 0
AND (p.value IS NULL OR p.value != '-1')
AND (last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL)
))";
// Test if feed is currently being updated by another process.
// TODO: Update RPC::updaterandomfeed_real() to also use 10 minutes?
@ -159,10 +139,7 @@ class RSSUtils {
$query_limit = $limit ? sprintf("LIMIT %d", $limit) : "";
// Update the least recently updated feeds first
$query_order = "ORDER BY last_updated";
if (Config::get(Config::DB_TYPE) == "pgsql")
$query_order .= " NULLS FIRST";
$query_order = "ORDER BY last_updated NULLS FIRST";
$query = "SELECT f.feed_url, f.last_updated
FROM
@ -856,15 +833,6 @@ class RSSUtils {
continue;
}
// Yet another episode of "mysql utf8_general_ci is gimped"
if (Config::get(Config::DB_TYPE) == "mysql" && Config::get(Config::MYSQL_CHARSET) != "UTF8MB4") {
foreach ((array)$e as $prop => $val) {
if (is_string($val)) {
$e->$prop = self::strip_utf8mb4($val);
}
}
}
array_push($enclosures, $e);
}
@ -935,16 +903,6 @@ class RSSUtils {
Debug::log("plugin data: {$entry_plugin_data}", Debug::LOG_VERBOSE);
// Workaround: 4-byte unicode requires utf8mb4 in MySQL. See https://tt-rss.org/forum/viewtopic.php?f=1&t=3377&p=20077#p20077
if (Config::get(Config::DB_TYPE) == "mysql" && Config::get(Config::MYSQL_CHARSET) != "UTF8MB4") {
foreach ($article as $k => $v) {
// i guess we'll have to take the risk of 4byte unicode labels & tags here
if (is_string($article[$k])) {
$article[$k] = self::strip_utf8mb4($v);
}
}
}
/* Collect article tags here so we could filter by them: */
$matched_rules = [];
@ -1186,14 +1144,9 @@ class RSSUtils {
Debug::log("resulting RID: $entry_ref_id, IID: $entry_int_id", Debug::LOG_VERBOSE);
if (Config::get(Config::DB_TYPE) == "pgsql")
$tsvector_qpart = "tsvector_combined = to_tsvector(:ts_lang, :ts_content),";
else
$tsvector_qpart = "";
$sth = $pdo->prepare("UPDATE ttrss_entries
SET title = :title,
$tsvector_qpart
tsvector_combined = to_tsvector(:ts_lang, :ts_content),
content = :content,
content_hash = :content_hash,
updated = :updated,
@ -1212,12 +1165,10 @@ class RSSUtils {
":plugin_data" => $entry_plugin_data,
":author" => "$entry_author",
":lang" => $entry_language,
":id" => $ref_id];
if (Config::get(Config::DB_TYPE) == "pgsql") {
$params[":ts_lang"] = $feed_language;
$params[":ts_content"] = mb_substr(strip_tags($entry_title) . " " . \Soundasleep\Html2Text::convert($entry_content), 0, 900000);
}
":id" => $ref_id,
":ts_lang" => $feed_language,
":ts_content" => mb_substr(strip_tags($entry_title) . " " . \Soundasleep\Html2Text::convert($entry_content), 0, 900000)
];
$sth->execute($params);

View File

@ -26,11 +26,7 @@
require_once "autoload.php";
if (Config::get(Config::DB_TYPE) == "pgsql") {
define('SUBSTRING_FOR_DATE', 'SUBSTRING_FOR_DATE');
} else {
define('SUBSTRING_FOR_DATE', 'SUBSTRING');
}
define('SUBSTRING_FOR_DATE', 'SUBSTRING_FOR_DATE');
/**
* @deprecated by Prefs::get()

View File

@ -1,12 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DIGEST_ENABLE', 1, 'false', 'Enable e-mail digest',1,
'This option enables sending daily digest of new (and unread) headlines on your configured e-mail address');
alter table ttrss_feeds add column include_in_digest bool;
update ttrss_feeds set include_in_digest = true;
alter table ttrss_feeds change include_in_digest include_in_digest bool not null;
alter table ttrss_feeds alter column include_in_digest set default true;
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('CONFIRM_FEED_CATCHUP', 1, 'true', 'Confirm marking feed as read',3);
update ttrss_version set schema_version = 10;

View File

@ -1,7 +0,0 @@
begin;
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_ENABLED_PLUGINS', 2, '', '', 1);
update ttrss_version set schema_version = 100;
commit;

View File

@ -1,12 +0,0 @@
begin;
create table ttrss_plugin_storage (
id integer not null auto_increment primary key,
name varchar(100) not null,
owner_uid integer not null,
content longtext not null,
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
update ttrss_version set schema_version = 101;
commit;

View File

@ -1,7 +0,0 @@
begin;
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_MOBILE_REVERSE_HEADLINES', 1, 'false', '', 1);
update ttrss_version set schema_version = 102;
commit;

View File

@ -1,7 +0,0 @@
begin;
alter table ttrss_entries add column plugin_data longtext;
update ttrss_version set schema_version = 103;
commit;

View File

@ -1,7 +0,0 @@
begin;
update ttrss_prefs set short_desc = 'Hide images in articles' where pref_name = 'STRIP_IMAGES';
update ttrss_version set schema_version = 104;
commit;

View File

@ -1,11 +0,0 @@
begin;
alter table ttrss_user_entries add column last_marked datetime;
alter table ttrss_user_entries add column last_published datetime;
update ttrss_user_entries set last_published = last_read where published = true;
update ttrss_user_entries set last_marked = last_read where marked = true;
update ttrss_version set schema_version = 105;
commit;

View File

@ -1,12 +0,0 @@
begin;
update ttrss_prefs set short_desc = 'Do not embed images in articles' where pref_name = 'STRIP_IMAGES';
alter table ttrss_feeds add column hide_images bool;
update ttrss_feeds set hide_images = false;
alter table ttrss_feeds change hide_images hide_images bool not null;
alter table ttrss_feeds alter column hide_images set default false;
update ttrss_version set schema_version = 106;
commit;

View File

@ -1,15 +0,0 @@
begin;
alter table ttrss_filters2 add column inverse bool;
update ttrss_filters2 set inverse = false;
alter table ttrss_filters2 change inverse inverse bool not null;
alter table ttrss_filters2 alter column inverse set default false;
alter table ttrss_filters2_rules add column inverse bool;
update ttrss_filters2_rules set inverse = false;
alter table ttrss_filters2_rules change inverse inverse bool not null;
alter table ttrss_filters2_rules alter column inverse set default false;
update ttrss_version set schema_version = 107;
commit;

View File

@ -1,7 +0,0 @@
begin;
update ttrss_prefs set def_value = 'false' where pref_name = 'SORT_HEADLINES_BY_FEED_DATE';
update ttrss_version set schema_version = 108;
commit;

View File

@ -1,7 +0,0 @@
begin;
update ttrss_prefs set short_desc = 'Hide feeds with no unread articles' where pref_name = 'HIDE_READ_FEEDS';
update ttrss_version set schema_version = 109;
commit;

View File

@ -1,18 +0,0 @@
begin;
delete FROM ttrss_user_prefs WHERE pref_name = 'DISPLAY_HEADER';
delete FROM ttrss_user_prefs WHERE pref_name = 'DISPLAY_FOOTER';
delete FROM ttrss_user_prefs WHERE pref_name = 'ENABLE_SEARCH_TOOLBAR';
delete FROM ttrss_user_prefs WHERE pref_name = 'USE_COMPACT_STYLESHEET';
delete FROM ttrss_prefs WHERE pref_name = 'DISPLAY_HEADER';
delete FROM ttrss_prefs WHERE pref_name = 'DISPLAY_FOOTER';
delete FROM ttrss_prefs WHERE pref_name = 'ENABLE_SEARCH_TOOLBAR';
delete FROM ttrss_prefs WHERE pref_name = 'USE_COMPACT_STYLESHEET';
insert into ttrss_themes (theme_name, theme_path) values ('Graycube', 'graycube');
insert into ttrss_themes (theme_name, theme_path) values ('Default (Compact)', 'compact');
update ttrss_version set schema_version = 11;
commit;

View File

@ -1,7 +0,0 @@
begin;
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('USER_CSS_THEME', 2, '', 'Select theme', 2, 'Select one of the available CSS themes');
update ttrss_version set schema_version = 110;
commit;

View File

@ -1,7 +0,0 @@
begin;
update ttrss_prefs set def_value = 'true' where pref_name = 'COMBINED_DISPLAY_MODE';
update ttrss_version set schema_version = 111;
commit;

View File

@ -1,15 +0,0 @@
begin;
alter table ttrss_filters2 add column order_id integer;
update ttrss_filters2 set order_id = 0;
alter table ttrss_filters2 change order_id order_id integer not null;
alter table ttrss_filters2 alter column order_id set default 0;
alter table ttrss_filters2 add column title varchar(250);
update ttrss_filters2 set title = '';
alter table ttrss_filters2 change title title varchar(250) not null;
alter table ttrss_filters2 alter column title set default '';
update ttrss_version set schema_version = 112;
commit;

View File

@ -1,8 +0,0 @@
begin;
insert into ttrss_filter_actions (id,name,description) values (8, 'stop',
'Stop / Do nothing');
update ttrss_version set schema_version = 113;
commit;

View File

@ -1,15 +0,0 @@
begin;
alter table ttrss_feeds add column view_settings varchar(250);
update ttrss_feeds set view_settings = '';
alter table ttrss_feeds change view_settings view_settings varchar(250) not null;
alter table ttrss_feeds alter column view_settings set default '';
alter table ttrss_feed_categories add column view_settings varchar(250);
update ttrss_feed_categories set view_settings = '';
alter table ttrss_feed_categories change view_settings view_settings varchar(250) not null;
alter table ttrss_feed_categories alter column view_settings set default '';
update ttrss_version set schema_version = 114;
commit;

View File

@ -1,9 +0,0 @@
begin;
alter table ttrss_prefs_sections drop column section_name;
alter table ttrss_prefs drop column short_desc;
alter table ttrss_prefs drop column help_text;
update ttrss_version set schema_version = 115;
commit;

View File

@ -1,7 +0,0 @@
begin;
update ttrss_prefs set def_value = 'false' where pref_name = 'ALLOW_DUPLICATE_POSTS';
update ttrss_version set schema_version = 116;
commit;

View File

@ -1,8 +0,0 @@
begin;
ALTER TABLE ttrss_feeds ADD COLUMN favicon_avg_color VARCHAR(11);
alter table ttrss_feeds alter column favicon_avg_color set default null;
update ttrss_version set schema_version = 117;
commit;

View File

@ -1,16 +0,0 @@
begin;
create table ttrss_error_log(
id integer not null auto_increment primary key,
owner_uid integer,
errno integer not null,
errstr text not null,
filename text not null,
lineno integer not null,
context text not null,
created_at datetime not null,
foreign key (owner_uid) references ttrss_users(id) ON DELETE SET NULL) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
update ttrss_version set schema_version = 118;
commit;

View File

@ -1,7 +0,0 @@
begin;
update ttrss_prefs set def_value = 'Automatic' where pref_name = 'USER_TIMEZONE';
update ttrss_version set schema_version = 119;
commit;

View File

@ -1,12 +0,0 @@
alter table ttrss_filters add column action_param varchar(200);
update ttrss_filters set action_param = '';
alter table ttrss_filters change action_param action_param varchar(200) not null;
alter table ttrss_filters alter column action_param set default '';
insert into ttrss_filter_actions (id,name,description) values (4, 'tag',
'Assign tags');
update ttrss_version set schema_version = 12;

View File

@ -1,7 +0,0 @@
begin;
insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('USER_LANGUAGE', 2, '', 2);
update ttrss_version set schema_version = 120;
commit;

View File

@ -1,7 +0,0 @@
begin;
update ttrss_prefs set def_value = 'false' where pref_name = 'AUTO_ASSIGN_LABELS';
update ttrss_version set schema_version = 121;
commit;

View File

@ -1,7 +0,0 @@
begin;
alter table ttrss_entries add column lang varchar(2);
update ttrss_version set schema_version = 122;
commit;

View File

@ -1,9 +0,0 @@
begin;
ALTER TABLE ttrss_counters_cache ENGINE=InnoDB DEFAULT CHARSET=UTF8;
ALTER TABLE ttrss_cat_counters_cache ENGINE=InnoDB DEFAULT CHARSET=UTF8;
ALTER TABLE ttrss_feedbrowser_cache ENGINE=InnoDB DEFAULT CHARSET=UTF8;
update ttrss_version set schema_version = 123;
commit;

View File

@ -1,8 +0,0 @@
begin;
alter table ttrss_users add column resetpass_token varchar(250);
alter table ttrss_users alter column resetpass_token set default null;
update ttrss_version set schema_version = 124;
commit;

View File

@ -1,10 +0,0 @@
begin;
alter table ttrss_users drop column resetpass_token;
alter table ttrss_users add column resetpass_token varchar(250);
alter table ttrss_users alter column resetpass_token set default null;
update ttrss_version set schema_version = 125;
commit;

View File

@ -1,8 +0,0 @@
begin;
alter table ttrss_enclosures add column width integer not null default 0;
alter table ttrss_enclosures add column height integer not null default 0;
update ttrss_version set schema_version = 126;
commit;

View File

@ -1,5 +0,0 @@
BEGIN;
UPDATE ttrss_version SET schema_version = 127;
COMMIT;

View File

@ -1,13 +0,0 @@
BEGIN;
update ttrss_feeds set last_updated = NULL;
alter table ttrss_feeds modify column last_updated datetime DEFAULT NULL;
alter table ttrss_feeds add column feed_language varchar(100);
update ttrss_feeds set feed_language = '';
alter table ttrss_feeds change feed_language feed_language varchar(100) not null;
alter table ttrss_feeds alter column feed_language set default '';
UPDATE ttrss_version SET schema_version = 128;
COMMIT;

View File

@ -1,8 +0,0 @@
BEGIN;
insert into ttrss_filter_actions (id,name,description) values (9, 'plugin',
'Invoke plugin');
UPDATE ttrss_version SET schema_version = 129;
COMMIT;

View File

@ -1,6 +0,0 @@
alter table ttrss_filters add column inverse bool;
update ttrss_filters set inverse = false;
alter table ttrss_filters change inverse inverse bool not null;
alter table ttrss_filters alter column inverse set default false;
update ttrss_version set schema_version = 13;

View File

@ -1,7 +0,0 @@
BEGIN;
alter table ttrss_feeds alter column last_updated set default null;
UPDATE ttrss_version SET schema_version = 130;
COMMIT;

View File

@ -1,7 +0,0 @@
BEGIN;
ALTER TABLE ttrss_filters2_rules ADD COLUMN match_on TEXT;
UPDATE ttrss_version SET schema_version = 131;
COMMIT;

View File

@ -1,10 +0,0 @@
begin;
alter table ttrss_feeds add column last_modified varchar(250);
update ttrss_feeds set last_modified = '';
alter table ttrss_feeds change last_modified last_modified varchar(250) not null;
alter table ttrss_feeds alter column last_modified set default '';
UPDATE ttrss_version SET schema_version = 132;
commit;

View File

@ -1,7 +0,0 @@
begin;
alter table ttrss_feeds add column last_unconditional datetime null;
UPDATE ttrss_version SET schema_version = 133;
commit;

View File

@ -1,7 +0,0 @@
BEGIN;
ALTER TABLE ttrss_filters2_rules MODIFY reg_exp text not null;
UPDATE ttrss_version SET schema_version = 134;
COMMIT;

View File

@ -1,8 +0,0 @@
begin;
alter table ttrss_filters2 add column last_triggered datetime;
alter table ttrss_filters2 alter column last_triggered set default null;
update ttrss_version set schema_version = 135;
commit;

View File

@ -1,9 +0,0 @@
begin;
alter table ttrss_archived_feeds add column created datetime;
update ttrss_archived_feeds set created = NOW();
alter table ttrss_archived_feeds change created created datetime not null;
update ttrss_version set schema_version = 136;
commit;

View File

@ -1,7 +0,0 @@
begin;
alter table ttrss_feeds add constraint ttrss_feeds_feed_url_owner_uid_key unique (feed_url(255), owner_uid);
update ttrss_version set schema_version = 137;
commit;

View File

@ -1,7 +0,0 @@
begin;
insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DEFAULT_SEARCH_LANGUAGE', 2, '', 2);
update ttrss_version set schema_version = 138;
commit;

View File

@ -1,13 +0,0 @@
begin;
create table ttrss_app_passwords (id integer not null primary key auto_increment,
title varchar(250) not null,
pwd_hash text not null,
service varchar(100) not null,
created datetime not null,
last_used datetime default null,
owner_uid integer not null references ttrss_users(id) on delete cascade) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
update ttrss_version set schema_version = 139;
commit;

View File

@ -1,4 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('CDM_AUTO_CATCHUP', 1, 'false', 'Mark articles as read automatically',2,
'This option enables marking articles as read automatically in combined mode while you scroll article list.');
update ttrss_version set schema_version = 14;

View File

@ -1,4 +0,0 @@
alter table ttrss_feeds add column last_successful_update datetime;
alter table ttrss_feeds alter column last_successful_update set default null;
update ttrss_version set schema_version = 140;

View File

@ -1,9 +0,0 @@
create table ttrss_user_prefs2 (
owner_uid integer not null,
pref_name varchar(250),
profile integer null,
value longtext not null,
foreign key (profile) references ttrss_settings_profiles(id) ON DELETE CASCADE,
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
update ttrss_version set schema_version = 141;

View File

@ -1,4 +0,0 @@
create index ttrss_user_labels2_article_id_idx on ttrss_user_labels2(article_id);
create index ttrss_user_labels2_label_id_idx on ttrss_user_labels2(label_id);
update ttrss_version set schema_version = 142;

View File

@ -1,2 +0,0 @@
alter table ttrss_users add column otp_secret varchar(250);
alter table ttrss_users alter column otp_secret set default null;

View File

@ -1,2 +0,0 @@
alter table ttrss_feeds add column favicon_is_custom boolean;
alter table ttrss_feeds alter column favicon_is_custom set default null;

View File

@ -1,2 +0,0 @@
alter table ttrss_users add column last_auth_attempt datetime;
alter table ttrss_users alter column last_auth_attempt set default null;

View File

@ -1,2 +0,0 @@
insert into ttrss_filter_actions (id,name,description) values (10, 'ignore-tag',
'Ignore tags');

View File

@ -1,2 +0,0 @@
create fulltext index ttrss_entries_title_search_idx on ttrss_entries(title);
create fulltext index ttrss_entries_combined_search_idx on ttrss_entries(title, content);

View File

@ -1 +0,0 @@

View File

@ -1,5 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_MODE', 2, 'adaptive', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_LIMIT', 3, '30', '', 1);
update ttrss_version set schema_version = 15;

View File

@ -1,6 +0,0 @@
alter table ttrss_feeds add column auth_pass_encrypted bool;
update ttrss_feeds set auth_pass_encrypted = false;
alter table ttrss_feeds change auth_pass_encrypted auth_pass_encrypted bool not null;
alter table ttrss_feeds alter column auth_pass_encrypted set default false;
update ttrss_version set schema_version = 16;

View File

@ -1,13 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_PREFS_ACTIVE_TAB', 2, '', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_INFOBOX_DISABLE_OVERLAY', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('STRIP_UNSAFE_TAGS', 1, 'true', 'Strip unsafe tags from articles', 3,
'Strip all but most common HTML tags when reading articles.');
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('BLACKLISTED_TAGS', 2, 'main, generic, misc', 'Blacklisted tags', 3,
'When auto-detecting tags in articles these tags will not be applied (comma-separated list).');
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_SEARCH_TOOLBAR', 1, 'false', 'Enable search toolbar',2);
update ttrss_version set schema_version = 17;

View File

@ -1,3 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_PREFS_ENABLE_PAGINATION', 2, '', '', 1);
update ttrss_version set schema_version = 18;

View File

@ -1,11 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_PREFS_PUBLISH_KEY', 2, '', '', 1);
alter table ttrss_user_entries add column published bool;
update ttrss_user_entries set published = false;
alter table ttrss_user_entries change published published bool not null;
alter table ttrss_user_entries alter column published set default false;
insert into ttrss_filter_actions (id,name,description) values (5, 'publish',
'Publish article');
update ttrss_version set schema_version = 19;

View File

@ -1,3 +0,0 @@
UPDATE ttrss_prefs SET help_text = 'This option is useful when you are reading several planet-type aggregators with partially colliding userbase. When disabled, it forces same posts from different feeds to appear only once.' WHERE pref_name = 'ALLOW_DUPLICATE_POSTS';
update ttrss_version set schema_version = 20;

View File

@ -1,3 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('FRESH_ARTICLE_MAX_AGE', 3, '24', 'Maximum age of fresh articles (in hours)',2);
update ttrss_version set schema_version = 21;

View File

@ -1,8 +0,0 @@
create index ttrss_entries_date_entered_index on ttrss_entries(date_entered);
alter table ttrss_feeds add column cache_images bool;
update ttrss_feeds set cache_images = false;
alter table ttrss_feeds change cache_images cache_images bool not null;
alter table ttrss_feeds alter column cache_images set default false;
update ttrss_version set schema_version = 22;

View File

@ -1,3 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DIGEST_CATCHUP', 1, 'false', 'Mark articles in e-mail digest as read',1);
update ttrss_version set schema_version = 23;

View File

@ -1,3 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('CDM_EXPANDED', 1, 'true', 'Automatically expand articles in combined mode',3);
update ttrss_version set schema_version = 24;

View File

@ -1,3 +0,0 @@
insert into ttrss_themes (theme_name, theme_path) values ('Three-pane', '3pane');
update ttrss_version set schema_version = 25;

View File

@ -1,15 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('PURGE_UNREAD_ARTICLES', 1, 'true', 'Purge unread articles',3);
alter table ttrss_users add column created datetime;
alter table ttrss_users alter column created set default null;
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
content_type varchar(250) not null,
post_id integer not null,
title text not null,
duration text not null,
index (post_id),
foreign key (post_id) references ttrss_entries(id) ON DELETE cascade);
update ttrss_version set schema_version = 26;

View File

@ -1,4 +0,0 @@
alter table ttrss_feeds add column last_viewed datetime;
alter table ttrss_feeds alter column last_viewed set default null;
update ttrss_version set schema_version = 27;

View File

@ -1,3 +0,0 @@
UPDATE ttrss_prefs SET def_value = 'main, generic, misc, uncategorized, blog, blogroll, general, news' WHERE pref_name = 'BLACKLISTED_TAGS';
update ttrss_version set schema_version = 28;

View File

@ -1,3 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_SHOWS_SPECIAL', 1, 'true', 'Show special feeds when hiding read feeds',3);
update ttrss_version set schema_version = 29;

View File

@ -1,43 +0,0 @@
begin;
alter table ttrss_entries add column num_comments integer;
update ttrss_entries set num_comments = 0;
alter table ttrss_entries change num_comments num_comments integer not null;
alter table ttrss_entries alter column num_comments set default 0;
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('COMBINED_DISPLAY_MODE', 1, 'false', 'Combined feed display',2,
'Display expanded list of feed articles, instead of separate displays for headlines and article content');
alter table ttrss_feed_categories add column collapsed bool;
update ttrss_feed_categories set collapsed = false;
alter table ttrss_feed_categories change collapsed collapsed bool not null;
alter table ttrss_feed_categories alter column collapsed set default 0;
alter table ttrss_feeds add column auth_login varchar(250);
alter table ttrss_feeds add column auth_pass varchar(250);
update ttrss_feeds set auth_login = '';
update ttrss_feeds set auth_pass = '';
alter table ttrss_feeds change auth_login auth_login varchar(250) not null;
alter table ttrss_feeds alter column auth_login set default '';
alter table ttrss_feeds change auth_pass auth_pass varchar(250) not null;
alter table ttrss_feeds alter column auth_pass set default '';
alter table ttrss_users add column email varchar(250);
update ttrss_users set email = '';
alter table ttrss_users change email email varchar(250) not null;
alter table ttrss_users alter column email set default '';
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_SEARCH_TOOLBAR', 1, 'false', 'Enable search toolbar',2);
update ttrss_version set schema_version = 3;
commit;

View File

@ -1,4 +0,0 @@
alter table ttrss_feeds add column last_update_started datetime;
alter table ttrss_feeds alter column last_update_started set default null;
update ttrss_version set schema_version = 30;

View File

@ -1,6 +0,0 @@
alter table ttrss_feeds add column update_method integer;
update ttrss_feeds set update_method = 0;
alter table ttrss_feeds change update_method update_method integer not null;
alter table ttrss_feeds alter column update_method set default 0;
update ttrss_version set schema_version = 31;

View File

@ -1,6 +0,0 @@
alter table ttrss_prefs add column access_level integer;
update ttrss_prefs set access_level = 0;
alter table ttrss_prefs change access_level access_level integer not null;
alter table ttrss_prefs alter column access_level set default 0;
update ttrss_version set schema_version = 32;

View File

@ -1,3 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('HIDE_FEEDLIST', 1, 'false', 'Hide feedlist',2, 'This option hides feedlist and allows it to be toggled on the fly, useful for small screens.');
update ttrss_version set schema_version = 33;

View File

@ -1,3 +0,0 @@
alter table ttrss_feeds change feed_url feed_url text not null;
update ttrss_version set schema_version = 34;

View File

@ -1 +0,0 @@
update ttrss_version set schema_version = 35;

View File

@ -1,9 +0,0 @@
alter table ttrss_user_entries add column score integer;
update ttrss_user_entries set score = 0;
alter table ttrss_user_entries change score score integer not null;
alter table ttrss_user_entries alter column score set default 0;
insert into ttrss_filter_actions (id,name,description) values (6, 'score',
'Modify score');
update ttrss_version set schema_version = 36;

View File

@ -1,4 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('VFEED_GROUP_BY_FEED', 1, 'false', 'Group headlines in virtual feeds',2,
'When this option is enabled, headlines in Special feeds and Labels are grouped by feeds');
update ttrss_version set schema_version = 37;

View File

@ -1,3 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('SYNC_COUNTERS', 1, 'false', 'Prefer more accurate feedlist counters to UI speed',3);
update ttrss_version set schema_version = 38;

View File

@ -1,5 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ENABLE_FLASH_PLAYER', 1, 'true', 'Enable inline MP3 player', 3, 'Enable the Flash-based XSPF Player to play MP3-format podcast enclosures.');
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('STRIP_IMAGES', 1, 'false', 'Do not show images in articles', 2);
update ttrss_version set schema_version = 39;

View File

@ -1,17 +0,0 @@
begin;
alter table ttrss_feeds add column parent_feed integer;
alter table ttrss_feeds add foreign key (parent_feed) references ttrss_feeds(id) on delete set null;
alter table ttrss_feeds add column private bool;
update ttrss_feeds set private = false;
alter table ttrss_feeds change private private bool not null;
alter table ttrss_feeds alter column private set default 0;
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2);
update ttrss_version set schema_version = 4;
commit;

View File

@ -1,3 +0,0 @@
update ttrss_prefs set short_desc = 'Enable feed icons' where pref_name = 'ENABLE_FEED_ICONS';
update ttrss_version set schema_version = 40;

View File

@ -1,6 +0,0 @@
alter table ttrss_feed_categories add column order_id integer;
update ttrss_feed_categories set order_id = 0;
alter table ttrss_feed_categories change order_id order_id integer not null;
alter table ttrss_feed_categories alter column order_id set default 0;
update ttrss_version set schema_version = 41;

View File

@ -1,3 +0,0 @@
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', '', 1);
update ttrss_version set schema_version = 42;

View File

@ -1,3 +0,0 @@
alter table ttrss_labels change sql_exp sql_exp text not null;
update ttrss_version set schema_version = 43;

View File

@ -1,9 +0,0 @@
create table ttrss_counters_cache (
feed_id integer not null,
owner_uid integer not null,
value integer not null default 0,
foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE,
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE
);
update ttrss_version set schema_version = 44;

View File

@ -1,3 +0,0 @@
update ttrss_prefs set help_text = 'This option enables marking articles as read automatically in combined mode (except for Fresh articles feed) while you scroll article list.' where pref_name = 'CDM_AUTO_CATCHUP';
update ttrss_version set schema_version = 45;

View File

@ -1,4 +0,0 @@
insert into ttrss_filter_types (id,name,description) values (5, 'date',
'Article Date');
update ttrss_version set schema_version = 46;

Some files were not shown because too many files have changed in this diff Show More