Skip to content

Improve photo and timezone sync scheduled task#3210

Open
weilai-irl wants to merge 1 commit into
MOODLE_501_STABLEfrom
wip-130227-m501
Open

Improve photo and timezone sync scheduled task#3210
weilai-irl wants to merge 1 commit into
MOODLE_501_STABLEfrom
wip-130227-m501

Conversation

@weilai-irl

Copy link
Copy Markdown
Collaborator
  • Better support for site not using UPN as username,
  • Reduce DB queries.

Copilot AI review requested due to automatic review settings June 4, 2026 09:37
@weilai-irl weilai-irl self-assigned this Jun 4, 2026
@weilai-irl weilai-irl added this to the 2026-03 milestone Jun 4, 2026
@weilai-irl weilai-irl changed the base branch from master to MOODLE_501_STABLE June 4, 2026 09:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the photoandtimezonesync scheduled task to better handle environments where o365name is not a valid Microsoft Graph user identifier, and to reduce per-user DB/API work during photo sync runs.

Changes:

  • Use Entra objectid (GUID) as the identifier for Graph photo batch requests instead of o365name/UPN.
  • Reduce DB overhead by replacing per-user local_o365_appassign lookups with a pre-aggregated LEFT JOIN, and by caching/storing a raw-photo hash in user_preferences to skip unnecessary image processing.
  • Refine photo-apply semantics by returning a boolean from apply_photo_public() and improving change detection in apply_photo().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
local/o365/classes/task/photoandtimezonesync.php Switch photo batch lookup to objectid, reduce DB queries, and add hash-based short-circuiting for unchanged photos.
local/o365/classes/feature/usersync/main.php Improve photo-apply “changed” detection and return a boolean from apply_photo_public() for scheduled task use.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread local/o365/classes/task/photoandtimezonesync.php Outdated
Comment thread local/o365/classes/task/photoandtimezonesync.php Outdated
…r site not using UPN as username, reduce DB queries
@weilai-irl weilai-irl changed the title Improve photo sync in scheduled task Improve photo and timezone sync scheduled task Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants