diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2025-04-14 15:27:58 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2025-04-14 15:27:58 +0300 |
| commit | 3c138a71a1749537680a23aca6d4181b5b2820f0 (patch) | |
| tree | 584dc0db0e28438159c6f474a653b20100d944cf | |
| parent | 54e8ab7e3d4fa99e9acfc069c963fe41cfb0cd32 (diff) | |
add deprecation notice for sql_random_function()
| -rw-r--r-- | classes/Db.php | 1 | ||||
| -rw-r--r-- | classes/RPC.php | 4 | ||||
| -rwxr-xr-x | plugins/cache_starred_images/init.php | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/classes/Db.php b/classes/Db.php index 6310d11e3..872c6b351 100644 --- a/classes/Db.php +++ b/classes/Db.php @@ -71,6 +71,7 @@ class Db { return self::$instance->pdo; } + /** @deprecated usages should be replaced with `RANDOM()` */ public static function sql_random_function(): string { return "RANDOM()"; } diff --git a/classes/RPC.php b/classes/RPC.php index bad51e4aa..031bef509 100644 --- a/classes/RPC.php +++ b/classes/RPC.php @@ -269,8 +269,6 @@ class RPC extends Handler_Protected { $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 @@ -290,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); diff --git a/plugins/cache_starred_images/init.php b/plugins/cache_starred_images/init.php index cc1eef0dc..48c8df3db 100755 --- a/plugins/cache_starred_images/init.php +++ b/plugins/cache_starred_images/init.php @@ -59,7 +59,7 @@ class Cache_Starred_Images extends Plugin { site_url != '' AND ttrss_user_entries.owner_uid = ? AND plugin_data NOT LIKE '%starred_cache_images%' - ORDER BY ".Db::sql_random_function()." LIMIT 100"); + ORDER BY RANDOM() LIMIT 100"); if ($sth->execute([$this->host->get_owner_uid()])) { |