Page MenuHomePhabricator

Fix some file policy issues and add a "Query Workspace"
ClosedPublic

Authored by epriestley on Oct 14 2013, 7:58 PM.
Tags
None
Referenced Files
F19066341: D7309.id16460.diff
Sun, Nov 30, 5:09 AM
F19065268: D7309.id16471.diff
Sun, Nov 30, 1:06 AM
F19023228: D7309.diff
Mon, Nov 24, 12:05 AM
F19011254: D7309.diff
Sat, Nov 22, 8:56 AM
F18946477: D7309.id16461.diff
Nov 11 2025, 8:22 PM
F18875840: D7309.id16460.diff
Nov 5 2025, 7:43 PM
F18859684: D7309.id16471.diff
Nov 2 2025, 4:52 AM
F18745176: D7309.id16471.diff
Oct 3 2025, 5:36 AM
Subscribers

Details

Summary

Ref T603. Several issues here:

  1. Currently, FileQuery does not actually respect object attachment edges when doing policy checks. Everything else works fine, but this was missing an array_keys().
  2. Once that's fixed, we hit a bunch of recursion issues. For example, when loading a User we load the profile picture, and then that loads the User, and that loads the profile picture, etc.
  3. Introduce a "Query Workspace", which holds objects we know we've loaded and know we can see but haven't finished filtering and/or attaching data to. This allows subqueries to look up objects instead of querying for them.
    • We can probably generalize this a bit to make a few other queries more efficient. Pholio currently has a similar (but less general) "mock cache". However, it's keyed by ID instead of PHID so it's not easy to reuse this right now.

This is a bit complex for the problem being solved, but I think it's the cleanest approach and I believe the primitive will be useful in the future.

Test Plan

Looked at pastes, macros, mocks and projects as a logged-in and logged-out user.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley updated this revision to Unknown Object (????).Oct 14 2013, 8:00 PM
  • Restore an if ($projects) which I was overzealous in removing.

reminds me of the good ole days:

$GLOBALS['CACHE'][$key] = $value;

Yeahhhhhhhhhhhhhh, I've tried to use lots of fancy words so it's hard to tell. :)