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)
Sat, Dec 7, 6:59 AM
Unknown Object (File)
Fri, Dec 6, 7:00 AM
Unknown Object (File)
Tue, Dec 3, 9:33 PM
Unknown Object (File)
Sat, Nov 23, 10:11 AM
Unknown Object (File)
Nov 18 2024, 8:18 PM
Unknown Object (File)
Nov 14 2024, 8:27 PM
Unknown Object (File)
Nov 11 2024, 7:52 AM
Unknown Object (File)
Nov 10 2024, 12:09 AM
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.