diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2025-04-28 04:48:01 +0000 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2025-04-28 04:48:01 +0000 |
| commit | 4cb8a84df46d46bc325b6638defbdc4dc34151ed (patch) | |
| tree | 77acdf9b8271568a53e636fc4e84d4bda1404f82 /classes/RPC.php | |
| parent | 0e4b8bd6538f3062d34a3a06ab5531c70042de78 (diff) | |
| parent | f80187e05f12c2fe9c487bff13058b207833b227 (diff) | |
Merge branch 'rip-mysql' into 'master'
initial attempt to remove mysql-related stuff from tt-rss
See merge request tt-rss/tt-rss!120
Diffstat (limited to 'classes/RPC.php')
| -rw-r--r-- | classes/RPC.php | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/classes/RPC.php b/classes/RPC.php index 82f85fc11..031bef509 100644 --- a/classes/RPC.php +++ b/classes/RPC.php @@ -252,40 +252,23 @@ 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 ' . Db::past_comparison_qpart('last_update_started', '<', 5, 'minute') . ')'; - $random_qpart = Db::sql_random_function(); - $pdo = Db::pdo(); // we could be invoked from public.php with no active session @@ -305,7 +288,7 @@ class RPC extends Handler_Protected { $owner_check_qpart $update_limit_qpart $updstart_thresh_qpart - ORDER BY $random_qpart LIMIT 30"; + ORDER BY RANDOM() LIMIT 30"; $res = $pdo->query($query); |