Skip to content

refactor(files): move unused file sorting helpers - #65936

Open
joshtrichards wants to merge 4 commits into
masterfrom
jtr/refactor-FilesHelper-cleanup
Open

joshtrichards wants to merge 4 commits into
masterfrom
jtr/refactor-FilesHelper-cleanup

Conversation

@joshtrichards

@joshtrichards joshtrichards commented Oct 26, 2026 •

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

🧹
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).

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

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

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 joshtrichards added this to the Nextcloud 36 milestone Oct 26, 2026
@joshtrichards joshtrichards added 2. developing Work in progress feature: files feature: trashbin ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) 3. to review Waiting for reviews and removed 2. developing Work in progress labels Oct 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews feature: files feature: trashbin ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant