@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Kill PhabricatorObjectDataHandle

Summary: Ref T603. Killing this class is cool because the classes that replace it are policy-aware. Tried to keep my wits about me as I did this and fixed a few random things along the way. (Ones I remember right now are pulling a query outside of a foreach loop in Releeph and fixing the text in UIExample to note that the ace of hearts if "a powerful" card and not the "most powerful" card (Q of spades gets that honor IMO))

Test Plan: tested the first few changes (execute, executeOne X handle, object) then got real mechanical / careful with the other changes.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran, FacebookPOC

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D6941

+335 -363
-1
src/__phutil_library_map__.php
··· 1376 1376 'PhabricatorOAuthServerTokenController' => 'applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php', 1377 1377 'PhabricatorObjectHandle' => 'applications/phid/PhabricatorObjectHandle.php', 1378 1378 'PhabricatorObjectHandleConstants' => 'applications/phid/handle/const/PhabricatorObjectHandleConstants.php', 1379 - 'PhabricatorObjectHandleData' => 'applications/phid/handle/PhabricatorObjectHandleData.php', 1380 1379 'PhabricatorObjectHandleStatus' => 'applications/phid/handle/const/PhabricatorObjectHandleStatus.php', 1381 1380 'PhabricatorObjectListView' => 'view/control/PhabricatorObjectListView.php', 1382 1381 'PhabricatorObjectMailReceiver' => 'applications/metamta/receiver/PhabricatorObjectMailReceiver.php',
+6 -4
src/applications/audit/editor/PhabricatorAuditCommentEditor.php
··· 381 381 382 382 $commit_phid = $commit->getPHID(); 383 383 $phids = array($commit_phid); 384 - $handles = id(new PhabricatorObjectHandleData($phids)) 384 + $handles = id(new PhabricatorHandleQuery()) 385 385 ->setViewer($this->getActor()) 386 - ->loadHandles(); 386 + ->withPHIDs($phids) 387 + ->execute(); 387 388 $handle = $handles[$commit_phid]; 388 389 389 390 $name = $handle->getName(); ··· 446 447 $email_cc = array_keys($email_cc); 447 448 448 449 $phids = array_merge($email_to, $email_cc); 449 - $handles = id(new PhabricatorObjectHandleData($phids)) 450 + $handles = id(new PhabricatorHandleQuery()) 450 451 ->setViewer($this->getActor()) 451 - ->loadHandles(); 452 + ->withPHIDs($phids) 453 + ->execute(); 452 454 453 455 // NOTE: Always set $is_new to false, because the "first" mail in the 454 456 // thread is the Herald notification of the commit.
+3 -2
src/applications/base/controller/PhabricatorController.php
··· 267 267 } 268 268 269 269 protected function loadViewerHandles(array $phids) { 270 - return id(new PhabricatorObjectHandleData($phids)) 270 + return id(new PhabricatorHandleQuery()) 271 271 ->setViewer($this->getRequest()->getUser()) 272 - ->loadHandles(); 272 + ->withPHIDs($phids) 273 + ->execute(); 273 274 } 274 275 275 276
+3 -2
src/applications/conpherence/controller/ConpherenceNewController.php
··· 51 51 52 52 $participant_handles = array(); 53 53 if ($participants) { 54 - $handles = id(new PhabricatorObjectHandleData($participants)) 54 + $handles = id(new PhabricatorHandleQuery()) 55 55 ->setViewer($user) 56 - ->loadHandles(); 56 + ->withPHIDs($participants) 57 + ->execute(); 57 58 $participant_handles = mpull($handles, 'getFullName', 'getPHID'); 58 59 } 59 60
+6 -4
src/applications/conpherence/query/ConpherenceThreadQuery.php
··· 152 152 $conpherence->$method(); 153 153 } 154 154 $flat_phids = array_mergev($handle_phids); 155 - $handles = id(new PhabricatorObjectHandleData($flat_phids)) 155 + $handles = id(new PhabricatorHandleQuery()) 156 156 ->setViewer($this->getViewer()) 157 - ->loadHandles(); 157 + ->withPHIDs($flat_phids) 158 + ->execute(); 158 159 foreach ($handle_phids as $conpherence_phid => $phids) { 159 160 $conpherence = $conpherences[$conpherence_phid]; 160 161 $conpherence->attachHandles(array_select_keys($handles, $phids)); ··· 239 240 ->execute(); 240 241 $files = mpull($files, null, 'getPHID'); 241 242 $file_author_phids = mpull($files, 'getAuthorPHID', 'getPHID'); 242 - $authors = id(new PhabricatorObjectHandleData($file_author_phids)) 243 + $authors = id(new PhabricatorHandleQuery()) 243 244 ->setViewer($this->getViewer()) 244 - ->loadHandles(); 245 + ->withPHIDs($file_author_phids) 246 + ->execute(); 245 247 $authors = mpull($authors, null, 'getPHID'); 246 248 } 247 249
+3 -2
src/applications/countdown/query/PhabricatorCountdownSearchEngine.php
··· 33 33 AphrontFormView $form, 34 34 PhabricatorSavedQuery $saved_query) { 35 35 $phids = $saved_query->getParameter('authorPHIDs', array()); 36 - $handles = id(new PhabricatorObjectHandleData($phids)) 36 + $handles = id(new PhabricatorHandleQuery()) 37 37 ->setViewer($this->requireViewer()) 38 - ->loadHandles(); 38 + ->withPHIDs($phids) 39 + ->execute(); 39 40 $author_tokens = mpull($handles, 'getFullName', 'getPHID'); 40 41 41 42 $upcoming = $saved_query->getParameter('upcoming');
+3 -2
src/applications/differential/conduit/ConduitAPI_differential_getcommitmessage_Method.php
··· 97 97 $aux_phids[$field_key] = $field->getRequiredHandlePHIDsForCommitMessage(); 98 98 } 99 99 $phids = array_unique(array_mergev($aux_phids)); 100 - $handles = id(new PhabricatorObjectHandleData($phids)) 100 + $handles = id(new PhabricatorHandleQuery()) 101 101 ->setViewer($request->getUser()) 102 - ->loadHandles(); 102 + ->withPHIDs($phids) 103 + ->execute(); 103 104 foreach ($aux_fields as $field_key => $field) { 104 105 $field->setHandles(array_select_keys($handles, $aux_phids[$field_key])); 105 106 }
+3 -2
src/applications/differential/conduit/ConduitAPI_differential_getrevision_Method.php
··· 65 65 66 66 $commit_dicts = array(); 67 67 $commit_phids = $revision->loadCommitPHIDs(); 68 - $handles = id(new PhabricatorObjectHandleData($commit_phids)) 68 + $handles = id(new PhabricatorHandleQuery()) 69 69 ->setViewer($request->getUser()) 70 - ->loadHandles(); 70 + ->withPHIDs($commit_phids) 71 + ->execute(); 71 72 72 73 foreach ($commit_phids as $commit_phid) { 73 74 $commit_dicts[] = array(
+3 -2
src/applications/differential/editor/DifferentialCommentEditor.php
··· 573 573 $revision->saveTransaction(); 574 574 575 575 $phids = array($actor_phid); 576 - $handles = id(new PhabricatorObjectHandleData($phids)) 576 + $handles = id(new PhabricatorHandleQuery()) 577 577 ->setViewer($this->getActor()) 578 - ->loadHandles(); 578 + ->withPHIDs($phids) 579 + ->execute(); 579 580 $actor_handle = $handles[$actor_phid]; 580 581 581 582 $xherald_header = HeraldTranscript::loadXHeraldRulesHeader(
+3 -2
src/applications/differential/editor/DifferentialRevisionEditor.php
··· 344 344 345 345 $phids = array($this->getActorPHID()); 346 346 347 - $handles = id(new PhabricatorObjectHandleData($phids)) 347 + $handles = id(new PhabricatorHandleQuery()) 348 348 ->setViewer($this->getActor()) 349 - ->loadHandles(); 349 + ->withPHIDs($phids) 350 + ->execute(); 350 351 $actor_handle = $handles[$this->getActorPHID()]; 351 352 352 353 $changesets = null;
+3 -2
src/applications/differential/events/DifferentialHovercardEventListener.php
··· 44 44 $reviewer_phids, 45 45 $tasks); 46 46 47 - $handles = id(new PhabricatorObjectHandleData($phids)) 47 + $handles = id(new PhabricatorHandleQuery()) 48 48 ->setViewer($viewer) 49 - ->loadHandles(); 49 + ->withPHIDs($phids) 50 + ->execute(); 50 51 51 52 $hovercard->setTitle('D'.$rev->getID()); 52 53 $hovercard->setDetail($rev->getTitle());
+4 -3
src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php
··· 47 47 if ($diff) { 48 48 $phid = $diff->getArcanistProjectPHID(); 49 49 if ($phid) { 50 - $handle = PhabricatorObjectHandleData::loadOneHandle( 51 - $phid, 52 - $this->getUser()); 50 + $handle = id(new PhabricatorHandleQuery()) 51 + ->setViewer($this->getUser()) 52 + ->withPHIDs(array($phid)) 53 + ->executeOne(); 53 54 return "ARCANIST PROJECT\n ".$handle->getName(); 54 55 } 55 56 }
+3 -2
src/applications/differential/field/specification/DifferentialCommitsFieldSpecification.php
··· 47 47 } 48 48 49 49 $body = array(); 50 - $handles = id(new PhabricatorObjectHandleData($phids)) 50 + $handles = id(new PhabricatorHandleQuery()) 51 51 ->setViewer($this->getUser()) 52 - ->loadHandles(); 52 + ->withPHIDs($phids) 53 + ->execute(); 53 54 $body[] = pht('COMMIT(S)', count($handles)); 54 55 55 56 foreach ($handles as $handle) {
+3 -2
src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php
··· 163 163 return null; 164 164 } 165 165 166 - $handles = id(new PhabricatorObjectHandleData($this->maniphestTasks)) 166 + $handles = id(new PhabricatorHandleQuery()) 167 167 ->setViewer($this->getUser()) 168 - ->loadHandles(); 168 + ->withPHIDs($this->maniphestTasks) 169 + ->execute(); 169 170 $body = array(); 170 171 $body[] = 'MANIPHEST TASKS'; 171 172 foreach ($handles as $handle) {
+3 -2
src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php
··· 164 164 return null; 165 165 } 166 166 167 - $handles = id(new PhabricatorObjectHandleData($this->reviewers)) 167 + $handles = id(new PhabricatorHandleQuery()) 168 168 ->setViewer($this->getUser()) 169 - ->loadHandles(); 169 + ->withPHIDs($this->reviewers) 170 + ->execute(); 170 171 $handles = array_select_keys( 171 172 $handles, 172 173 array($this->getRevision()->getPrimaryReviewer())) + $handles;
+3 -2
src/applications/differential/mail/DifferentialCommentMail.php
··· 98 98 array()); 99 99 $load = array_merge($m_reviewers, $m_cc); 100 100 if ($load) { 101 - $handles = id(new PhabricatorObjectHandleData($load)) 101 + $handles = id(new PhabricatorHandleQuery()) 102 102 ->setViewer($this->getActor()) 103 - ->loadHandles(); 103 + ->withPHIDs($load) 104 + ->execute(); 104 105 if ($m_reviewers) { 105 106 $this->addedReviewers = $this->renderHandleList($handles, $m_reviewers); 106 107 }
+9 -6
src/applications/differential/mail/DifferentialMail.php
··· 132 132 $raw = $revision->getRawRelations($relation_subscribed); 133 133 134 134 $reason_phids = ipull($raw, 'reasonPHID'); 135 - $reason_handles = id(new PhabricatorObjectHandleData($reason_phids)) 135 + $reason_handles = id(new PhabricatorHandleQuery()) 136 136 ->setViewer($this->getActor()) 137 - ->loadHandles(); 137 + ->withPHIDs($reason_phids) 138 + ->execute(); 138 139 139 140 $explicit_cc = array(); 140 141 foreach ($raw as $relation) { ··· 173 174 } 174 175 $phids = array_keys($phids); 175 176 176 - $handles = id(new PhabricatorObjectHandleData($phids)) 177 + $handles = id(new PhabricatorHandleQuery()) 177 178 ->setViewer($this->getActor()) 178 - ->loadHandles(); 179 - $objects = id(new PhabricatorObjectHandleData($phids)) 179 + ->withPHIDs($phids) 180 + ->execute(); 181 + $objects = id(new PhabricatorObjectQuery()) 180 182 ->setViewer($this->getActor()) 181 - ->loadObjects(); 183 + ->withPHIDs($phids) 184 + ->execute(); 182 185 183 186 $to_handles = array_select_keys($handles, $to_phids); 184 187 $cc_handles = array_select_keys($handles, $cc_phids);
+3 -2
src/applications/differential/query/DifferentialRevisionSearchEngine.php
··· 107 107 $subscriber_phids, 108 108 )); 109 109 110 - $handles = id(new PhabricatorObjectHandleData($all_phids)) 110 + $handles = id(new PhabricatorHandleQuery()) 111 111 ->setViewer($this->requireViewer()) 112 - ->loadHandles(); 112 + ->withPHIDs($all_phids) 113 + ->execute(); 113 114 114 115 $tokens = mpull($handles, 'getFullName', 'getPHID'); 115 116
+3 -2
src/applications/differential/search/DifferentialSearchIndexer.php
··· 104 104 } 105 105 106 106 $ccphids = $rev->getCCPHIDs(); 107 - $handles = id(new PhabricatorObjectHandleData($ccphids)) 107 + $handles = id(new PhabricatorHandleQuery()) 108 108 ->setViewer(PhabricatorUser::getOmnipotentUser()) 109 - ->loadHandles(); 109 + ->withPHIDs($ccphids) 110 + ->execute(); 110 111 111 112 foreach ($handles as $phid => $handle) { 112 113 $doc->addRelationship(
+3 -2
src/applications/diffusion/doorkeeper/DiffusionDoorkeeperCommitFeedStoryPublisher.php
··· 56 56 // audit) and "passive" (no action necessary) user are. 57 57 58 58 $auditor_phids = mpull($requests, 'getAuditorPHID'); 59 - $objects = id(new PhabricatorObjectHandleData($auditor_phids)) 59 + $objects = id(new PhabricatorObjectQuery()) 60 60 ->setViewer($this->getViewer()) 61 - ->loadObjects(); 61 + ->withPHIDs($auditor_phids) 62 + ->execute(); 62 63 63 64 $active = array(); 64 65 $passive = array();
+3 -2
src/applications/diffusion/events/DiffusionHovercardEventListener.php
··· 38 38 $author, 39 39 )); 40 40 41 - $handles = id(new PhabricatorObjectHandleData($phids)) 41 + $handles = id(new PhabricatorHandleQuery()) 42 42 ->setViewer($viewer) 43 - ->loadHandles(); 43 + ->withPHIDs($phids) 44 + ->execute(); 44 45 45 46 if ($author) { 46 47 $author = $handles[$author]->renderLink();
+3 -2
src/applications/files/query/PhabricatorFileSearchEngine.php
··· 46 46 PhabricatorSavedQuery $saved_query) { 47 47 48 48 $phids = $saved_query->getParameter('authorPHIDs', array()); 49 - $handles = id(new PhabricatorObjectHandleData($phids)) 49 + $handles = id(new PhabricatorHandleQuery()) 50 50 ->setViewer($this->requireViewer()) 51 - ->loadHandles(); 51 + ->withPHIDs($phids) 52 + ->execute(); 52 53 $author_tokens = mpull($handles, 'getFullName', 'getPHID'); 53 54 54 55 $explicit = $saved_query->getParameter('explicit');
+5 -4
src/applications/flag/conduit/ConduitAPI_flag_Method.php
··· 11 11 } 12 12 13 13 protected function attachHandleToFlag($flag, PhabricatorUser $user) { 14 - $flag->attachHandle( 15 - PhabricatorObjectHandleData::loadOneHandle( 16 - $flag->getObjectPHID(), 17 - $user)); 14 + $handle = id(new PhabricatorHandleQuery()) 15 + ->setViewer($user) 16 + ->withPHIDs(array($flag->getObjectPHID())) 17 + ->executeOne(); 18 + $flag->attachHandle($handle); 18 19 } 19 20 20 21 protected function buildFlagInfoDictionary($flag) {
+4 -1
src/applications/flag/controller/PhabricatorFlagEditController.php
··· 13 13 $user = $request->getUser(); 14 14 15 15 $phid = $this->phid; 16 - $handle = PhabricatorObjectHandleData::loadOneHandle($phid, $user); 16 + $handle = id(new PhabricatorHandleQuery()) 17 + ->setViewer($user) 18 + ->withPHIDs(array($phid)) 19 + ->executeOne(); 17 20 18 21 if (!$handle->isComplete()) { 19 22 return new Aphront404Response();
+4 -3
src/applications/herald/adapter/HeraldAdapter.php
··· 596 596 pht('Object already flagged.')); 597 597 } 598 598 599 - $handle = PhabricatorObjectHandleData::loadOneHandle( 600 - $phid, 601 - $user); 599 + $handle = id(new PhabricatorHandleQuery()) 600 + ->setViewer($user) 601 + ->withPHIDs(array($phid)) 602 + ->executeOne(); 602 603 603 604 $flag = new PhabricatorFlag(); 604 605 $flag->setOwnerPHID($user->getPHID());
+3 -2
src/applications/herald/query/HeraldRuleSearchEngine.php
··· 44 44 PhabricatorSavedQuery $saved_query) { 45 45 46 46 $phids = $saved_query->getParameter('authorPHIDs', array()); 47 - $handles = id(new PhabricatorObjectHandleData($phids)) 47 + $handles = id(new PhabricatorHandleQuery()) 48 48 ->setViewer($this->requireViewer()) 49 - ->loadHandles(); 49 + ->withPHIDs($phids) 50 + ->execute(); 50 51 $author_tokens = mpull($handles, 'getFullName', 'getPHID'); 51 52 52 53 $content_type = $saved_query->getParameter('contentType');
+3 -2
src/applications/legalpad/query/LegalpadDocumentSearchEngine.php
··· 49 49 $contributor_phids = $saved_query->getParameter( 50 50 'contributorPHIDs', array()); 51 51 $phids = array_merge($creator_phids, $contributor_phids); 52 - $handles = id(new PhabricatorObjectHandleData($phids)) 52 + $handles = id(new PhabricatorHandleQuery()) 53 53 ->setViewer($this->requireViewer()) 54 - ->loadHandles(); 54 + ->withPHIDs($phids) 55 + ->execute(); 55 56 $tokens = mpull($handles, 'getFullName', 'getPHID'); 56 57 57 58 $form
+4 -2
src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php
··· 65 65 try { 66 66 $taskgen = newv($type, array()); 67 67 $object = $taskgen->generate(); 68 - $handle = PhabricatorObjectHandleData::loadOneHandle($object->getPHID(), 69 - $admin); 68 + $handle = id(new PhabricatorHandleQuery()) 69 + ->setViewer($admin) 70 + ->withPHIDs(array($object->getPHID())) 71 + ->executeOne(); 70 72 echo "Generated ".$handle->getTypeName().": ". 71 73 $handle->getFullName()."\n"; 72 74 } catch (PhutilMissingSymbolException $ex) {
+3 -2
src/applications/macro/query/PhabricatorMacroSearchEngine.php
··· 66 66 PhabricatorSavedQuery $saved_query) { 67 67 68 68 $phids = $saved_query->getParameter('authorPHIDs', array()); 69 - $handles = id(new PhabricatorObjectHandleData($phids)) 69 + $handles = id(new PhabricatorHandleQuery()) 70 70 ->setViewer($this->requireViewer()) 71 - ->loadHandles(); 71 + ->withPHIDs($phids) 72 + ->execute(); 72 73 $author_tokens = mpull($handles, 'getFullName', 'getPHID'); 73 74 74 75 $status = $saved_query->getParameter('status');
+5 -7
src/applications/maniphest/ManiphestTaskQuery.php
··· 511 511 } 512 512 513 513 $projects = id(new PhabricatorProjectQuery()) 514 - ->setViewer($this->viewer) 514 + ->setViewer($this->getViewer()) 515 515 ->withMemberPHIDs($this->anyUserProjectPHIDs) 516 516 ->execute(); 517 517 $any_user_project_phids = mpull($projects, 'getPHID'); ··· 661 661 } 662 662 } 663 663 664 - // TODO: This should use the query's viewer once this class extends 665 - // PhabricatorPolicyQuery (T603). 666 - 667 - $handles = id(new PhabricatorObjectHandleData(array_keys($project_phids))) 668 - ->setViewer(PhabricatorUser::getOmnipotentUser()) 669 - ->loadHandles(); 664 + $handles = id(new PhabricatorHandleQuery()) 665 + ->setViewer($this->getViewer()) 666 + ->withPHIDs(array_keys($project_phids)) 667 + ->execute(); 670 668 671 669 $max = 1; 672 670 foreach ($handles as $handle) {
+3 -2
src/applications/maniphest/controller/ManiphestController.php
··· 92 92 $phids[] = $task->getOwnerPHID(); 93 93 } 94 94 95 - $handles = id(new PhabricatorObjectHandleData($phids)) 95 + $handles = id(new PhabricatorHandleQuery()) 96 96 ->setViewer($user) 97 - ->loadHandles(); 97 + ->withPHIDs($phids) 98 + ->execute(); 98 99 99 100 $view = id(new ManiphestTaskListView()) 100 101 ->setUser($user)
+3 -2
src/applications/maniphest/controller/ManiphestTaskListController.php
··· 578 578 $any_project_phids, 579 579 $any_user_project_phids, 580 580 array_mergev(mpull($data, 'getProjectPHIDs'))); 581 - $handles = id(new PhabricatorObjectHandleData($handle_phids)) 581 + $handles = id(new PhabricatorHandleQuery()) 582 582 ->setViewer($viewer) 583 - ->loadHandles(); 583 + ->withPHIDs($handle_phids) 584 + ->execute(); 584 585 585 586 switch ($search_query->getParameter('group')) { 586 587 case 'priority':
+7 -5
src/applications/maniphest/editor/ManiphestTransactionEditor.php
··· 129 129 break; 130 130 case ManiphestTransactionType::TYPE_OWNER: 131 131 if ($new) { 132 - $handles = id(new PhabricatorObjectHandleData(array($new))) 132 + $handle = id(new PhabricatorHandleQuery()) 133 133 ->setViewer($this->getActor()) 134 - ->loadHandles(); 135 - $task->setOwnerOrdering($handles[$new]->getName()); 134 + ->withPHIDs(array($new)) 135 + ->executeOne(); 136 + $task->setOwnerOrdering($handle->getName()); 136 137 } else { 137 138 $task->setOwnerOrdering(null); 138 139 } ··· 226 227 } 227 228 $phids = array_keys($phids); 228 229 229 - $handles = id(new PhabricatorObjectHandleData($phids)) 230 + $handles = id(new PhabricatorHandleQuery()) 230 231 ->setViewer($this->getActor()) 231 - ->loadHandles(); 232 + ->withPHIDs($phids) 233 + ->execute(); 232 234 233 235 $view = new ManiphestTransactionDetailView(); 234 236 $view->setTransactionGroup($transactions);
+3 -2
src/applications/maniphest/event/ManiphestHovercardEventListener.php
··· 97 97 } 98 98 99 99 protected function loadHandles(array $phids, $viewer) { 100 - return id(new PhabricatorObjectHandleData($phids)) 100 + return id(new PhabricatorHandleQuery()) 101 101 ->setViewer($viewer) 102 - ->loadHandles(); 102 + ->withPHIDs($phids) 103 + ->execute(); 103 104 } 104 105 105 106 }
+3 -2
src/applications/maniphest/search/ManiphestSearchIndexer.php
··· 110 110 111 111 // We need to load handles here since non-users may subscribe (mailing 112 112 // lists, e.g.) 113 - $handles = id(new PhabricatorObjectHandleData(array_keys($ccs))) 113 + $handles = id(new PhabricatorHandleQuery()) 114 114 ->setViewer(PhabricatorUser::getOmnipotentUser()) 115 - ->loadHandles(); 115 + ->withPHIDs(array_keys($ccs)) 116 + ->execute(); 116 117 foreach ($ccs as $cc => $time) { 117 118 $doc->addRelationship( 118 119 PhabricatorSearchRelationship::RELATIONSHIP_SUBSCRIBER,
+3 -2
src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php
··· 36 36 $phids = array_merge( 37 37 mpull($mails, 'getRelatedPHID'), 38 38 mpull($mails, 'getAuthorPHID')); 39 - $handles = id(new PhabricatorObjectHandleData($phids)) 39 + $handles = id(new PhabricatorHandleQuery()) 40 40 ->setViewer($viewer) 41 - ->loadHandles(); 41 + ->withPHIDs($phids) 42 + ->execute(); 42 43 43 44 foreach (array_reverse($mails) as $mail) { 44 45 $console->writeOut(
+5 -6
src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php
··· 87 87 $template->setBody($this->buildErrorMailBody($error, $mail)); 88 88 $template->setRelatedPHID($mail->getRelatedPHID()); 89 89 $phid = $this->getActor()->getPHID(); 90 - $tos = array( 91 - $phid => PhabricatorObjectHandleData::loadOneHandle( 92 - $phid, 93 - // TODO: This could be cleaner (T603). 94 - PhabricatorUser::getOmnipotentUser()), 95 - ); 90 + $handle = id(new PhabricatorHandleQuery()) 91 + ->setViewer($this->getActor()) 92 + ->withPHIDs(array($phid)) 93 + ->executeOne(); 94 + $tos = array($phid => $handle); 96 95 $mails = $this->multiplexMail($template, $tos, array()); 97 96 98 97 foreach ($mails as $email) {
+3 -2
src/applications/owners/mail/PackageMail.php
··· 80 80 $this->mailTo, 81 81 array($package->getActorPHID()), 82 82 array_keys($this->paths)); 83 - $this->handles = id(new PhabricatorObjectHandleData($phids)) 83 + $this->handles = id(new PhabricatorHandleQuery()) 84 84 ->setViewer($this->getActor()) 85 - ->loadHandles(); 85 + ->withPHIDs($phids) 86 + ->execute(); 86 87 } 87 88 88 89 final protected function renderSummarySection() {
+3 -2
src/applications/owners/mail/PackageModifyMail.php
··· 59 59 array( 60 60 $this->getPackage()->getActorPHID(), 61 61 )); 62 - $this->handles = id(new PhabricatorObjectHandleData($phids)) 62 + $this->handles = id(new PhabricatorHandleQuery()) 63 63 ->setViewer($this->getActor()) 64 - ->loadHandles(); 64 + ->withPHIDs($phids) 65 + ->execute(); 65 66 } 66 67 67 68 protected function renderDescriptionSection() {
+3 -2
src/applications/paste/query/PhabricatorPasteSearchEngine.php
··· 48 48 AphrontFormView $form, 49 49 PhabricatorSavedQuery $saved_query) { 50 50 $phids = $saved_query->getParameter('authorPHIDs', array()); 51 - $handles = id(new PhabricatorObjectHandleData($phids)) 51 + $handles = id(new PhabricatorHandleQuery()) 52 52 ->setViewer($this->requireViewer()) 53 - ->loadHandles(); 53 + ->withPHIDs($phids) 54 + ->execute(); 54 55 $author_tokens = mpull($handles, 'getFullName', 'getPHID'); 55 56 56 57 $languages = $saved_query->getParameter('languages', array());
+4 -3
src/applications/phame/controller/blog/PhameBlogFeedController.php
··· 62 62 } 63 63 $engine->process(); 64 64 65 - $bloggers = mpull($posts, 'getBloggerPHID'); 66 - $bloggers = id(new PhabricatorObjectHandleData($bloggers)) 65 + $blogger_phids = mpull($posts, 'getBloggerPHID'); 66 + $bloggers = id(new PhabricatorHandleQuery()) 67 67 ->setViewer($user) 68 - ->loadHandles(); 68 + ->withPHIDs($blogger_phids) 69 + ->execute(); 69 70 70 71 foreach ($posts as $post) { 71 72 $content[] = hsprintf('<entry>');
+4 -3
src/applications/phame/controller/post/PhamePostEditController.php
··· 94 94 } 95 95 } 96 96 97 - $handle = PhabricatorObjectHandleData::loadOneHandle( 98 - $post->getBlogPHID(), 99 - $user); 97 + $handle = id(new PhabricatorHandleQuery()) 98 + ->withViewer($user) 99 + ->withPHIDs(array($post->getBlogPHID())) 100 + ->executeOne(); 100 101 101 102 $form = id(new AphrontFormView()) 102 103 ->setUser($user)
+3 -2
src/applications/phame/skins/PhameBasicBlogSkin.php
··· 294 294 $phids[] = $post->getBloggerPHID(); 295 295 } 296 296 297 - $handles = id(new PhabricatorObjectHandleData($phids)) 297 + $handles = id(new PhabricatorHandleQuery()) 298 298 ->setViewer($user) 299 - ->loadHandles(); 299 + ->withPHIDs($phids) 300 + ->execute(); 300 301 301 302 $engine->process(); 302 303
-37
src/applications/phame/storage/PhameBlog.php
··· 93 93 return $valid; 94 94 } 95 95 96 - public function loadBloggerPHIDs() { 97 - if (!$this->getPHID()) { 98 - return $this; 99 - } 100 - 101 - if ($this->bloggerPHIDs) { 102 - return $this; 103 - } 104 - 105 - $this->bloggerPHIDs = PhabricatorEdgeQuery::loadDestinationPHIDs( 106 - $this->getPHID(), 107 - PhabricatorEdgeConfig::TYPE_BLOG_HAS_BLOGGER); 108 - 109 - return $this; 110 - } 111 - 112 96 public function getBloggerPHIDs() { 113 97 return $this->assertAttached($this->bloggerPHIDs); 114 - } 115 - 116 - public function loadBloggers() { 117 - if ($this->bloggers) { 118 - return $this->bloggers; 119 - } 120 - 121 - $blogger_phids = $this->loadBloggerPHIDs()->getBloggerPHIDs(); 122 - 123 - if (empty($blogger_phids)) { 124 - return array(); 125 - } 126 - 127 - $bloggers = id(new PhabricatorObjectHandleData($blogger_phids)) 128 - // TODO: This should be Query-based (T603). 129 - ->setViewer(PhabricatorUser::getOmnipotentUser()) 130 - ->loadHandles(); 131 - 132 - $this->attachBloggers($bloggers); 133 - 134 - return $this; 135 98 } 136 99 137 100 public function attachBloggers(array $bloggers) {
+1 -1
src/applications/phid/PhabricatorObjectHandle.php
··· 130 130 * completely loaded (e.g., the type or data for the PHID could not be 131 131 * identified or located). 132 132 * 133 - * Basically, @{class:PhabricatorObjectHandleData} gives you back a handle for 133 + * Basically, @{class:PhabricatorHandleQuery} gives you back a handle for 134 134 * any PHID you give it, but it gives you a complete handle only for valid 135 135 * PHIDs. 136 136 *
+3 -3
src/applications/phid/conduit/ConduitAPI_phid_info_Method.php
··· 38 38 39 39 $phid = $request->getValue('phid'); 40 40 41 - $handles = id(new PhabricatorObjectHandleData(array($phid))) 41 + $handle = id(new PhabricatorHandleQuery()) 42 42 ->setViewer($request->getUser()) 43 - ->loadHandles(); 43 + ->withPHIDs(array($phid)) 44 + ->executeOne(); 44 45 45 - $handle = $handles[$phid]; 46 46 if (!$handle->isComplete()) { 47 47 throw new ConduitException('ERR-BAD-PHID'); 48 48 }
+3 -2
src/applications/phid/conduit/ConduitAPI_phid_lookup_Method.php
··· 33 33 $query->execute(); 34 34 $name_map = $query->getNamedResults(); 35 35 36 - $handles = id(new PhabricatorObjectHandleData(mpull($name_map, 'getPHID'))) 36 + $handles = id(new PhabricatorHandleQuery()) 37 37 ->setViewer($request->getUser()) 38 - ->loadHandles(); 38 + ->withPHIDs(mpull($name_map, 'getPHID')) 39 + ->execute(); 39 40 40 41 $result = array(); 41 42 foreach ($name_map as $name => $object) {
+3 -2
src/applications/phid/conduit/ConduitAPI_phid_query_Method.php
··· 28 28 29 29 $phids = $request->getValue('phids'); 30 30 31 - $handles = id(new PhabricatorObjectHandleData($phids)) 31 + $handles = id(new PhabricatorHandleQuery()) 32 32 ->setViewer($request->getUser()) 33 - ->loadHandles(); 33 + ->withPHIDs($phids) 34 + ->execute(); 34 35 35 36 $result = array(); 36 37 foreach ($handles as $phid => $handle) {
-83
src/applications/phid/handle/PhabricatorObjectHandleData.php
··· 1 - <?php 2 - 3 - final class PhabricatorObjectHandleData { 4 - 5 - private $phids; 6 - private $viewer; 7 - 8 - public function __construct(array $phids) { 9 - $this->phids = array_unique($phids); 10 - } 11 - 12 - public function setViewer(PhabricatorUser $viewer) { 13 - $this->viewer = $viewer; 14 - return $this; 15 - } 16 - 17 - public static function loadOneHandle($phid, PhabricatorUser $viewer) { 18 - $query = new PhabricatorObjectHandleData(array($phid)); 19 - $query->setViewer($viewer); 20 - $handles = $query->loadHandles(); 21 - return $handles[$phid]; 22 - } 23 - 24 - public function loadObjects() { 25 - $phids = array_fuse($this->phids); 26 - 27 - return id(new PhabricatorObjectQuery()) 28 - ->setViewer($this->viewer) 29 - ->withPHIDs($phids) 30 - ->execute(); 31 - } 32 - 33 - public function loadHandles() { 34 - 35 - $application_handles = id(new PhabricatorHandleQuery()) 36 - ->setViewer($this->viewer) 37 - ->withPHIDs($this->phids) 38 - ->execute(); 39 - 40 - // TODO: Move the rest of this into Applications. 41 - 42 - $phid_map = array_fuse($this->phids); 43 - foreach ($application_handles as $handle) { 44 - if ($handle->isComplete()) { 45 - unset($phid_map[$handle->getPHID()]); 46 - } 47 - } 48 - 49 - $types = phid_group_by_type($phid_map); 50 - 51 - $handles = array(); 52 - foreach ($types as $type => $phids) { 53 - switch ($type) { 54 - case PhabricatorPHIDConstants::PHID_TYPE_MAGIC: 55 - // Black magic! 56 - foreach ($phids as $phid) { 57 - $handle = new PhabricatorObjectHandle(); 58 - $handle->setPHID($phid); 59 - $handle->setType($type); 60 - switch ($phid) { 61 - case ManiphestTaskOwner::OWNER_UP_FOR_GRABS: 62 - $handle->setName('Up For Grabs'); 63 - $handle->setFullName('upforgrabs (Up For Grabs)'); 64 - $handle->setComplete(true); 65 - break; 66 - case ManiphestTaskOwner::PROJECT_NO_PROJECT: 67 - $handle->setName('No Project'); 68 - $handle->setFullName('noproject (No Project)'); 69 - $handle->setComplete(true); 70 - break; 71 - default: 72 - $handle->setName('Foul Magicks'); 73 - break; 74 - } 75 - $handles[$phid] = $handle; 76 - } 77 - break; 78 - } 79 - } 80 - 81 - return $handles + $application_handles; 82 - } 83 - }
+3 -2
src/applications/pholio/controller/PholioMockEditController.php
··· 225 225 // NOTE: Make this show up correctly on the rendered form. 226 226 $mock->setViewPolicy($v_view); 227 227 228 - $handles = id(new PhabricatorObjectHandleData($v_cc)) 228 + $handles = id(new PhabricatorHandleQuery()) 229 229 ->setViewer($user) 230 - ->loadHandles(); 230 + ->withPHIDs($v_cc) 231 + ->execute(); 231 232 232 233 $cc_tokens = mpull($handles, 'getFullName', 'getPHID'); 233 234
+3 -2
src/applications/pholio/query/PholioMockSearchEngine.php
··· 27 27 PhabricatorSavedQuery $saved_query) { 28 28 29 29 $phids = $saved_query->getParameter('authorPHIDs', array()); 30 - $handles = id(new PhabricatorObjectHandleData($phids)) 30 + $handles = id(new PhabricatorHandleQuery()) 31 31 ->setViewer($this->requireViewer()) 32 - ->loadHandles(); 32 + ->withPHIDs($phids) 33 + ->execute(); 33 34 $author_tokens = mpull($handles, 'getFullName', 'getPHID'); 34 35 35 36 $form
+3 -2
src/applications/phrequent/controller/PhrequentListController.php
··· 146 146 ->setUser($user) 147 147 ->setAction($this->getApplicationURI("/view/custom/")); 148 148 149 - $user_handles = id(new PhabricatorObjectHandleData($user_phids)) 149 + $user_handles = id(new PhabricatorHandleQuery()) 150 150 ->setViewer($user) 151 - ->loadHandles(); 151 + ->withPHIDs($user_phids) 152 + ->execute(); 152 153 $tokens = array(); 153 154 foreach ($user_phids as $phid) { 154 155 $tokens[$phid] = $user_handles[$phid]->getFullName();
+4 -3
src/applications/policy/filter/PhabricatorPolicyFilter.php
··· 272 272 $who = "No one can {$verb} this object."; 273 273 break; 274 274 default: 275 - $handle = PhabricatorObjectHandleData::loadOneHandle( 276 - $policy, 277 - $this->viewer); 275 + $handle = id(new PhabricatorHandleQuery()) 276 + ->setViewer($this->viewer) 277 + ->withPHIDs(array($policy)) 278 + ->executeOne(); 278 279 279 280 $type = phid_get_type($policy); 280 281 if ($type == PhabricatorProjectPHIDTypeProject::TYPECONST) {
+3 -2
src/applications/policy/query/PhabricatorPolicyQuery.php
··· 100 100 $other_policies = array_diff_key($other_policies, $results); 101 101 102 102 if ($other_policies) { 103 - $handles = id(new PhabricatorObjectHandleData($other_policies)) 103 + $handles = id(new PhabricatorHandleQuery()) 104 104 ->setViewer($this->viewer) 105 - ->loadHandles(); 105 + ->withPHIDs($other_policies) 106 + ->execute(); 106 107 foreach ($other_policies as $phid) { 107 108 $results[$phid] = PhabricatorPolicy::newFromPolicyAndHandle( 108 109 $phid,
+3 -2
src/applications/ponder/query/PonderQuestionSearchEngine.php
··· 57 57 'status', PonderQuestionStatus::STATUS_OPEN); 58 58 59 59 $phids = array_merge($author_phids, $answerer_phids); 60 - $handles = id(new PhabricatorObjectHandleData($phids)) 60 + $handles = id(new PhabricatorHandleQuery()) 61 61 ->setViewer($this->requireViewer()) 62 - ->loadHandles(); 62 + ->withPHIDs($phids) 63 + ->execute(); 63 64 $tokens = mpull($handles, 'getFullName', 'getPHID'); 64 65 65 66 $author_tokens = array_select_keys($tokens, $author_phids);
+3 -2
src/applications/project/query/PhabricatorProjectSearchEngine.php
··· 36 36 PhabricatorSavedQuery $saved_query) { 37 37 38 38 $phids = $saved_query->getParameter('memberPHIDs', array()); 39 - $handles = id(new PhabricatorObjectHandleData($phids)) 39 + $handles = id(new PhabricatorHandleQuery()) 40 40 ->setViewer($this->requireViewer()) 41 - ->loadHandles(); 41 + ->withPHIDs($phids) 42 + ->execute(); 42 43 $member_tokens = mpull($handles, 'getFullName', 'getPHID'); 43 44 44 45 $status = $saved_query->getParameter('status');
+6 -4
src/applications/releeph/conduit/ConduitAPI_releeph_request_Method.php
··· 53 53 ->setErrorDescription($ex->getMessage()); 54 54 } 55 55 } 56 + $requested_commit_phids = mpull($requested_commits, 'getPHID'); 56 57 57 58 // Find any existing requests that clash on the commit id, for this branch 58 59 $existing_releeph_requests = id(new ReleephRequest())->loadAllWhere( 59 60 'requestCommitPHID IN (%Ls) AND branchID = %d', 60 - mpull($requested_commits, 'getPHID'), 61 + $requested_commit_phids, 61 62 $releeph_branch->getID()); 62 63 $existing_releeph_requests = mpull( 63 64 $existing_releeph_requests, ··· 73 74 } 74 75 75 76 $results = array(); 77 + $handles = id(new PhabricatorHandleQuery()) 78 + ->setViewer($user) 79 + ->withPHIDs($requested_commit_phids) 80 + ->execute(); 76 81 foreach ($requested_commits as $thing => $commit) { 77 82 $phid = $commit->getPHID(); 78 - $handles = id(new PhabricatorObjectHandleData(array($phid))) 79 - ->setViewer($user) 80 - ->loadHandles(); 81 83 $name = id($handles[$phid])->getName(); 82 84 83 85 $releeph_request = null;
+3 -2
src/applications/releeph/conduit/work/ConduitAPI_releephwork_getbranch_Method.php
··· 34 34 35 35 $cut_phid = $branch->getCutPointCommitPHID(); 36 36 $phids = array($cut_phid); 37 - $handles = id(new PhabricatorObjectHandleData($phids)) 37 + $handles = id(new PhabricatorHandleQuery()) 38 38 ->setViewer($request->getUser()) 39 - ->loadHandles(); 39 + ->withPHIDs($phids) 40 + ->execute(); 40 41 41 42 $project = $branch->getProject(); 42 43 $repo = $project->getRepository();
+3 -2
src/applications/releeph/conduit/work/ConduitAPI_releephwork_getbranchcommitmessage_Method.php
··· 41 41 $cut_phid, 42 42 ); 43 43 44 - $handles = id(new PhabricatorObjectHandleData($phids)) 44 + $handles = id(new PhabricatorHandleQuery()) 45 45 ->setViewer($request->getUser()) 46 - ->loadHandles(); 46 + ->withPHIDs($phids) 47 + ->execute(); 47 48 48 49 $h_branch = $handles[$branch->getPHID()]; 49 50 $h_project = $handles[$project->getPHID()];
+3 -2
src/applications/releeph/conduit/work/ConduitAPI_releephwork_nextrequest_Method.php
··· 117 117 } 118 118 119 119 $phids[] = $releeph_request->getPHID(); 120 - $handles = id(new PhabricatorObjectHandleData($phids)) 120 + $handles = id(new PhabricatorHandleQuery()) 121 121 ->setViewer($request->getUser()) 122 - ->loadHandles(); 122 + ->withPHIDs($phids) 123 + ->execute(); 123 124 124 125 $diff_name = null; 125 126 if ($diff_rev) {
+3 -2
src/applications/releeph/controller/branch/ReleephBranchEditController.php
··· 42 42 $phids[] = $creator_phid = $releeph_branch->getCreatedByUserPHID(); 43 43 $phids[] = $cut_commit_phid = $releeph_branch->getCutPointCommitPHID(); 44 44 45 - $handles = id(new PhabricatorObjectHandleData($phids)) 45 + $handles = id(new PhabricatorHandleQuery()) 46 46 ->setViewer($request->getUser()) 47 - ->loadHandles(); 47 + ->withPHIDs($phids) 48 + ->execute(); 48 49 49 50 $form = id(new AphrontFormView()) 50 51 ->setUser($request->getUser())
+3 -2
src/applications/releeph/controller/project/ReleephProjectEditController.php
··· 130 130 'pushers', 131 131 $this->getReleephProject()->getDetail('pushers', array())); 132 132 133 - $handles = id(new PhabricatorObjectHandleData($pusher_phids)) 133 + $handles = id(new PhabricatorHandleQuery()) 134 134 ->setViewer($request->getUser()) 135 - ->loadHandles(); 135 + ->withPHIDs($pusher_phids) 136 + ->execute(); 136 137 137 138 $pusher_tokens = array(); 138 139 foreach ($pusher_phids as $phid) {
+4 -6
src/applications/releeph/editor/ReleephBranchEditor.php
··· 24 24 $template = ReleephBranchTemplate::getRequiredDefaultTemplate(); 25 25 } 26 26 27 - $cut_point_handle = head( 28 - id(new PhabricatorObjectHandleData(array($cut_point->getPHID()))) 29 - // We'll assume that whoever found the $cut_point has passed privacy 30 - // checks. 31 - ->setViewer($this->requireActor()) 32 - ->loadHandles()); 27 + $cut_point_handle = id(new PhabricatorHandleQuery()) 28 + ->setViewer($this->requireActor()) 29 + ->withPHIDs(array($cut_point->getPHID())) 30 + ->executeOne(); 33 31 34 32 list($name, $errors) = id(new ReleephBranchTemplate()) 35 33 ->setCommitHandle($cut_point_handle)
+3 -2
src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php
··· 49 49 $pusher_phids = $this->getReleephProject()->getPushers(); 50 50 51 51 $phids = array_unique($pusher_phids + array_keys($intents)); 52 - $handles = id(new PhabricatorObjectHandleData($phids)) 52 + $handles = id(new PhabricatorHandleQuery()) 53 53 ->setViewer($this->getUser()) 54 - ->loadHandles(); 54 + ->withPHIDs($phids) 55 + ->execute(); 55 56 56 57 $tokens = array(); 57 58 foreach ($phids as $phid) {
+4 -3
src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php
··· 40 40 41 41 public function renderValueForCommitMessage() { 42 42 $phid = $this->getReleephRequest()->getRequestUserPHID(); 43 - $handles = id(new PhabricatorObjectHandleData(array($phid))) 43 + $handle = id(new PhabricatorHandleQuery()) 44 44 ->setViewer($this->getUser()) 45 - ->loadHandles(); 46 - return $handles[$phid]->getName(); 45 + ->withPHIDs(array($phid)) 46 + ->executeOne(); 47 + return $handle->getName(); 47 48 } 48 49 49 50 }
+3 -2
src/applications/releeph/query/ReleephRequestSearchEngine.php
··· 60 60 PhabricatorSavedQuery $saved_query) { 61 61 62 62 $phids = $saved_query->getParameter('requestorPHIDs', array()); 63 - $handles = id(new PhabricatorObjectHandleData($phids)) 63 + $handles = id(new PhabricatorHandleQuery()) 64 64 ->setViewer($this->requireViewer()) 65 - ->loadHandles(); 65 + ->withPHIDs($phids) 66 + ->execute(); 66 67 $requestor_tokens = mpull($handles, 'getFullName', 'getPHID'); 67 68 68 69 $form
+3 -2
src/applications/releeph/storage/ReleephBranch.php
··· 130 130 $phids_to_phetch[] = $rr->loadRequestCommitDiffPHID(); 131 131 } 132 132 } 133 - $handles = id(new PhabricatorObjectHandleData($phids_to_phetch)) 133 + $handles = id(new PhabricatorHandleQuery()) 134 134 ->setViewer($user) 135 - ->loadHandles(); 135 + ->withPHIDs($phids_to_phetch) 136 + ->execute(); 136 137 return $handles; 137 138 } 138 139
+4 -3
src/applications/releeph/view/user/ReleephUserView.php
··· 39 39 if ($todo) { 40 40 self::$handles = array_merge( 41 41 self::$handles, 42 - id(new PhabricatorObjectHandleData($todo)) 43 - ->setViewer($this->getUser()) 44 - ->loadHandles()); 42 + id(new PhabricatorHandleQuery()) 43 + ->setViewer($this->getUser()) 44 + ->withPHIDs($todo) 45 + ->execute()); 45 46 $this->loadInner($todo); 46 47 } 47 48 }
+7 -5
src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php
··· 83 83 $commit->getPHID(), 84 84 )); 85 85 86 - $handles = id(new PhabricatorObjectHandleData($phids)) 86 + $handles = id(new PhabricatorHandleQuery()) 87 87 ->setViewer(PhabricatorUser::getOmnipotentUser()) 88 - ->loadHandles(); 88 + ->withPHIDs($phids) 89 + ->execute(); 89 90 90 91 $commit_handle = $handles[$commit->getPHID()]; 91 92 $commit_name = $commit_handle->getName(); ··· 163 164 164 165 $mails = $reply_handler->multiplexMail( 165 166 $template, 166 - id(new PhabricatorObjectHandleData($email_phids)) 167 - ->setViewer(PhabricatorUser::getOmnipotentUser()) 168 - ->loadHandles(), 167 + id(new PhabricatorHandleQuery()) 168 + ->setViewer(PhabricatorUser::getOmnipotentUser()) 169 + ->withPHIDs($email_phids) 170 + ->execute(), 169 171 array()); 170 172 171 173 foreach ($mails as $mail) {
+5 -3
src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
··· 226 226 if (!$user_phid) { 227 227 return $default; 228 228 } 229 - $handle = PhabricatorObjectHandleData::loadOneHandle( 230 - $user_phid, 231 - $actor); 229 + $handle = id(new PhabricatorHandleQuery()) 230 + ->setViewer($actor) 231 + ->withPHIDs(array($user_phid)) 232 + ->executeOne(); 233 + 232 234 return '@'.$handle->getName(); 233 235 } 234 236
+8 -6
src/applications/search/controller/PhabricatorSearchAttachController.php
··· 26 26 $request = $this->getRequest(); 27 27 $user = $request->getUser(); 28 28 29 - $handle_data = new PhabricatorObjectHandleData(array($this->phid)); 30 - $handle_data->setViewer($user); 31 - $handles = $handle_data->loadHandles(); 32 - $handle = $handles[$this->phid]; 29 + $handle = id(New PhabricatorHandleQuery()) 30 + ->setViewer($user) 31 + ->withPHIDs(array($this->phid)) 32 + ->executeOne(); 33 33 34 34 $object_type = $handle->getType(); 35 35 $attach_type = $this->type; 36 36 37 - $objects = $handle_data->loadObjects(); 38 - $object = idx($objects, $this->phid); 37 + $object = id(new PhabricatorObjectQuery()) 38 + ->setViewer($user) 39 + ->withPHIDs(array($this->phid)) 40 + ->executeOne(); 39 41 40 42 if (!$object) { 41 43 return new Aphront404Response();
+8 -5
src/applications/search/controller/PhabricatorSearchController.php
··· 233 233 } 234 234 235 235 if ($results) { 236 - 237 - $loader = id(new PhabricatorObjectHandleData($results)) 238 - ->setViewer($user); 239 - $handles = $loader->loadHandles(); 240 - $objects = $loader->loadObjects(); 236 + $handles = id(new PhabricatorHandleQuery()) 237 + ->setViewer($user) 238 + ->withPHIDs($results) 239 + ->execute(); 240 + $objects = id(new PhabricatorObjectQuery()) 241 + ->setViewer($user) 242 + ->withPHIDs($results) 243 + ->execute(); 241 244 $results = array(); 242 245 foreach ($handles as $phid => $handle) { 243 246 $view = id(new PhabricatorSearchResultView())
+8 -4
src/applications/search/controller/PhabricatorSearchHovercardController.php
··· 12 12 13 13 $phids = $request->getArr('phids'); 14 14 15 - $handle_data = new PhabricatorObjectHandleData($phids); 16 - $handle_data->setViewer($user); 17 - $handles = $handle_data->loadHandles(); 18 - $objects = $handle_data->loadObjects(); 15 + $handles = id(new PhabricatorHandleQuery()) 16 + ->setViewer($user) 17 + ->withPHIDs($phids) 18 + ->execute(); 19 + $objects = id(new PhabricatorObjectQuery()) 20 + ->setViewer($user) 21 + ->withPHIDs($phids) 22 + ->execute(); 19 23 20 24 $cards = array(); 21 25
+4 -3
src/applications/search/engine/PhabricatorSearchEngineElastic.php
··· 25 25 26 26 $type = $doc->getDocumentType(); 27 27 $phid = $doc->getPHID(); 28 - $handle = PhabricatorObjectHandleData::loadOneHandle( 29 - $phid, 30 - PhabricatorUser::getOmnipotentUser()); 28 + $handle = id(new PhabricatorHandleQuery()) 29 + ->setViewer(PhabricatorUser::getOmnipotentUser()) 30 + ->withPHIDs(array($phid)) 31 + ->executeOne(); 31 32 32 33 // URL is not used internally but it can be useful externally. 33 34 $spec = array(
+3 -2
src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php
··· 29 29 AphrontFormView $form, 30 30 PhabricatorSavedQuery $saved_query) { 31 31 $phids = $saved_query->getParameter('authorPHIDs', array()); 32 - $handles = id(new PhabricatorObjectHandleData($phids)) 32 + $handles = id(new PhabricatorHandleQuery()) 33 33 ->setViewer($this->requireViewer()) 34 - ->loadHandles(); 34 + ->withPHIDs($phids) 35 + ->execute(); 35 36 $author_tokens = mpull($handles, 'getFullName', 'getPHID'); 36 37 37 38 $voted = $saved_query->getParameter('voted', false);
+3 -2
src/applications/slowvote/view/SlowvoteEmbedView.php
··· 36 36 } 37 37 $phids[] = $poll->getAuthorPHID(); 38 38 39 - $this->handles = id(new PhabricatorObjectHandleData($phids)) 39 + $this->handles = id(new PhabricatorHandleQuery()) 40 40 ->setViewer($this->getUser()) 41 - ->loadHandles(); 41 + ->withPHIDs($phids) 42 + ->execute(); 42 43 43 44 $options = $poll->getOptions(); 44 45
+7 -9
src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php
··· 32 32 $user = $request->getUser(); 33 33 $phid = $this->phid; 34 34 35 - // TODO: This is a policy test because `loadObjects()` is not currently 36 - // policy-aware. Once it is, we can collapse this. 37 - $handle = PhabricatorObjectHandleData::loadOneHandle($phid, $user); 38 - if (!$handle->isComplete()) { 39 - return new Aphront404Response(); 40 - } 35 + $handle = id(new PhabricatorHandleQuery()) 36 + ->setViewer($user) 37 + ->withPHIDs(array($phid)) 38 + ->executeOne(); 41 39 42 - $objects = id(new PhabricatorObjectHandleData(array($phid))) 40 + $object = id(new PhabricatorObjectQuery()) 43 41 ->setViewer($user) 44 - ->loadObjects(); 45 - $object = idx($objects, $phid); 42 + ->withPHIDs(array($phid)) 43 + ->executeOne(); 46 44 47 45 if (!($object instanceof PhabricatorSubscribableInterface)) { 48 46 return $this->buildErrorResponse(
+3 -2
src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php
··· 98 98 $subscribers = PhabricatorSubscribersQuery::loadSubscribersForPHID( 99 99 $object->getPHID()); 100 100 if ($subscribers) { 101 - $handles = id(new PhabricatorObjectHandleData($subscribers)) 101 + $handles = id(new PhabricatorHandleQuery()) 102 102 ->setViewer($user) 103 - ->loadHandles(); 103 + ->withPHIDs($subscribers) 104 + ->execute(); 104 105 $sub_view = array(); 105 106 foreach ($subscribers as $subscriber) { 106 107 $sub_view[] = $handles[$subscriber]->renderLink();
+4 -1
src/applications/tokens/controller/PhabricatorTokenGiveController.php
··· 12 12 $request = $this->getRequest(); 13 13 $user = $request->getUser(); 14 14 15 - $handle = PhabricatorObjectHandleData::loadOneHandle($this->phid, $user); 15 + $handle = id(new PhabricatorHandleQuery()) 16 + ->setViewer($user) 17 + ->withPHIDs(array($this->phid)) 18 + ->executeOne(); 16 19 if (!$handle->isComplete()) { 17 20 return new Aphront404Response(); 18 21 }
+3 -2
src/applications/tokens/controller/PhabricatorTokenGivenController.php
··· 18 18 $object_phids = mpull($tokens_given, 'getObjectPHID'); 19 19 $user_phids = mpull($tokens_given, 'getAuthorPHID'); 20 20 $handle_phids = array_merge($object_phids, $user_phids); 21 - $handles = id(new PhabricatorObjectHandleData($handle_phids)) 21 + $handles = id(new PhabricatorHandleQuery()) 22 22 ->setViewer($user) 23 - ->loadHandles(); 23 + ->withPHIDs($handle_phids) 24 + ->execute(); 24 25 } 25 26 26 27 $tokens = array();
+3 -2
src/applications/tokens/controller/PhabricatorTokenLeaderController.php
··· 19 19 $phids = array(); 20 20 if ($counts) { 21 21 $phids = mpull($objects, 'getPHID'); 22 - $handles = id(new PhabricatorObjectHandleData($phids)) 22 + $handles = id(new PhabricatorHandleQuery()) 23 23 ->setViewer($user) 24 - ->loadHandles(); 24 + ->withPHIDs($phids) 25 + ->execute(); 25 26 } 26 27 27 28 $list = new PHUIObjectItemListView();
+3 -3
src/applications/tokens/editor/PhabricatorTokenGivenEditor.php
··· 99 99 } 100 100 101 101 private function validateObject($object_phid) { 102 - $objects = id(new PhabricatorObjectHandleData(array($object_phid))) 102 + $object = id(new PhabricatorObjectQuery()) 103 103 ->setViewer($this->requireActor()) 104 - ->loadObjects(); 105 - $object = head($objects); 104 + ->withPHIDs(array($object_phid)) 105 + ->executeOne(); 106 106 107 107 if (!$object) { 108 108 throw new Exception("No such object!");
+3 -2
src/applications/tokens/event/PhabricatorTokenUIEventListener.php
··· 93 93 $tokens = mpull($tokens, null, 'getPHID'); 94 94 95 95 $author_phids = mpull($tokens_given, 'getAuthorPHID'); 96 - $handles = id(new PhabricatorObjectHandleData($author_phids)) 96 + $handles = id(new PhabricatorHandleQuery()) 97 97 ->setViewer($user) 98 - ->loadHandles(); 98 + ->withPHIDs($author_phids) 99 + ->execute(); 99 100 100 101 Javelin::initBehavior('phabricator-tooltips'); 101 102
+3 -2
src/applications/tokens/query/PhabricatorTokenGivenQuery.php
··· 72 72 return array(); 73 73 } 74 74 75 - $objects = id(new PhabricatorObjectHandleData($object_phids)) 75 + $objects = id(new PhabricatorObjectQuery()) 76 76 ->setViewer($this->getViewer()) 77 - ->loadObjects(); 77 + ->withPHIDs($object_phids) 78 + ->execute(); 78 79 79 80 foreach ($results as $key => $result) { 80 81 $phid = $result->getObjectPHID();
+3 -2
src/applications/tokens/query/PhabricatorTokenReceiverQuery.php
··· 19 19 } 20 20 21 21 public function willFilterPage(array $phids) { 22 - $objects = id(new PhabricatorObjectHandleData($phids)) 22 + $objects = id(new PhabricatorObjectQuery()) 23 23 ->setViewer($this->getViewer()) 24 - ->loadObjects(); 24 + ->withPHIDs($phids) 25 + ->execute(); 25 26 26 27 // Reorder the objects in the input order. 27 28 $objects = array_select_keys($objects, $phids);
+4 -4
src/applications/transactions/controller/PhabricatorApplicationTransactionCommentEditController.php
··· 19 19 ->executeOne(); 20 20 21 21 if (!$xaction) { 22 - // TODO: This may also mean you don't have permission to edit the object, 23 - // but we can't make that distinction via PhabricatorObjectHandleData 24 - // at the moment. 25 22 return new Aphront404Response(); 26 23 } 27 24 ··· 32 29 } 33 30 34 31 $obj_phid = $xaction->getObjectPHID(); 35 - $obj_handle = PhabricatorObjectHandleData::loadOneHandle($obj_phid, $user); 32 + $obj_handle = id(new PhabricatorHandleQuery()) 33 + ->setViewer($user) 34 + ->withPHIDs(array($obj_phid)) 35 + ->executeOne(); 36 36 37 37 if ($request->isDialogFormPost()) { 38 38 $text = $request->getStr('text');
+4 -4
src/applications/transactions/controller/PhabricatorApplicationTransactionCommentHistoryController.php
··· 19 19 ->executeOne(); 20 20 21 21 if (!$xaction) { 22 - // TODO: This may also mean you don't have permission to edit the object, 23 - // but we can't make that distinction via PhabricatorObjectHandleData 24 - // at the moment. 25 22 return new Aphront404Response(); 26 23 } 27 24 ··· 53 50 } 54 51 55 52 $obj_phid = $xaction->getObjectPHID(); 56 - $obj_handle = PhabricatorObjectHandleData::loadOneHandle($obj_phid, $user); 53 + $obj_handle = id(new PhabricatorHandleQuery()) 54 + ->setViewer($user) 55 + ->withPHIDs(array($obj_phid)) 56 + ->executeOne(); 57 57 58 58 $view = id(new PhabricatorApplicationTransactionView()) 59 59 ->setUser($user)
+6 -4
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 535 535 $handles = array(); 536 536 $merged = array_mergev($phids); 537 537 if ($merged) { 538 - $handles = id(new PhabricatorObjectHandleData($merged)) 538 + $handles = id(new PhabricatorHandleQuery()) 539 539 ->setViewer($this->requireActor()) 540 - ->loadHandles(); 540 + ->withPHIDs($merged) 541 + ->execute(); 541 542 } 542 543 foreach ($xactions as $key => $xaction) { 543 544 $xaction->setHandles(array_select_keys($handles, $phids[$key])); ··· 1084 1085 $email_cc = array_unique($this->getMailCC($object)); 1085 1086 1086 1087 $phids = array_merge($email_to, $email_cc); 1087 - $handles = id(new PhabricatorObjectHandleData($phids)) 1088 + $handles = id(new PhabricatorHandleQuery()) 1088 1089 ->setViewer($this->requireActor()) 1089 - ->loadHandles(); 1090 + ->withPHIDs($phids) 1091 + ->execute(); 1090 1092 1091 1093 $template = $this->buildMailTemplate($object); 1092 1094 $body = $this->buildMailBody($object, $xactions);
+3 -2
src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
··· 100 100 $handles = array(); 101 101 $merged = array_mergev($phids); 102 102 if ($merged) { 103 - $handles = id(new PhabricatorObjectHandleData($merged)) 103 + $handles = id(new PhabricatorHandleQuery()) 104 104 ->setViewer($this->getViewer()) 105 - ->loadHandles(); 105 + ->withPHIDs($merged) 106 + ->execute(); 106 107 } 107 108 foreach ($xactions as $xaction) { 108 109 $xaction->setHandles(
+5 -4
src/applications/uiexample/examples/PHUIObjectItemListExample.php
··· 15 15 $request = $this->getRequest(); 16 16 $user = $request->getUser(); 17 17 18 - $handle = PhabricatorObjectHandleData::loadOneHandle( 19 - $user->getPHID(), 20 - $user); 18 + $handle = id(new PhabricatorHandleQuery()) 19 + ->setViewer($user) 20 + ->withPHIDs(array($user->getPHID())) 21 + ->executeOne(); 21 22 22 23 $out = array(); 23 24 ··· 231 232 id(new PHUIObjectItemView()) 232 233 ->setHeader(pht('Ace of Hearts')) 233 234 ->setSubHead( 234 - pht('This is the most powerful card in the game "Hearts".')) 235 + pht('This is a powerful card in the game "Hearts".')) 235 236 ->setHref('#') 236 237 ->addAttribute(pht('Suit: Hearts')) 237 238 ->addAttribute(pht('Rank: Ace'))
+4 -3
src/applications/uiexample/examples/PhabricatorTimelineExample.php
··· 15 15 $request = $this->getRequest(); 16 16 $user = $request->getUser(); 17 17 18 - $handle = PhabricatorObjectHandleData::loadOneHandle( 19 - $user->getPHID(), 20 - $user); 18 + $handle = id(new PhabricatorHandleQuery()) 19 + ->setViewer($user) 20 + ->withPHIDs(array($user->getPHID())) 21 + ->executeOne(); 21 22 22 23 $events = array(); 23 24
+3 -2
src/infrastructure/edges/query/PhabricatorEdgeQuery.php
··· 220 220 * 221 221 * // Gets all of the destinations. 222 222 * $all_phids = $query->getDestinationPHIDs(); 223 - * $handles = id(new PhabricatorObjectHandleData($all_phids)) 223 + * $handles = id(new PhabricatorHandleQuery()) 224 224 * ->setViewer($viewer) 225 - * ->loadHandles(); 225 + * ->withPHIDs($all_phids) 226 + * ->execute(); 226 227 * 227 228 * foreach ($objects as $object) { 228 229 * // Get all of the destinations for the given object.