Issue #3493290: Batch-load existing links in MenuTreeStorage::rebuild()

Pre-load all existing menu links at the start of rebuild() instead of querying for each link individually in doSave(). This reduces database queries from N (one per link) to 1 (single IN query).

Changes:

  • Add $preloadedOriginals property to cache batch-loaded data
  • Load all existing links matching definition IDs at rebuild() start
  • Use cached data in doSave() when available
  • Update cache after successful inserts to prevent duplicate key errors
  • Fall back to per-link query for links not in definitions (purgeMultiple)
  • Clear cache at end of rebuild()

Performance improvement on YMCA Website Services site-install:

Closes #3493290

Merge request reports

Loading