Page MenuHomePhabricator

Reduce the amount of weird "static" and "cache" behavior in Pholio query classes
ClosedPublic

Authored by epriestley on Dec 20 2018, 8:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 3 2024, 8:32 PM
Unknown Object (File)
Jan 25 2024, 1:41 AM
Unknown Object (File)
Dec 22 2023, 1:04 AM
Unknown Object (File)
Dec 15 2023, 2:48 PM
Unknown Object (File)
Dec 12 2023, 9:52 AM
Unknown Object (File)
Dec 7 2023, 10:52 AM
Unknown Object (File)
Nov 30 2023, 3:29 AM
Unknown Object (File)
Nov 25 2023, 8:34 PM
Subscribers
None

Details

Summary

Depends on D19922. Ref T11351. These query classes have some slightly weird behavior, including public static function loadImages(...). Convert all this stuff into more standard query patterns.

Test Plan

Grepped for callsites, browsed around in Pholio.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

src/applications/pholio/query/PholioImageQuery.php
23

withMocks(...) now has the effect of working like a cache and implying withMockPHIDs(...), similar to withRepositories(...) elsewhere.

78

There's a behavioral change here: we'll now load Images if they have a null value for mockPHID (i.e., an image not yet attached to a mock). Previously, we would always reject them.

84

(Not actually that scary: it does some extra fetches, but hits the cache the second time through.)

src/applications/pholio/view/PholioMockImagesView.php
113

This fixes a sort-of-bug. The mpull() intends to rekey the array (the lines below care about the array keys) but changes the values instead. The code worked before because the array happened to always be keyed by ID anyway.

This revision is now accepted and ready to land.Dec 20 2018, 10:42 PM
This revision was automatically updated to reflect the committed changes.