mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-08-06 06:07:29 +02:00
Deprecate and remove use of the 'SUBSTRING_FOR_DATE' constant.
With MySQL support removed (b154bc7a10
) this constant is unnecessary.
This commit is contained in:
parent
0acaac7115
commit
2fa54cc627
@ -310,7 +310,7 @@ class API extends Handler {
|
|||||||
->select_many('e.id', 'e.guid', 'e.title', 'e.link', 'e.author', 'e.content', 'e.lang', 'e.comments',
|
->select_many('e.id', 'e.guid', 'e.title', 'e.link', 'e.author', 'e.content', 'e.lang', 'e.comments',
|
||||||
'ue.feed_id', 'ue.int_id', 'ue.marked', 'ue.unread', 'ue.published', 'ue.score', 'ue.note')
|
'ue.feed_id', 'ue.int_id', 'ue.marked', 'ue.unread', 'ue.published', 'ue.score', 'ue.note')
|
||||||
->select_many_expr([
|
->select_many_expr([
|
||||||
'updated' => SUBSTRING_FOR_DATE.'(updated,1,16)',
|
'updated' => 'SUBSTRING_FOR_DATE(updated,1,16)',
|
||||||
'feed_title' => '(SELECT title FROM ttrss_feeds WHERE id = ue.feed_id)',
|
'feed_title' => '(SELECT title FROM ttrss_feeds WHERE id = ue.feed_id)',
|
||||||
'site_url' => '(SELECT site_url FROM ttrss_feeds WHERE id = ue.feed_id)',
|
'site_url' => '(SELECT site_url FROM ttrss_feeds WHERE id = ue.feed_id)',
|
||||||
'hide_images' => '(SELECT hide_images FROM ttrss_feeds WHERE id = feed_id)',
|
'hide_images' => '(SELECT hide_images FROM ttrss_feeds WHERE id = feed_id)',
|
||||||
@ -619,7 +619,7 @@ class API extends Handler {
|
|||||||
/* API only: -3 (Feeds::CATEGORY_ALL_EXCEPT_VIRTUAL) All feeds, excluding virtual feeds (e.g. Labels and such) */
|
/* API only: -3 (Feeds::CATEGORY_ALL_EXCEPT_VIRTUAL) All feeds, excluding virtual feeds (e.g. Labels and such) */
|
||||||
$feeds_obj = ORM::for_table('ttrss_feeds')
|
$feeds_obj = ORM::for_table('ttrss_feeds')
|
||||||
->select_many('id', 'feed_url', 'cat_id', 'title', 'order_id', 'last_error', 'update_interval')
|
->select_many('id', 'feed_url', 'cat_id', 'title', 'order_id', 'last_error', 'update_interval')
|
||||||
->select_expr(SUBSTRING_FOR_DATE.'(last_updated,1,19)', 'last_updated')
|
->select_expr('SUBSTRING_FOR_DATE(last_updated,1,19)', 'last_updated')
|
||||||
->where('owner_uid', $_SESSION['uid'])
|
->where('owner_uid', $_SESSION['uid'])
|
||||||
->order_by_asc('order_id')
|
->order_by_asc('order_id')
|
||||||
->order_by_asc('title');
|
->order_by_asc('title');
|
||||||
@ -670,7 +670,7 @@ class API extends Handler {
|
|||||||
|
|
||||||
$feed = ORM::for_table('ttrss_feeds')
|
$feed = ORM::for_table('ttrss_feeds')
|
||||||
->select_many('id', 'cache_images')
|
->select_many('id', 'cache_images')
|
||||||
->select_expr(SUBSTRING_FOR_DATE.'(last_updated,1,19)', 'last_updated')
|
->select_expr('SUBSTRING_FOR_DATE(last_updated,1,19)', 'last_updated')
|
||||||
->find_one($feed_id);
|
->find_one($feed_id);
|
||||||
|
|
||||||
if ($feed) {
|
if ($feed) {
|
||||||
|
@ -157,7 +157,7 @@ class Counters {
|
|||||||
|
|
||||||
$sth = $pdo->prepare("SELECT f.id,
|
$sth = $pdo->prepare("SELECT f.id,
|
||||||
f.title,
|
f.title,
|
||||||
".SUBSTRING_FOR_DATE."(f.last_updated,1,19) AS last_updated,
|
SUBSTRING_FOR_DATE(f.last_updated,1,19) AS last_updated,
|
||||||
f.last_error,
|
f.last_error,
|
||||||
SUM(CASE WHEN unread THEN 1 ELSE 0 END) AS count,
|
SUM(CASE WHEN unread THEN 1 ELSE 0 END) AS count,
|
||||||
SUM(CASE WHEN marked THEN 1 ELSE 0 END) AS count_marked
|
SUM(CASE WHEN marked THEN 1 ELSE 0 END) AS count_marked
|
||||||
@ -169,7 +169,7 @@ class Counters {
|
|||||||
} else {
|
} else {
|
||||||
$sth = $pdo->prepare("SELECT f.id,
|
$sth = $pdo->prepare("SELECT f.id,
|
||||||
f.title,
|
f.title,
|
||||||
".SUBSTRING_FOR_DATE."(f.last_updated,1,19) AS last_updated,
|
SUBSTRING_FOR_DATE(f.last_updated,1,19) AS last_updated,
|
||||||
f.last_error,
|
f.last_error,
|
||||||
SUM(CASE WHEN unread THEN 1 ELSE 0 END) AS count,
|
SUM(CASE WHEN unread THEN 1 ELSE 0 END) AS count,
|
||||||
SUM(CASE WHEN marked THEN 1 ELSE 0 END) AS count_marked
|
SUM(CASE WHEN marked THEN 1 ELSE 0 END) AS count_marked
|
||||||
|
@ -110,7 +110,7 @@ class Digest
|
|||||||
link,
|
link,
|
||||||
score,
|
score,
|
||||||
content,
|
content,
|
||||||
".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
|
SUBSTRING_FOR_DATE(last_updated,1,19) AS last_updated
|
||||||
FROM
|
FROM
|
||||||
ttrss_user_entries,ttrss_entries,ttrss_feeds
|
ttrss_user_entries,ttrss_entries,ttrss_feeds
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
|
@ -400,8 +400,8 @@ class Feeds extends Handler_Protected {
|
|||||||
|
|
||||||
$reply['content'] .= "<p><span class=\"text-muted\">";
|
$reply['content'] .= "<p><span class=\"text-muted\">";
|
||||||
|
|
||||||
$sth = $this->pdo->prepare("SELECT " . SUBSTRING_FOR_DATE . "(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds
|
$sth = $this->pdo->prepare("SELECT SUBSTRING_FOR_DATE(MAX(last_updated), 1, 19) AS last_updated
|
||||||
WHERE owner_uid = ?");
|
FROM ttrss_feeds WHERE owner_uid = ?");
|
||||||
$sth->execute([$_SESSION['uid']]);
|
$sth->execute([$_SESSION['uid']]);
|
||||||
$row = $sth->fetch();
|
$row = $sth->fetch();
|
||||||
|
|
||||||
@ -2239,7 +2239,7 @@ class Feeds extends Handler_Protected {
|
|||||||
$orig_ts = strtotime(substr($k, 1));
|
$orig_ts = strtotime(substr($k, 1));
|
||||||
$k = date("Y-m-d", TimeHelper::convert_timestamp($orig_ts, $user_tz_string, 'UTC'));
|
$k = date("Y-m-d", TimeHelper::convert_timestamp($orig_ts, $user_tz_string, 'UTC'));
|
||||||
|
|
||||||
array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH(".$pdo->quote($k).")) $not = ".$pdo->quote($k).")");
|
array_push($query_keywords, "(SUBSTRING_FOR_DATE(updated,1,LENGTH(".$pdo->quote($k).")) $not = ".$pdo->quote($k).")");
|
||||||
} else {
|
} else {
|
||||||
// treat as leftover text
|
// treat as leftover text
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class Pref_Feeds extends Handler_Protected {
|
|||||||
$feeds_obj = ORM::for_table('ttrss_feeds')
|
$feeds_obj = ORM::for_table('ttrss_feeds')
|
||||||
->table_alias('f')
|
->table_alias('f')
|
||||||
->select_many('id', 'title', 'last_error', 'update_interval')
|
->select_many('id', 'title', 'last_error', 'update_interval')
|
||||||
->select_expr(SUBSTRING_FOR_DATE.'(last_updated,1,19)', 'last_updated')
|
->select_expr('SUBSTRING_FOR_DATE(last_updated,1,19)', 'last_updated')
|
||||||
->left_outer_join('ttrss_user_entries', [ 'ue.feed_id', '=', 'f.id'], 'ue')
|
->left_outer_join('ttrss_user_entries', [ 'ue.feed_id', '=', 'f.id'], 'ue')
|
||||||
->select_expr('COUNT(ue.int_id) AS num_articles')
|
->select_expr('COUNT(ue.int_id) AS num_articles')
|
||||||
->where(['cat_id' => $cat_id, 'owner_uid' => $_SESSION['uid']])
|
->where(['cat_id' => $cat_id, 'owner_uid' => $_SESSION['uid']])
|
||||||
@ -261,7 +261,7 @@ class Pref_Feeds extends Handler_Protected {
|
|||||||
$feeds_obj = ORM::for_table('ttrss_feeds')
|
$feeds_obj = ORM::for_table('ttrss_feeds')
|
||||||
->table_alias('f')
|
->table_alias('f')
|
||||||
->select_many('id', 'title', 'last_error', 'update_interval')
|
->select_many('id', 'title', 'last_error', 'update_interval')
|
||||||
->select_expr(SUBSTRING_FOR_DATE.'(last_updated,1,19)', 'last_updated')
|
->select_expr('SUBSTRING_FOR_DATE(last_updated,1,19)', 'last_updated')
|
||||||
->left_outer_join('ttrss_user_entries', [ 'ue.feed_id', '=', 'f.id'], 'ue')
|
->left_outer_join('ttrss_user_entries', [ 'ue.feed_id', '=', 'f.id'], 'ue')
|
||||||
->select_expr('COUNT(ue.int_id) AS num_articles')
|
->select_expr('COUNT(ue.int_id) AS num_articles')
|
||||||
->where('owner_uid', $_SESSION['uid'])
|
->where('owner_uid', $_SESSION['uid'])
|
||||||
@ -305,7 +305,7 @@ class Pref_Feeds extends Handler_Protected {
|
|||||||
$feeds_obj = ORM::for_table('ttrss_feeds')
|
$feeds_obj = ORM::for_table('ttrss_feeds')
|
||||||
->table_alias('f')
|
->table_alias('f')
|
||||||
->select_many('id', 'title', 'last_error', 'update_interval')
|
->select_many('id', 'title', 'last_error', 'update_interval')
|
||||||
->select_expr(SUBSTRING_FOR_DATE.'(last_updated,1,19)', 'last_updated')
|
->select_expr('SUBSTRING_FOR_DATE(last_updated,1,19)', 'last_updated')
|
||||||
->left_outer_join('ttrss_user_entries', [ 'ue.feed_id', '=', 'f.id'], 'ue')
|
->left_outer_join('ttrss_user_entries', [ 'ue.feed_id', '=', 'f.id'], 'ue')
|
||||||
->select_expr('COUNT(ue.int_id) AS num_articles')
|
->select_expr('COUNT(ue.int_id) AS num_articles')
|
||||||
->where('owner_uid', $_SESSION['uid'])
|
->where('owner_uid', $_SESSION['uid'])
|
||||||
|
@ -24,11 +24,11 @@ class Pref_Users extends Handler_Administrative {
|
|||||||
$id = (int) clean($_REQUEST["id"]);
|
$id = (int) clean($_REQUEST["id"]);
|
||||||
|
|
||||||
$sth = $this->pdo->prepare("SELECT login,
|
$sth = $this->pdo->prepare("SELECT login,
|
||||||
".SUBSTRING_FOR_DATE."(last_login,1,16) AS last_login,
|
SUBSTRING_FOR_DATE(last_login,1,16) AS last_login,
|
||||||
access_level,
|
access_level,
|
||||||
(SELECT COUNT(int_id) FROM ttrss_user_entries
|
(SELECT COUNT(int_id) FROM ttrss_user_entries
|
||||||
WHERE owner_uid = id) AS stored_articles,
|
WHERE owner_uid = id) AS stored_articles,
|
||||||
".SUBSTRING_FOR_DATE."(created,1,16) AS created
|
SUBSTRING_FOR_DATE(created,1,16) AS created
|
||||||
FROM ttrss_users
|
FROM ttrss_users
|
||||||
WHERE id = ?");
|
WHERE id = ?");
|
||||||
$sth->execute([$id]);
|
$sth->execute([$id]);
|
||||||
|
@ -345,7 +345,7 @@ class RSSUtils {
|
|||||||
|
|
||||||
$feed_obj = ORM::for_table('ttrss_feeds')
|
$feed_obj = ORM::for_table('ttrss_feeds')
|
||||||
->select_expr("ttrss_feeds.*,
|
->select_expr("ttrss_feeds.*,
|
||||||
".SUBSTRING_FOR_DATE."(last_unconditional, 1, 19) AS last_unconditional,
|
SUBSTRING_FOR_DATE(last_unconditional, 1, 19) AS last_unconditional,
|
||||||
(favicon_is_custom IS NOT TRUE AND
|
(favicon_is_custom IS NOT TRUE AND
|
||||||
(favicon_last_checked IS NULL OR favicon_last_checked < NOW() - INTERVAL '12 hour')) AS favicon_needs_check")
|
(favicon_last_checked IS NULL OR favicon_last_checked < NOW() - INTERVAL '12 hour')) AS favicon_needs_check")
|
||||||
->find_one($feed);
|
->find_one($feed);
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
|
|
||||||
require_once "autoload.php";
|
require_once "autoload.php";
|
||||||
|
|
||||||
define('SUBSTRING_FOR_DATE', 'SUBSTRING_FOR_DATE');
|
/** @deprecated use the 'SUBSTRING_FOR_DATE' string directly */
|
||||||
|
const SUBSTRING_FOR_DATE = 'SUBSTRING_FOR_DATE';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated by Prefs::get()
|
* @deprecated by Prefs::get()
|
||||||
|
@ -123,7 +123,7 @@ class Share extends Plugin {
|
|||||||
$pdo = Db::pdo();
|
$pdo = Db::pdo();
|
||||||
|
|
||||||
$sth = $pdo->prepare("SELECT id,title,link,content,feed_id,comments,int_id,lang,
|
$sth = $pdo->prepare("SELECT id,title,link,content,feed_id,comments,int_id,lang,
|
||||||
".SUBSTRING_FOR_DATE."(updated,1,16) as updated,
|
SUBSTRING_FOR_DATE(updated,1,16) as updated,
|
||||||
(SELECT site_url FROM ttrss_feeds WHERE id = feed_id) as site_url,
|
(SELECT site_url FROM ttrss_feeds WHERE id = feed_id) as site_url,
|
||||||
(SELECT title FROM ttrss_feeds WHERE id = feed_id) as feed_title,
|
(SELECT title FROM ttrss_feeds WHERE id = feed_id) as feed_title,
|
||||||
(SELECT hide_images FROM ttrss_feeds WHERE id = feed_id) as hide_images,
|
(SELECT hide_images FROM ttrss_feeds WHERE id = feed_id) as hide_images,
|
||||||
|
Loading…
Reference in New Issue
Block a user