Skip to content

Conversation

@joshtrichards
Copy link
Member

@joshtrichards joshtrichards commented Jul 24, 2025

Summary

  • Simplify code by switching from using FILEINFO_MIME + extra string parsing to outright using FILEINFO_MIME_TYPE
  • Sprinkle in OOP-mode usage of finfo
    • P.S. I verified performance/memory usage doesn't suffer from either of the above changes
  • More consistent checks
  • More consistent variable naming

Unrelated (in terms of this PR itself since it's true even before these changes, but something that came up during testing): PHP v8.4.1-v8.4.10 (current) appear to have dramatically slower finfo performance for some reason (like -2x+).

TODO

  • n/a

Checklist

@joshtrichards joshtrichards added 2. developing Work in progress feature: files php Pull requests that update Php code ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) labels Jul 24, 2025
@joshtrichards joshtrichards added this to the Nextcloud 32 milestone Jul 24, 2025
@joshtrichards joshtrichards added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 24, 2025
@joshtrichards joshtrichards marked this pull request as ready for review July 24, 2025 16:58
@joshtrichards joshtrichards requested a review from a team as a code owner July 24, 2025 16:58
@joshtrichards joshtrichards requested review from nfebe, salmart-dev and sorbaugh and removed request for a team July 24, 2025 16:58
@joshtrichards

This comment was marked as resolved.

@joshtrichards joshtrichards force-pushed the jtr-files-detection-refactor-finfo branch from 20b1748 to 3535149 Compare August 4, 2025 15:24
@joshtrichards joshtrichards changed the title refactor(IMimeTypeDetector): streamline finfo usage + misc tidying refactor(IMimeTypeDetector): streamline + minor tidying Aug 4, 2025
@susnux susnux requested review from come-nc and removed request for sorbaugh August 5, 2025 11:31
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the finfo slowness thing reported upstream to PHP?

@susnux susnux merged commit ad85d65 into master Aug 5, 2025
210 of 214 checks passed
@susnux susnux deleted the jtr-files-detection-refactor-finfo branch August 5, 2025 16:10
@skjnldsv skjnldsv mentioned this pull request Aug 19, 2025
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
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 php Pull requests that update Php code ♻️ 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.

5 participants