Repository navigation
refactor(files): move unused file sorting helpers - #65936
Open
joshtrichards wants to merge 4 commits into
Open
joshtrichards wants to merge 4 commits into
joshtrichards wants to merge 4 commits into
Conversation
The sorting logic in OCA\Files\Helpers is no longer used by anything other than the Trashbin app (it used to be used by the ancient Files PHP front-end / AJAX backend - e.g. `list.php`). - Move it from OCA\Files\Helper to OCA\Files_Trashbin\Helper. Signed-off-by: Josh <josh.t.richards@gmail.com>
Move the trash specific sorting helper tests into files_trashbin. Also add missing namespace. Signed-off-by: Josh <josh.t.richards@gmail.com>
Remove sortFiles() and their comparator methods from OCA\Files\Helper now that trash-bin sorting is owned by OCA\Files_Trashbin\Helper. Remove getFiles() which was already dead code and the only remaining caller of sortFiles(). Related: Retaining formatFileInfo(), which is still used by some apps to format recent-file responses (see #65395). Signed-off-by: Josh <josh.t.richards@gmail.com>
Add parameter and return types to the moved sorting helper and its comparators. Type the sorter against the public OCP\Files\FileInfo interface, aliased as IFileInfo, to make its accepted contract explicit. The alias distinguishes the public interface from the concrete OC\Files\FileInfo class, which buildFileInfo() constructs. Signed-off-by: Josh <josh.t.richards@gmail.com>
joshtrichards
requested review from
CarlSchwan,
icewind1991,
skjnldsv and
susnux
October 26, 2026 15:29
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #Summary
🧹
The sorting logic in
OCA\Files\Helpersis no longer used by anything other than the Trashbin app (it used to be used by the ancient Files PHP "front-end" / AJAX backend - e.g.list.php).OCA\Files_Trashbin\Helper, the remaining in-repository consumer.getFiles()method and sorting helpers fromOCA\Files\Helper.formatFileInfo()in the Files helper (related: [RFC] One file representation for DAV and PHP: node attribute providers #65395)The sorting behavior is preserved. The existing timestamp and size comparators return a nonzero result for equal values; correcting tie is a minor matter and left for a follow-up (probably with some test additions too).
TODO
Checklist
3. to review, feature component)stable32)AI (if applicable)