Sort by article length (#8119)

* Sort by article length
fix https://github.com/FreshRSS/Extensions/issues/378
Very basic using simply SQL `LENGTH()` function.

<img width="492" height="217" alt="image" src="https://github.com/user-attachments/assets/7cf37303-76c8-4411-b8b1-075e81535b60" />

* Improve content length retrieval
This commit is contained in:
Alexandre Alapetite
2025-10-16 21:15:44 +02:00
committed by GitHub
parent ca091fbef4
commit f08f7dcff9
35 changed files with 108 additions and 29 deletions

View File

@@ -285,7 +285,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
$continuation_values = [];
if (FreshRSS_Context::$continuation_id !== '0') {
if (in_array(FreshRSS_Context::$sort, ['c.name', 'date', 'f.name', 'link', 'title', 'lastUserModified'], true)) {
if (in_array(FreshRSS_Context::$sort, ['c.name', 'date', 'f.name', 'link', 'title', 'lastUserModified', 'length'], true)) {
$pagingEntry = $entryDAO->searchById(FreshRSS_Context::$continuation_id);
if ($pagingEntry !== null && in_array(FreshRSS_Context::$sort, ['c.name', 'f.name'], true)) {
@@ -303,6 +303,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
'link' => $pagingEntry->link(true),
'title' => $pagingEntry->title(),
'lastUserModified' => $pagingEntry->lastUserModified(),
'length' => $pagingEntry->sqlContentLength() ?? 0,
};
if ($pagingEntry !== null && FreshRSS_Context::$sort === 'c.name') {
// Secondary sort criterion