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
F14063770: D19923.diff
Mon, Nov 18, 8:18 PM
F14050736: D19923.diff
Thu, Nov 14, 8:27 PM
F14040198: D19923.diff
Mon, Nov 11, 7:52 AM
F14034418: D19923.diff
Sun, Nov 10, 12:09 AM
F14022998: D19923.diff
Wed, Nov 6, 9:44 PM
F14009846: D19923.diff
Thu, Oct 31, 12:23 AM
F14000725: D19923.diff
Fri, Oct 25, 12:04 AM
F13981972: D19923.id47564.diff
Oct 19 2024, 8:23 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.