Improve photo and timezone sync scheduled task#3211
Open
weilai-irl wants to merge 1 commit into
Open
Conversation
weilai-irl
commented
Jun 4, 2026
Collaborator
- Better support for site not using UPN as username,
- Reduce DB queries.
There was a problem hiding this comment.
Pull request overview
This PR improves the scheduled photo/timezone sync task by making photo fetches more robust on sites where stored usernames aren’t valid Graph UPNs, and by reducing per-user database lookups during batch processing.
Changes:
- Switch photo sync lookups from
o365name(UPN) toobjectid(AAD GUID) when calling Graph batch photo APIs. - Reduce DB queries by pre-aggregating
local_o365_appassignvia a single LEFT JOIN and by batch-fetchinguser_preferencesphoto hashes. - Optimize photo application by skipping
process_new_icon()when the incoming raw photo hash matches the stored hash, and refining photo-change detection inapply_photo()via file content hashes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
local/o365/classes/task/photoandtimezonesync.php |
Uses objectid for photo batch requests, avoids duplicate rows via aggregated join, and adds hash-based short-circuiting to reduce unnecessary image processing/DB work. |
local/o365/classes/feature/usersync/main.php |
Updates photo-apply logic to more reliably determine “content changed” vs “ID changed”, and makes apply_photo_public() return a boolean change indicator. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
148d499 to
7901461
Compare
…r site not using UPN as username, reduce DB queries
7901461 to
2273e06
Compare
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.