diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 58dfa3baaf..125794525a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1376,7 +1376,6 @@ phutil_register_library_map(array( 'PhabricatorOAuthServerTokenController' => 'applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php', 'PhabricatorObjectHandle' => 'applications/phid/PhabricatorObjectHandle.php', 'PhabricatorObjectHandleConstants' => 'applications/phid/handle/const/PhabricatorObjectHandleConstants.php', - 'PhabricatorObjectHandleData' => 'applications/phid/handle/PhabricatorObjectHandleData.php', 'PhabricatorObjectHandleStatus' => 'applications/phid/handle/const/PhabricatorObjectHandleStatus.php', 'PhabricatorObjectListView' => 'view/control/PhabricatorObjectListView.php', 'PhabricatorObjectMailReceiver' => 'applications/metamta/receiver/PhabricatorObjectMailReceiver.php', diff --git a/src/applications/audit/editor/PhabricatorAuditCommentEditor.php b/src/applications/audit/editor/PhabricatorAuditCommentEditor.php index 9f5a3d544a..9007dd87cb 100644 --- a/src/applications/audit/editor/PhabricatorAuditCommentEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditCommentEditor.php @@ -381,9 +381,10 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor { $commit_phid = $commit->getPHID(); $phids = array($commit_phid); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getActor()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $handle = $handles[$commit_phid]; $name = $handle->getName(); @@ -446,9 +447,10 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor { $email_cc = array_keys($email_cc); $phids = array_merge($email_to, $email_cc); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getActor()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); // NOTE: Always set $is_new to false, because the "first" mail in the // thread is the Herald notification of the commit. diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php index 45cc78bb32..245cb3d8a9 100644 --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -267,9 +267,10 @@ abstract class PhabricatorController extends AphrontController { } protected function loadViewerHandles(array $phids) { - return id(new PhabricatorObjectHandleData($phids)) + return id(new PhabricatorHandleQuery()) ->setViewer($this->getRequest()->getUser()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); } diff --git a/src/applications/conpherence/controller/ConpherenceNewController.php b/src/applications/conpherence/controller/ConpherenceNewController.php index b1a459e6c0..077ed2d222 100644 --- a/src/applications/conpherence/controller/ConpherenceNewController.php +++ b/src/applications/conpherence/controller/ConpherenceNewController.php @@ -51,9 +51,10 @@ final class ConpherenceNewController extends ConpherenceController { $participant_handles = array(); if ($participants) { - $handles = id(new PhabricatorObjectHandleData($participants)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->loadHandles(); + ->withPHIDs($participants) + ->execute(); $participant_handles = mpull($handles, 'getFullName', 'getPHID'); } diff --git a/src/applications/conpherence/query/ConpherenceThreadQuery.php b/src/applications/conpherence/query/ConpherenceThreadQuery.php index 3c2b518d5a..0017b3ed2b 100644 --- a/src/applications/conpherence/query/ConpherenceThreadQuery.php +++ b/src/applications/conpherence/query/ConpherenceThreadQuery.php @@ -152,9 +152,10 @@ final class ConpherenceThreadQuery $conpherence->$method(); } $flat_phids = array_mergev($handle_phids); - $handles = id(new PhabricatorObjectHandleData($flat_phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getViewer()) - ->loadHandles(); + ->withPHIDs($flat_phids) + ->execute(); foreach ($handle_phids as $conpherence_phid => $phids) { $conpherence = $conpherences[$conpherence_phid]; $conpherence->attachHandles(array_select_keys($handles, $phids)); @@ -239,9 +240,10 @@ final class ConpherenceThreadQuery ->execute(); $files = mpull($files, null, 'getPHID'); $file_author_phids = mpull($files, 'getAuthorPHID', 'getPHID'); - $authors = id(new PhabricatorObjectHandleData($file_author_phids)) + $authors = id(new PhabricatorHandleQuery()) ->setViewer($this->getViewer()) - ->loadHandles(); + ->withPHIDs($file_author_phids) + ->execute(); $authors = mpull($authors, null, 'getPHID'); } diff --git a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php index 1c25df5343..d5669522e4 100644 --- a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php +++ b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php @@ -33,9 +33,10 @@ final class PhabricatorCountdownSearchEngine AphrontFormView $form, PhabricatorSavedQuery $saved_query) { $phids = $saved_query->getParameter('authorPHIDs', array()); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireViewer()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $author_tokens = mpull($handles, 'getFullName', 'getPHID'); $upcoming = $saved_query->getParameter('upcoming'); diff --git a/src/applications/differential/conduit/ConduitAPI_differential_getcommitmessage_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_getcommitmessage_Method.php index c8d000f713..a4ce168d39 100644 --- a/src/applications/differential/conduit/ConduitAPI_differential_getcommitmessage_Method.php +++ b/src/applications/differential/conduit/ConduitAPI_differential_getcommitmessage_Method.php @@ -97,9 +97,10 @@ final class ConduitAPI_differential_getcommitmessage_Method $aux_phids[$field_key] = $field->getRequiredHandlePHIDsForCommitMessage(); } $phids = array_unique(array_mergev($aux_phids)); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($request->getUser()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); foreach ($aux_fields as $field_key => $field) { $field->setHandles(array_select_keys($handles, $aux_phids[$field_key])); } diff --git a/src/applications/differential/conduit/ConduitAPI_differential_getrevision_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_getrevision_Method.php index ef4669aa3b..272e143448 100644 --- a/src/applications/differential/conduit/ConduitAPI_differential_getrevision_Method.php +++ b/src/applications/differential/conduit/ConduitAPI_differential_getrevision_Method.php @@ -65,9 +65,10 @@ final class ConduitAPI_differential_getrevision_Method $commit_dicts = array(); $commit_phids = $revision->loadCommitPHIDs(); - $handles = id(new PhabricatorObjectHandleData($commit_phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($request->getUser()) - ->loadHandles(); + ->withPHIDs($commit_phids) + ->execute(); foreach ($commit_phids as $commit_phid) { $commit_dicts[] = array( diff --git a/src/applications/differential/editor/DifferentialCommentEditor.php b/src/applications/differential/editor/DifferentialCommentEditor.php index e68bf1babd..126aae1852 100644 --- a/src/applications/differential/editor/DifferentialCommentEditor.php +++ b/src/applications/differential/editor/DifferentialCommentEditor.php @@ -573,9 +573,10 @@ final class DifferentialCommentEditor extends PhabricatorEditor { $revision->saveTransaction(); $phids = array($actor_phid); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getActor()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $actor_handle = $handles[$actor_phid]; $xherald_header = HeraldTranscript::loadXHeraldRulesHeader( diff --git a/src/applications/differential/editor/DifferentialRevisionEditor.php b/src/applications/differential/editor/DifferentialRevisionEditor.php index e6fd362baf..82b3aebd79 100644 --- a/src/applications/differential/editor/DifferentialRevisionEditor.php +++ b/src/applications/differential/editor/DifferentialRevisionEditor.php @@ -344,9 +344,10 @@ final class DifferentialRevisionEditor extends PhabricatorEditor { $phids = array($this->getActorPHID()); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getActor()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $actor_handle = $handles[$this->getActorPHID()]; $changesets = null; diff --git a/src/applications/differential/events/DifferentialHovercardEventListener.php b/src/applications/differential/events/DifferentialHovercardEventListener.php index 835e9771d7..153403ca5e 100644 --- a/src/applications/differential/events/DifferentialHovercardEventListener.php +++ b/src/applications/differential/events/DifferentialHovercardEventListener.php @@ -44,9 +44,10 @@ final class DifferentialHovercardEventListener extends PhutilEventListener { $reviewer_phids, $tasks); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($viewer) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $hovercard->setTitle('D'.$rev->getID()); $hovercard->setDetail($rev->getTitle()); diff --git a/src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php b/src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php index ef8f346b97..f591bad95e 100644 --- a/src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php @@ -47,9 +47,10 @@ final class DifferentialArcanistProjectFieldSpecification if ($diff) { $phid = $diff->getArcanistProjectPHID(); if ($phid) { - $handle = PhabricatorObjectHandleData::loadOneHandle( - $phid, - $this->getUser()); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer($this->getUser()) + ->withPHIDs(array($phid)) + ->executeOne(); return "ARCANIST PROJECT\n ".$handle->getName(); } } diff --git a/src/applications/differential/field/specification/DifferentialCommitsFieldSpecification.php b/src/applications/differential/field/specification/DifferentialCommitsFieldSpecification.php index 7ce0641a62..b43a31de4a 100644 --- a/src/applications/differential/field/specification/DifferentialCommitsFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialCommitsFieldSpecification.php @@ -47,9 +47,10 @@ final class DifferentialCommitsFieldSpecification } $body = array(); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getUser()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $body[] = pht('COMMIT(S)', count($handles)); foreach ($handles as $handle) { diff --git a/src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php b/src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php index 88f24334be..2b7be3f219 100644 --- a/src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php @@ -163,9 +163,10 @@ final class DifferentialManiphestTasksFieldSpecification return null; } - $handles = id(new PhabricatorObjectHandleData($this->maniphestTasks)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getUser()) - ->loadHandles(); + ->withPHIDs($this->maniphestTasks) + ->execute(); $body = array(); $body[] = 'MANIPHEST TASKS'; foreach ($handles as $handle) { diff --git a/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php b/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php index 4c4e3935e7..08546665a6 100644 --- a/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php @@ -164,9 +164,10 @@ final class DifferentialReviewersFieldSpecification return null; } - $handles = id(new PhabricatorObjectHandleData($this->reviewers)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getUser()) - ->loadHandles(); + ->withPHIDs($this->reviewers) + ->execute(); $handles = array_select_keys( $handles, array($this->getRevision()->getPrimaryReviewer())) + $handles; diff --git a/src/applications/differential/mail/DifferentialCommentMail.php b/src/applications/differential/mail/DifferentialCommentMail.php index 61971dc12b..bfe6a9cf48 100644 --- a/src/applications/differential/mail/DifferentialCommentMail.php +++ b/src/applications/differential/mail/DifferentialCommentMail.php @@ -98,9 +98,10 @@ final class DifferentialCommentMail extends DifferentialMail { array()); $load = array_merge($m_reviewers, $m_cc); if ($load) { - $handles = id(new PhabricatorObjectHandleData($load)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getActor()) - ->loadHandles(); + ->withPHIDs($load) + ->execute(); if ($m_reviewers) { $this->addedReviewers = $this->renderHandleList($handles, $m_reviewers); } diff --git a/src/applications/differential/mail/DifferentialMail.php b/src/applications/differential/mail/DifferentialMail.php index 52bc35d665..30fd2b38e0 100644 --- a/src/applications/differential/mail/DifferentialMail.php +++ b/src/applications/differential/mail/DifferentialMail.php @@ -132,9 +132,10 @@ abstract class DifferentialMail extends PhabricatorMail { $raw = $revision->getRawRelations($relation_subscribed); $reason_phids = ipull($raw, 'reasonPHID'); - $reason_handles = id(new PhabricatorObjectHandleData($reason_phids)) + $reason_handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getActor()) - ->loadHandles(); + ->withPHIDs($reason_phids) + ->execute(); $explicit_cc = array(); foreach ($raw as $relation) { @@ -173,12 +174,14 @@ abstract class DifferentialMail extends PhabricatorMail { } $phids = array_keys($phids); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getActor()) - ->loadHandles(); - $objects = id(new PhabricatorObjectHandleData($phids)) + ->withPHIDs($phids) + ->execute(); + $objects = id(new PhabricatorObjectQuery()) ->setViewer($this->getActor()) - ->loadObjects(); + ->withPHIDs($phids) + ->execute(); $to_handles = array_select_keys($handles, $to_phids); $cc_handles = array_select_keys($handles, $cc_phids); diff --git a/src/applications/differential/query/DifferentialRevisionSearchEngine.php b/src/applications/differential/query/DifferentialRevisionSearchEngine.php index ceafdd4481..ffd1e196f7 100644 --- a/src/applications/differential/query/DifferentialRevisionSearchEngine.php +++ b/src/applications/differential/query/DifferentialRevisionSearchEngine.php @@ -107,9 +107,10 @@ final class DifferentialRevisionSearchEngine $subscriber_phids, )); - $handles = id(new PhabricatorObjectHandleData($all_phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireViewer()) - ->loadHandles(); + ->withPHIDs($all_phids) + ->execute(); $tokens = mpull($handles, 'getFullName', 'getPHID'); diff --git a/src/applications/differential/search/DifferentialSearchIndexer.php b/src/applications/differential/search/DifferentialSearchIndexer.php index efd2e08eb7..36403e1165 100644 --- a/src/applications/differential/search/DifferentialSearchIndexer.php +++ b/src/applications/differential/search/DifferentialSearchIndexer.php @@ -104,9 +104,10 @@ final class DifferentialSearchIndexer } $ccphids = $rev->getCCPHIDs(); - $handles = id(new PhabricatorObjectHandleData($ccphids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) - ->loadHandles(); + ->withPHIDs($ccphids) + ->execute(); foreach ($handles as $phid => $handle) { $doc->addRelationship( diff --git a/src/applications/diffusion/doorkeeper/DiffusionDoorkeeperCommitFeedStoryPublisher.php b/src/applications/diffusion/doorkeeper/DiffusionDoorkeeperCommitFeedStoryPublisher.php index 0a5b6b2a21..35fdbce886 100644 --- a/src/applications/diffusion/doorkeeper/DiffusionDoorkeeperCommitFeedStoryPublisher.php +++ b/src/applications/diffusion/doorkeeper/DiffusionDoorkeeperCommitFeedStoryPublisher.php @@ -56,9 +56,10 @@ final class DiffusionDoorkeeperCommitFeedStoryPublisher // audit) and "passive" (no action necessary) user are. $auditor_phids = mpull($requests, 'getAuditorPHID'); - $objects = id(new PhabricatorObjectHandleData($auditor_phids)) + $objects = id(new PhabricatorObjectQuery()) ->setViewer($this->getViewer()) - ->loadObjects(); + ->withPHIDs($auditor_phids) + ->execute(); $active = array(); $passive = array(); diff --git a/src/applications/diffusion/events/DiffusionHovercardEventListener.php b/src/applications/diffusion/events/DiffusionHovercardEventListener.php index f7b8d41ebd..8d10181771 100644 --- a/src/applications/diffusion/events/DiffusionHovercardEventListener.php +++ b/src/applications/diffusion/events/DiffusionHovercardEventListener.php @@ -38,9 +38,10 @@ final class DiffusionHovercardEventListener extends PhutilEventListener { $author, )); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($viewer) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); if ($author) { $author = $handles[$author]->renderLink(); diff --git a/src/applications/files/query/PhabricatorFileSearchEngine.php b/src/applications/files/query/PhabricatorFileSearchEngine.php index ed6f17e731..2281fa8fce 100644 --- a/src/applications/files/query/PhabricatorFileSearchEngine.php +++ b/src/applications/files/query/PhabricatorFileSearchEngine.php @@ -46,9 +46,10 @@ final class PhabricatorFileSearchEngine PhabricatorSavedQuery $saved_query) { $phids = $saved_query->getParameter('authorPHIDs', array()); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireViewer()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $author_tokens = mpull($handles, 'getFullName', 'getPHID'); $explicit = $saved_query->getParameter('explicit'); diff --git a/src/applications/flag/conduit/ConduitAPI_flag_Method.php b/src/applications/flag/conduit/ConduitAPI_flag_Method.php index 57e69e2d97..177d057e45 100644 --- a/src/applications/flag/conduit/ConduitAPI_flag_Method.php +++ b/src/applications/flag/conduit/ConduitAPI_flag_Method.php @@ -11,10 +11,11 @@ abstract class ConduitAPI_flag_Method extends ConduitAPIMethod { } protected function attachHandleToFlag($flag, PhabricatorUser $user) { - $flag->attachHandle( - PhabricatorObjectHandleData::loadOneHandle( - $flag->getObjectPHID(), - $user)); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs(array($flag->getObjectPHID())) + ->executeOne(); + $flag->attachHandle($handle); } protected function buildFlagInfoDictionary($flag) { diff --git a/src/applications/flag/controller/PhabricatorFlagEditController.php b/src/applications/flag/controller/PhabricatorFlagEditController.php index e9f56bf12d..3f65bb058d 100644 --- a/src/applications/flag/controller/PhabricatorFlagEditController.php +++ b/src/applications/flag/controller/PhabricatorFlagEditController.php @@ -13,7 +13,10 @@ final class PhabricatorFlagEditController extends PhabricatorFlagController { $user = $request->getUser(); $phid = $this->phid; - $handle = PhabricatorObjectHandleData::loadOneHandle($phid, $user); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs(array($phid)) + ->executeOne(); if (!$handle->isComplete()) { return new Aphront404Response(); diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php index 142119c7c5..0f95fc2954 100644 --- a/src/applications/herald/adapter/HeraldAdapter.php +++ b/src/applications/herald/adapter/HeraldAdapter.php @@ -596,9 +596,10 @@ abstract class HeraldAdapter { pht('Object already flagged.')); } - $handle = PhabricatorObjectHandleData::loadOneHandle( - $phid, - $user); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs(array($phid)) + ->executeOne(); $flag = new PhabricatorFlag(); $flag->setOwnerPHID($user->getPHID()); diff --git a/src/applications/herald/query/HeraldRuleSearchEngine.php b/src/applications/herald/query/HeraldRuleSearchEngine.php index 55f28caca9..a875ca648f 100644 --- a/src/applications/herald/query/HeraldRuleSearchEngine.php +++ b/src/applications/herald/query/HeraldRuleSearchEngine.php @@ -44,9 +44,10 @@ final class HeraldRuleSearchEngine PhabricatorSavedQuery $saved_query) { $phids = $saved_query->getParameter('authorPHIDs', array()); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireViewer()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $author_tokens = mpull($handles, 'getFullName', 'getPHID'); $content_type = $saved_query->getParameter('contentType'); diff --git a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php index 39711676a9..c510ec7765 100644 --- a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php +++ b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php @@ -49,9 +49,10 @@ final class LegalpadDocumentSearchEngine $contributor_phids = $saved_query->getParameter( 'contributorPHIDs', array()); $phids = array_merge($creator_phids, $contributor_phids); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireViewer()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $tokens = mpull($handles, 'getFullName', 'getPHID'); $form diff --git a/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php b/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php index c8a4df071d..615b0bbc2d 100644 --- a/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php +++ b/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php @@ -65,8 +65,10 @@ final class PhabricatorLipsumGenerateWorkflow try { $taskgen = newv($type, array()); $object = $taskgen->generate(); - $handle = PhabricatorObjectHandleData::loadOneHandle($object->getPHID(), - $admin); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer($admin) + ->withPHIDs(array($object->getPHID())) + ->executeOne(); echo "Generated ".$handle->getTypeName().": ". $handle->getFullName()."\n"; } catch (PhutilMissingSymbolException $ex) { diff --git a/src/applications/macro/query/PhabricatorMacroSearchEngine.php b/src/applications/macro/query/PhabricatorMacroSearchEngine.php index e5df4ab1b5..c980979c29 100644 --- a/src/applications/macro/query/PhabricatorMacroSearchEngine.php +++ b/src/applications/macro/query/PhabricatorMacroSearchEngine.php @@ -66,9 +66,10 @@ final class PhabricatorMacroSearchEngine PhabricatorSavedQuery $saved_query) { $phids = $saved_query->getParameter('authorPHIDs', array()); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireViewer()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $author_tokens = mpull($handles, 'getFullName', 'getPHID'); $status = $saved_query->getParameter('status'); diff --git a/src/applications/maniphest/ManiphestTaskQuery.php b/src/applications/maniphest/ManiphestTaskQuery.php index dbd4d12155..b4f20ccf04 100644 --- a/src/applications/maniphest/ManiphestTaskQuery.php +++ b/src/applications/maniphest/ManiphestTaskQuery.php @@ -511,7 +511,7 @@ final class ManiphestTaskQuery } $projects = id(new PhabricatorProjectQuery()) - ->setViewer($this->viewer) + ->setViewer($this->getViewer()) ->withMemberPHIDs($this->anyUserProjectPHIDs) ->execute(); $any_user_project_phids = mpull($projects, 'getPHID'); @@ -661,12 +661,10 @@ final class ManiphestTaskQuery } } - // TODO: This should use the query's viewer once this class extends - // PhabricatorPolicyQuery (T603). - - $handles = id(new PhabricatorObjectHandleData(array_keys($project_phids))) - ->setViewer(PhabricatorUser::getOmnipotentUser()) - ->loadHandles(); + $handles = id(new PhabricatorHandleQuery()) + ->setViewer($this->getViewer()) + ->withPHIDs(array_keys($project_phids)) + ->execute(); $max = 1; foreach ($handles as $handle) { diff --git a/src/applications/maniphest/controller/ManiphestController.php b/src/applications/maniphest/controller/ManiphestController.php index 4bca8bd852..5cbfd24615 100644 --- a/src/applications/maniphest/controller/ManiphestController.php +++ b/src/applications/maniphest/controller/ManiphestController.php @@ -92,9 +92,10 @@ abstract class ManiphestController extends PhabricatorController { $phids[] = $task->getOwnerPHID(); } - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $view = id(new ManiphestTaskListView()) ->setUser($user) diff --git a/src/applications/maniphest/controller/ManiphestTaskListController.php b/src/applications/maniphest/controller/ManiphestTaskListController.php index 449ebc0194..544570afaa 100644 --- a/src/applications/maniphest/controller/ManiphestTaskListController.php +++ b/src/applications/maniphest/controller/ManiphestTaskListController.php @@ -578,9 +578,10 @@ final class ManiphestTaskListController extends ManiphestController { $any_project_phids, $any_user_project_phids, array_mergev(mpull($data, 'getProjectPHIDs'))); - $handles = id(new PhabricatorObjectHandleData($handle_phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($viewer) - ->loadHandles(); + ->withPHIDs($handle_phids) + ->execute(); switch ($search_query->getParameter('group')) { case 'priority': diff --git a/src/applications/maniphest/editor/ManiphestTransactionEditor.php b/src/applications/maniphest/editor/ManiphestTransactionEditor.php index 92a76c69b5..bde7aaf22d 100644 --- a/src/applications/maniphest/editor/ManiphestTransactionEditor.php +++ b/src/applications/maniphest/editor/ManiphestTransactionEditor.php @@ -129,10 +129,11 @@ final class ManiphestTransactionEditor extends PhabricatorEditor { break; case ManiphestTransactionType::TYPE_OWNER: if ($new) { - $handles = id(new PhabricatorObjectHandleData(array($new))) + $handle = id(new PhabricatorHandleQuery()) ->setViewer($this->getActor()) - ->loadHandles(); - $task->setOwnerOrdering($handles[$new]->getName()); + ->withPHIDs(array($new)) + ->executeOne(); + $task->setOwnerOrdering($handle->getName()); } else { $task->setOwnerOrdering(null); } @@ -226,9 +227,10 @@ final class ManiphestTransactionEditor extends PhabricatorEditor { } $phids = array_keys($phids); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getActor()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $view = new ManiphestTransactionDetailView(); $view->setTransactionGroup($transactions); diff --git a/src/applications/maniphest/event/ManiphestHovercardEventListener.php b/src/applications/maniphest/event/ManiphestHovercardEventListener.php index f0d8da2e92..64f375662f 100644 --- a/src/applications/maniphest/event/ManiphestHovercardEventListener.php +++ b/src/applications/maniphest/event/ManiphestHovercardEventListener.php @@ -97,9 +97,10 @@ final class ManiphestHovercardEventListener extends PhutilEventListener { } protected function loadHandles(array $phids, $viewer) { - return id(new PhabricatorObjectHandleData($phids)) + return id(new PhabricatorHandleQuery()) ->setViewer($viewer) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); } } diff --git a/src/applications/maniphest/search/ManiphestSearchIndexer.php b/src/applications/maniphest/search/ManiphestSearchIndexer.php index 88ce02f25f..fdeb7e0546 100644 --- a/src/applications/maniphest/search/ManiphestSearchIndexer.php +++ b/src/applications/maniphest/search/ManiphestSearchIndexer.php @@ -110,9 +110,10 @@ final class ManiphestSearchIndexer // We need to load handles here since non-users may subscribe (mailing // lists, e.g.) - $handles = id(new PhabricatorObjectHandleData(array_keys($ccs))) + $handles = id(new PhabricatorHandleQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) - ->loadHandles(); + ->withPHIDs(array_keys($ccs)) + ->execute(); foreach ($ccs as $cc => $time) { $doc->addRelationship( PhabricatorSearchRelationship::RELATIONSHIP_SUBSCRIBER, diff --git a/src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php index 92a3ccc197..6edc66e722 100644 --- a/src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php +++ b/src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php @@ -36,9 +36,10 @@ final class PhabricatorMailManagementListInboundWorkflow $phids = array_merge( mpull($mails, 'getRelatedPHID'), mpull($mails, 'getAuthorPHID')); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($viewer) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); foreach (array_reverse($mails) as $mail) { $console->writeOut( diff --git a/src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php b/src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php index 67f95aec22..b37ce4db33 100644 --- a/src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php +++ b/src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php @@ -87,12 +87,11 @@ abstract class PhabricatorMailReplyHandler { $template->setBody($this->buildErrorMailBody($error, $mail)); $template->setRelatedPHID($mail->getRelatedPHID()); $phid = $this->getActor()->getPHID(); - $tos = array( - $phid => PhabricatorObjectHandleData::loadOneHandle( - $phid, - // TODO: This could be cleaner (T603). - PhabricatorUser::getOmnipotentUser()), - ); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer($this->getActor()) + ->withPHIDs(array($phid)) + ->executeOne(); + $tos = array($phid => $handle); $mails = $this->multiplexMail($template, $tos, array()); foreach ($mails as $email) { diff --git a/src/applications/owners/mail/PackageMail.php b/src/applications/owners/mail/PackageMail.php index 9750b0f954..b0110caad2 100644 --- a/src/applications/owners/mail/PackageMail.php +++ b/src/applications/owners/mail/PackageMail.php @@ -80,9 +80,10 @@ abstract class PackageMail extends PhabricatorMail { $this->mailTo, array($package->getActorPHID()), array_keys($this->paths)); - $this->handles = id(new PhabricatorObjectHandleData($phids)) + $this->handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getActor()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); } final protected function renderSummarySection() { diff --git a/src/applications/owners/mail/PackageModifyMail.php b/src/applications/owners/mail/PackageModifyMail.php index 4ddafce784..740100a0ae 100644 --- a/src/applications/owners/mail/PackageModifyMail.php +++ b/src/applications/owners/mail/PackageModifyMail.php @@ -59,9 +59,10 @@ final class PackageModifyMail extends PackageMail { array( $this->getPackage()->getActorPHID(), )); - $this->handles = id(new PhabricatorObjectHandleData($phids)) + $this->handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getActor()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); } protected function renderDescriptionSection() { diff --git a/src/applications/paste/query/PhabricatorPasteSearchEngine.php b/src/applications/paste/query/PhabricatorPasteSearchEngine.php index c6c9da3540..4101458ee2 100644 --- a/src/applications/paste/query/PhabricatorPasteSearchEngine.php +++ b/src/applications/paste/query/PhabricatorPasteSearchEngine.php @@ -48,9 +48,10 @@ final class PhabricatorPasteSearchEngine AphrontFormView $form, PhabricatorSavedQuery $saved_query) { $phids = $saved_query->getParameter('authorPHIDs', array()); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireViewer()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $author_tokens = mpull($handles, 'getFullName', 'getPHID'); $languages = $saved_query->getParameter('languages', array()); diff --git a/src/applications/phame/controller/blog/PhameBlogFeedController.php b/src/applications/phame/controller/blog/PhameBlogFeedController.php index 8b42b2928f..c855932ab5 100644 --- a/src/applications/phame/controller/blog/PhameBlogFeedController.php +++ b/src/applications/phame/controller/blog/PhameBlogFeedController.php @@ -62,10 +62,11 @@ final class PhameBlogFeedController extends PhameController { } $engine->process(); - $bloggers = mpull($posts, 'getBloggerPHID'); - $bloggers = id(new PhabricatorObjectHandleData($bloggers)) + $blogger_phids = mpull($posts, 'getBloggerPHID'); + $bloggers = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->loadHandles(); + ->withPHIDs($blogger_phids) + ->execute(); foreach ($posts as $post) { $content[] = hsprintf(''); diff --git a/src/applications/phame/controller/post/PhamePostEditController.php b/src/applications/phame/controller/post/PhamePostEditController.php index 39cdc8e720..2aec9c6e4a 100644 --- a/src/applications/phame/controller/post/PhamePostEditController.php +++ b/src/applications/phame/controller/post/PhamePostEditController.php @@ -94,9 +94,10 @@ final class PhamePostEditController } } - $handle = PhabricatorObjectHandleData::loadOneHandle( - $post->getBlogPHID(), - $user); + $handle = id(new PhabricatorHandleQuery()) + ->withViewer($user) + ->withPHIDs(array($post->getBlogPHID())) + ->executeOne(); $form = id(new AphrontFormView()) ->setUser($user) diff --git a/src/applications/phame/skins/PhameBasicBlogSkin.php b/src/applications/phame/skins/PhameBasicBlogSkin.php index 2040e98a33..850a5f0a92 100644 --- a/src/applications/phame/skins/PhameBasicBlogSkin.php +++ b/src/applications/phame/skins/PhameBasicBlogSkin.php @@ -294,9 +294,10 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin { $phids[] = $post->getBloggerPHID(); } - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $engine->process(); diff --git a/src/applications/phame/storage/PhameBlog.php b/src/applications/phame/storage/PhameBlog.php index 127ffbf392..a7f37f6781 100644 --- a/src/applications/phame/storage/PhameBlog.php +++ b/src/applications/phame/storage/PhameBlog.php @@ -93,47 +93,10 @@ final class PhameBlog extends PhameDAO return $valid; } - public function loadBloggerPHIDs() { - if (!$this->getPHID()) { - return $this; - } - - if ($this->bloggerPHIDs) { - return $this; - } - - $this->bloggerPHIDs = PhabricatorEdgeQuery::loadDestinationPHIDs( - $this->getPHID(), - PhabricatorEdgeConfig::TYPE_BLOG_HAS_BLOGGER); - - return $this; - } - public function getBloggerPHIDs() { return $this->assertAttached($this->bloggerPHIDs); } - public function loadBloggers() { - if ($this->bloggers) { - return $this->bloggers; - } - - $blogger_phids = $this->loadBloggerPHIDs()->getBloggerPHIDs(); - - if (empty($blogger_phids)) { - return array(); - } - - $bloggers = id(new PhabricatorObjectHandleData($blogger_phids)) - // TODO: This should be Query-based (T603). - ->setViewer(PhabricatorUser::getOmnipotentUser()) - ->loadHandles(); - - $this->attachBloggers($bloggers); - - return $this; - } - public function attachBloggers(array $bloggers) { assert_instances_of($bloggers, 'PhabricatorObjectHandle'); diff --git a/src/applications/phid/PhabricatorObjectHandle.php b/src/applications/phid/PhabricatorObjectHandle.php index ace10a1986..1a31ed91c8 100644 --- a/src/applications/phid/PhabricatorObjectHandle.php +++ b/src/applications/phid/PhabricatorObjectHandle.php @@ -130,7 +130,7 @@ final class PhabricatorObjectHandle * completely loaded (e.g., the type or data for the PHID could not be * identified or located). * - * Basically, @{class:PhabricatorObjectHandleData} gives you back a handle for + * Basically, @{class:PhabricatorHandleQuery} gives you back a handle for * any PHID you give it, but it gives you a complete handle only for valid * PHIDs. * diff --git a/src/applications/phid/conduit/ConduitAPI_phid_info_Method.php b/src/applications/phid/conduit/ConduitAPI_phid_info_Method.php index d853274f9a..df68c1845f 100644 --- a/src/applications/phid/conduit/ConduitAPI_phid_info_Method.php +++ b/src/applications/phid/conduit/ConduitAPI_phid_info_Method.php @@ -38,11 +38,11 @@ final class ConduitAPI_phid_info_Method $phid = $request->getValue('phid'); - $handles = id(new PhabricatorObjectHandleData(array($phid))) + $handle = id(new PhabricatorHandleQuery()) ->setViewer($request->getUser()) - ->loadHandles(); + ->withPHIDs(array($phid)) + ->executeOne(); - $handle = $handles[$phid]; if (!$handle->isComplete()) { throw new ConduitException('ERR-BAD-PHID'); } diff --git a/src/applications/phid/conduit/ConduitAPI_phid_lookup_Method.php b/src/applications/phid/conduit/ConduitAPI_phid_lookup_Method.php index 6d6aaae24d..6a1e03b2fc 100644 --- a/src/applications/phid/conduit/ConduitAPI_phid_lookup_Method.php +++ b/src/applications/phid/conduit/ConduitAPI_phid_lookup_Method.php @@ -33,9 +33,10 @@ final class ConduitAPI_phid_lookup_Method $query->execute(); $name_map = $query->getNamedResults(); - $handles = id(new PhabricatorObjectHandleData(mpull($name_map, 'getPHID'))) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($request->getUser()) - ->loadHandles(); + ->withPHIDs(mpull($name_map, 'getPHID')) + ->execute(); $result = array(); foreach ($name_map as $name => $object) { diff --git a/src/applications/phid/conduit/ConduitAPI_phid_query_Method.php b/src/applications/phid/conduit/ConduitAPI_phid_query_Method.php index e433aae2b5..f5a8404626 100644 --- a/src/applications/phid/conduit/ConduitAPI_phid_query_Method.php +++ b/src/applications/phid/conduit/ConduitAPI_phid_query_Method.php @@ -28,9 +28,10 @@ final class ConduitAPI_phid_query_Method $phids = $request->getValue('phids'); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($request->getUser()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $result = array(); foreach ($handles as $phid => $handle) { diff --git a/src/applications/phid/handle/PhabricatorObjectHandleData.php b/src/applications/phid/handle/PhabricatorObjectHandleData.php deleted file mode 100644 index e513c26cdc..0000000000 --- a/src/applications/phid/handle/PhabricatorObjectHandleData.php +++ /dev/null @@ -1,83 +0,0 @@ -phids = array_unique($phids); - } - - public function setViewer(PhabricatorUser $viewer) { - $this->viewer = $viewer; - return $this; - } - - public static function loadOneHandle($phid, PhabricatorUser $viewer) { - $query = new PhabricatorObjectHandleData(array($phid)); - $query->setViewer($viewer); - $handles = $query->loadHandles(); - return $handles[$phid]; - } - - public function loadObjects() { - $phids = array_fuse($this->phids); - - return id(new PhabricatorObjectQuery()) - ->setViewer($this->viewer) - ->withPHIDs($phids) - ->execute(); - } - - public function loadHandles() { - - $application_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->viewer) - ->withPHIDs($this->phids) - ->execute(); - - // TODO: Move the rest of this into Applications. - - $phid_map = array_fuse($this->phids); - foreach ($application_handles as $handle) { - if ($handle->isComplete()) { - unset($phid_map[$handle->getPHID()]); - } - } - - $types = phid_group_by_type($phid_map); - - $handles = array(); - foreach ($types as $type => $phids) { - switch ($type) { - case PhabricatorPHIDConstants::PHID_TYPE_MAGIC: - // Black magic! - foreach ($phids as $phid) { - $handle = new PhabricatorObjectHandle(); - $handle->setPHID($phid); - $handle->setType($type); - switch ($phid) { - case ManiphestTaskOwner::OWNER_UP_FOR_GRABS: - $handle->setName('Up For Grabs'); - $handle->setFullName('upforgrabs (Up For Grabs)'); - $handle->setComplete(true); - break; - case ManiphestTaskOwner::PROJECT_NO_PROJECT: - $handle->setName('No Project'); - $handle->setFullName('noproject (No Project)'); - $handle->setComplete(true); - break; - default: - $handle->setName('Foul Magicks'); - break; - } - $handles[$phid] = $handle; - } - break; - } - } - - return $handles + $application_handles; - } -} diff --git a/src/applications/pholio/controller/PholioMockEditController.php b/src/applications/pholio/controller/PholioMockEditController.php index ad924c2690..d8d8988f88 100644 --- a/src/applications/pholio/controller/PholioMockEditController.php +++ b/src/applications/pholio/controller/PholioMockEditController.php @@ -225,9 +225,10 @@ final class PholioMockEditController extends PholioController { // NOTE: Make this show up correctly on the rendered form. $mock->setViewPolicy($v_view); - $handles = id(new PhabricatorObjectHandleData($v_cc)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->loadHandles(); + ->withPHIDs($v_cc) + ->execute(); $cc_tokens = mpull($handles, 'getFullName', 'getPHID'); diff --git a/src/applications/pholio/query/PholioMockSearchEngine.php b/src/applications/pholio/query/PholioMockSearchEngine.php index 9f7cc1ffe2..e64a44ef86 100644 --- a/src/applications/pholio/query/PholioMockSearchEngine.php +++ b/src/applications/pholio/query/PholioMockSearchEngine.php @@ -27,9 +27,10 @@ final class PholioMockSearchEngine PhabricatorSavedQuery $saved_query) { $phids = $saved_query->getParameter('authorPHIDs', array()); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireViewer()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $author_tokens = mpull($handles, 'getFullName', 'getPHID'); $form diff --git a/src/applications/phrequent/controller/PhrequentListController.php b/src/applications/phrequent/controller/PhrequentListController.php index 3c9724c1c7..f79fcd53c5 100644 --- a/src/applications/phrequent/controller/PhrequentListController.php +++ b/src/applications/phrequent/controller/PhrequentListController.php @@ -146,9 +146,10 @@ final class PhrequentListController extends PhrequentController { ->setUser($user) ->setAction($this->getApplicationURI("/view/custom/")); - $user_handles = id(new PhabricatorObjectHandleData($user_phids)) + $user_handles = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->loadHandles(); + ->withPHIDs($user_phids) + ->execute(); $tokens = array(); foreach ($user_phids as $phid) { $tokens[$phid] = $user_handles[$phid]->getFullName(); diff --git a/src/applications/policy/filter/PhabricatorPolicyFilter.php b/src/applications/policy/filter/PhabricatorPolicyFilter.php index ca83847a24..841b9b51b8 100644 --- a/src/applications/policy/filter/PhabricatorPolicyFilter.php +++ b/src/applications/policy/filter/PhabricatorPolicyFilter.php @@ -272,9 +272,10 @@ final class PhabricatorPolicyFilter { $who = "No one can {$verb} this object."; break; default: - $handle = PhabricatorObjectHandleData::loadOneHandle( - $policy, - $this->viewer); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer($this->viewer) + ->withPHIDs(array($policy)) + ->executeOne(); $type = phid_get_type($policy); if ($type == PhabricatorProjectPHIDTypeProject::TYPECONST) { diff --git a/src/applications/policy/query/PhabricatorPolicyQuery.php b/src/applications/policy/query/PhabricatorPolicyQuery.php index 784f47b054..5143b4621c 100644 --- a/src/applications/policy/query/PhabricatorPolicyQuery.php +++ b/src/applications/policy/query/PhabricatorPolicyQuery.php @@ -100,9 +100,10 @@ final class PhabricatorPolicyQuery extends PhabricatorQuery { $other_policies = array_diff_key($other_policies, $results); if ($other_policies) { - $handles = id(new PhabricatorObjectHandleData($other_policies)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->viewer) - ->loadHandles(); + ->withPHIDs($other_policies) + ->execute(); foreach ($other_policies as $phid) { $results[$phid] = PhabricatorPolicy::newFromPolicyAndHandle( $phid, diff --git a/src/applications/ponder/query/PonderQuestionSearchEngine.php b/src/applications/ponder/query/PonderQuestionSearchEngine.php index b6d2c6562e..57c3faaba0 100644 --- a/src/applications/ponder/query/PonderQuestionSearchEngine.php +++ b/src/applications/ponder/query/PonderQuestionSearchEngine.php @@ -57,9 +57,10 @@ final class PonderQuestionSearchEngine 'status', PonderQuestionStatus::STATUS_OPEN); $phids = array_merge($author_phids, $answerer_phids); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireViewer()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $tokens = mpull($handles, 'getFullName', 'getPHID'); $author_tokens = array_select_keys($tokens, $author_phids); diff --git a/src/applications/project/query/PhabricatorProjectSearchEngine.php b/src/applications/project/query/PhabricatorProjectSearchEngine.php index 7e479a37fd..448627ecf0 100644 --- a/src/applications/project/query/PhabricatorProjectSearchEngine.php +++ b/src/applications/project/query/PhabricatorProjectSearchEngine.php @@ -36,9 +36,10 @@ final class PhabricatorProjectSearchEngine PhabricatorSavedQuery $saved_query) { $phids = $saved_query->getParameter('memberPHIDs', array()); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireViewer()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $member_tokens = mpull($handles, 'getFullName', 'getPHID'); $status = $saved_query->getParameter('status'); diff --git a/src/applications/releeph/conduit/ConduitAPI_releeph_request_Method.php b/src/applications/releeph/conduit/ConduitAPI_releeph_request_Method.php index ec7f924519..2f37062428 100644 --- a/src/applications/releeph/conduit/ConduitAPI_releeph_request_Method.php +++ b/src/applications/releeph/conduit/ConduitAPI_releeph_request_Method.php @@ -53,11 +53,12 @@ final class ConduitAPI_releeph_request_Method ->setErrorDescription($ex->getMessage()); } } + $requested_commit_phids = mpull($requested_commits, 'getPHID'); // Find any existing requests that clash on the commit id, for this branch $existing_releeph_requests = id(new ReleephRequest())->loadAllWhere( 'requestCommitPHID IN (%Ls) AND branchID = %d', - mpull($requested_commits, 'getPHID'), + $requested_commit_phids, $releeph_branch->getID()); $existing_releeph_requests = mpull( $existing_releeph_requests, @@ -73,11 +74,12 @@ final class ConduitAPI_releeph_request_Method } $results = array(); + $handles = id(new PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs($requested_commit_phids) + ->execute(); foreach ($requested_commits as $thing => $commit) { $phid = $commit->getPHID(); - $handles = id(new PhabricatorObjectHandleData(array($phid))) - ->setViewer($user) - ->loadHandles(); $name = id($handles[$phid])->getName(); $releeph_request = null; diff --git a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_getbranch_Method.php b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_getbranch_Method.php index 7cbbf9053c..96aacdde26 100644 --- a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_getbranch_Method.php +++ b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_getbranch_Method.php @@ -34,9 +34,10 @@ final class ConduitAPI_releephwork_getbranch_Method $cut_phid = $branch->getCutPointCommitPHID(); $phids = array($cut_phid); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($request->getUser()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $project = $branch->getProject(); $repo = $project->getRepository(); diff --git a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_getbranchcommitmessage_Method.php b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_getbranchcommitmessage_Method.php index 5549591fc1..9095205466 100644 --- a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_getbranchcommitmessage_Method.php +++ b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_getbranchcommitmessage_Method.php @@ -41,9 +41,10 @@ final class ConduitAPI_releephwork_getbranchcommitmessage_Method $cut_phid, ); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($request->getUser()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $h_branch = $handles[$branch->getPHID()]; $h_project = $handles[$project->getPHID()]; diff --git a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_nextrequest_Method.php b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_nextrequest_Method.php index 1e9d373bc0..23a339aa8b 100644 --- a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_nextrequest_Method.php +++ b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_nextrequest_Method.php @@ -117,9 +117,10 @@ final class ConduitAPI_releephwork_nextrequest_Method } $phids[] = $releeph_request->getPHID(); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($request->getUser()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $diff_name = null; if ($diff_rev) { diff --git a/src/applications/releeph/controller/branch/ReleephBranchEditController.php b/src/applications/releeph/controller/branch/ReleephBranchEditController.php index c89848a5c8..1f1c0c6c47 100644 --- a/src/applications/releeph/controller/branch/ReleephBranchEditController.php +++ b/src/applications/releeph/controller/branch/ReleephBranchEditController.php @@ -42,9 +42,10 @@ final class ReleephBranchEditController extends ReleephProjectController { $phids[] = $creator_phid = $releeph_branch->getCreatedByUserPHID(); $phids[] = $cut_commit_phid = $releeph_branch->getCutPointCommitPHID(); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($request->getUser()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $form = id(new AphrontFormView()) ->setUser($request->getUser()) diff --git a/src/applications/releeph/controller/project/ReleephProjectEditController.php b/src/applications/releeph/controller/project/ReleephProjectEditController.php index 8dddee4357..d39c6fcb52 100644 --- a/src/applications/releeph/controller/project/ReleephProjectEditController.php +++ b/src/applications/releeph/controller/project/ReleephProjectEditController.php @@ -130,9 +130,10 @@ final class ReleephProjectEditController extends ReleephProjectController { 'pushers', $this->getReleephProject()->getDetail('pushers', array())); - $handles = id(new PhabricatorObjectHandleData($pusher_phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($request->getUser()) - ->loadHandles(); + ->withPHIDs($pusher_phids) + ->execute(); $pusher_tokens = array(); foreach ($pusher_phids as $phid) { diff --git a/src/applications/releeph/editor/ReleephBranchEditor.php b/src/applications/releeph/editor/ReleephBranchEditor.php index 97f6be9b04..e2cb81ce7e 100644 --- a/src/applications/releeph/editor/ReleephBranchEditor.php +++ b/src/applications/releeph/editor/ReleephBranchEditor.php @@ -24,12 +24,10 @@ final class ReleephBranchEditor extends PhabricatorEditor { $template = ReleephBranchTemplate::getRequiredDefaultTemplate(); } - $cut_point_handle = head( - id(new PhabricatorObjectHandleData(array($cut_point->getPHID()))) - // We'll assume that whoever found the $cut_point has passed privacy - // checks. - ->setViewer($this->requireActor()) - ->loadHandles()); + $cut_point_handle = id(new PhabricatorHandleQuery()) + ->setViewer($this->requireActor()) + ->withPHIDs(array($cut_point->getPHID())) + ->executeOne(); list($name, $errors) = id(new ReleephBranchTemplate()) ->setCommitHandle($cut_point_handle) diff --git a/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php b/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php index 71831e1ca1..59dd53b161 100644 --- a/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php +++ b/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php @@ -49,9 +49,10 @@ final class ReleephIntentFieldSpecification $pusher_phids = $this->getReleephProject()->getPushers(); $phids = array_unique($pusher_phids + array_keys($intents)); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getUser()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $tokens = array(); foreach ($phids as $phid) { diff --git a/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php b/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php index 0d1ff9b4cf..a6dd00b5d5 100644 --- a/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php +++ b/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php @@ -40,10 +40,11 @@ final class ReleephRequestorFieldSpecification public function renderValueForCommitMessage() { $phid = $this->getReleephRequest()->getRequestUserPHID(); - $handles = id(new PhabricatorObjectHandleData(array($phid))) + $handle = id(new PhabricatorHandleQuery()) ->setViewer($this->getUser()) - ->loadHandles(); - return $handles[$phid]->getName(); + ->withPHIDs(array($phid)) + ->executeOne(); + return $handle->getName(); } } diff --git a/src/applications/releeph/query/ReleephRequestSearchEngine.php b/src/applications/releeph/query/ReleephRequestSearchEngine.php index a2378e51fc..cc38899a8c 100644 --- a/src/applications/releeph/query/ReleephRequestSearchEngine.php +++ b/src/applications/releeph/query/ReleephRequestSearchEngine.php @@ -60,9 +60,10 @@ final class ReleephRequestSearchEngine PhabricatorSavedQuery $saved_query) { $phids = $saved_query->getParameter('requestorPHIDs', array()); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireViewer()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $requestor_tokens = mpull($handles, 'getFullName', 'getPHID'); $form diff --git a/src/applications/releeph/storage/ReleephBranch.php b/src/applications/releeph/storage/ReleephBranch.php index b5b7a3dc17..b373467ee6 100644 --- a/src/applications/releeph/storage/ReleephBranch.php +++ b/src/applications/releeph/storage/ReleephBranch.php @@ -130,9 +130,10 @@ final class ReleephBranch extends ReleephDAO $phids_to_phetch[] = $rr->loadRequestCommitDiffPHID(); } } - $handles = id(new PhabricatorObjectHandleData($phids_to_phetch)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->loadHandles(); + ->withPHIDs($phids_to_phetch) + ->execute(); return $handles; } diff --git a/src/applications/releeph/view/user/ReleephUserView.php b/src/applications/releeph/view/user/ReleephUserView.php index 129c846bac..e09dc6d1da 100644 --- a/src/applications/releeph/view/user/ReleephUserView.php +++ b/src/applications/releeph/view/user/ReleephUserView.php @@ -39,9 +39,10 @@ abstract class ReleephUserView extends AphrontView { if ($todo) { self::$handles = array_merge( self::$handles, - id(new PhabricatorObjectHandleData($todo)) - ->setViewer($this->getUser()) - ->loadHandles()); + id(new PhabricatorHandleQuery()) + ->setViewer($this->getUser()) + ->withPHIDs($todo) + ->execute()); $this->loadInner($todo); } } diff --git a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php index 81f420bee8..6a5cd05f10 100644 --- a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php +++ b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php @@ -83,9 +83,10 @@ final class PhabricatorRepositoryCommitHeraldWorker $commit->getPHID(), )); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $commit_handle = $handles[$commit->getPHID()]; $commit_name = $commit_handle->getName(); @@ -163,9 +164,10 @@ final class PhabricatorRepositoryCommitHeraldWorker $mails = $reply_handler->multiplexMail( $template, - id(new PhabricatorObjectHandleData($email_phids)) - ->setViewer(PhabricatorUser::getOmnipotentUser()) - ->loadHandles(), + id(new PhabricatorHandleQuery()) + ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->withPHIDs($email_phids) + ->execute(), array()); foreach ($mails as $mail) { diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php index 6758f4413c..1b893ac206 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php @@ -226,9 +226,11 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker if (!$user_phid) { return $default; } - $handle = PhabricatorObjectHandleData::loadOneHandle( - $user_phid, - $actor); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer($actor) + ->withPHIDs(array($user_phid)) + ->executeOne(); + return '@'.$handle->getName(); } diff --git a/src/applications/search/controller/PhabricatorSearchAttachController.php b/src/applications/search/controller/PhabricatorSearchAttachController.php index bc4483162a..5c9483dad8 100644 --- a/src/applications/search/controller/PhabricatorSearchAttachController.php +++ b/src/applications/search/controller/PhabricatorSearchAttachController.php @@ -26,16 +26,18 @@ final class PhabricatorSearchAttachController $request = $this->getRequest(); $user = $request->getUser(); - $handle_data = new PhabricatorObjectHandleData(array($this->phid)); - $handle_data->setViewer($user); - $handles = $handle_data->loadHandles(); - $handle = $handles[$this->phid]; + $handle = id(New PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs(array($this->phid)) + ->executeOne(); $object_type = $handle->getType(); $attach_type = $this->type; - $objects = $handle_data->loadObjects(); - $object = idx($objects, $this->phid); + $object = id(new PhabricatorObjectQuery()) + ->setViewer($user) + ->withPHIDs(array($this->phid)) + ->executeOne(); if (!$object) { return new Aphront404Response(); diff --git a/src/applications/search/controller/PhabricatorSearchController.php b/src/applications/search/controller/PhabricatorSearchController.php index b98d1fd795..f1111debc3 100644 --- a/src/applications/search/controller/PhabricatorSearchController.php +++ b/src/applications/search/controller/PhabricatorSearchController.php @@ -233,11 +233,14 @@ final class PhabricatorSearchController } if ($results) { - - $loader = id(new PhabricatorObjectHandleData($results)) - ->setViewer($user); - $handles = $loader->loadHandles(); - $objects = $loader->loadObjects(); + $handles = id(new PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs($results) + ->execute(); + $objects = id(new PhabricatorObjectQuery()) + ->setViewer($user) + ->withPHIDs($results) + ->execute(); $results = array(); foreach ($handles as $phid => $handle) { $view = id(new PhabricatorSearchResultView()) diff --git a/src/applications/search/controller/PhabricatorSearchHovercardController.php b/src/applications/search/controller/PhabricatorSearchHovercardController.php index 8bac125718..e57cbd191b 100644 --- a/src/applications/search/controller/PhabricatorSearchHovercardController.php +++ b/src/applications/search/controller/PhabricatorSearchHovercardController.php @@ -12,10 +12,14 @@ final class PhabricatorSearchHovercardController $phids = $request->getArr('phids'); - $handle_data = new PhabricatorObjectHandleData($phids); - $handle_data->setViewer($user); - $handles = $handle_data->loadHandles(); - $objects = $handle_data->loadObjects(); + $handles = id(new PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs($phids) + ->execute(); + $objects = id(new PhabricatorObjectQuery()) + ->setViewer($user) + ->withPHIDs($phids) + ->execute(); $cards = array(); diff --git a/src/applications/search/engine/PhabricatorSearchEngineElastic.php b/src/applications/search/engine/PhabricatorSearchEngineElastic.php index 106eac6ec2..5b0f9aeaa0 100644 --- a/src/applications/search/engine/PhabricatorSearchEngineElastic.php +++ b/src/applications/search/engine/PhabricatorSearchEngineElastic.php @@ -25,9 +25,10 @@ final class PhabricatorSearchEngineElastic extends PhabricatorSearchEngine { $type = $doc->getDocumentType(); $phid = $doc->getPHID(); - $handle = PhabricatorObjectHandleData::loadOneHandle( - $phid, - PhabricatorUser::getOmnipotentUser()); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->withPHIDs(array($phid)) + ->executeOne(); // URL is not used internally but it can be useful externally. $spec = array( diff --git a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php index 00abbf5fff..39bac60ae2 100644 --- a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php +++ b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php @@ -29,9 +29,10 @@ final class PhabricatorSlowvoteSearchEngine AphrontFormView $form, PhabricatorSavedQuery $saved_query) { $phids = $saved_query->getParameter('authorPHIDs', array()); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireViewer()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $author_tokens = mpull($handles, 'getFullName', 'getPHID'); $voted = $saved_query->getParameter('voted', false); diff --git a/src/applications/slowvote/view/SlowvoteEmbedView.php b/src/applications/slowvote/view/SlowvoteEmbedView.php index cbda276f07..8bf910e0cf 100644 --- a/src/applications/slowvote/view/SlowvoteEmbedView.php +++ b/src/applications/slowvote/view/SlowvoteEmbedView.php @@ -36,9 +36,10 @@ final class SlowvoteEmbedView extends AphrontView { } $phids[] = $poll->getAuthorPHID(); - $this->handles = id(new PhabricatorObjectHandleData($phids)) + $this->handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getUser()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $options = $poll->getOptions(); diff --git a/src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php b/src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php index ace77ff978..d46fc37986 100644 --- a/src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php +++ b/src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php @@ -32,17 +32,15 @@ final class PhabricatorSubscriptionsEditController $user = $request->getUser(); $phid = $this->phid; - // TODO: This is a policy test because `loadObjects()` is not currently - // policy-aware. Once it is, we can collapse this. - $handle = PhabricatorObjectHandleData::loadOneHandle($phid, $user); - if (!$handle->isComplete()) { - return new Aphront404Response(); - } - - $objects = id(new PhabricatorObjectHandleData(array($phid))) + $handle = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->loadObjects(); - $object = idx($objects, $phid); + ->withPHIDs(array($phid)) + ->executeOne(); + + $object = id(new PhabricatorObjectQuery()) + ->setViewer($user) + ->withPHIDs(array($phid)) + ->executeOne(); if (!($object instanceof PhabricatorSubscribableInterface)) { return $this->buildErrorResponse( diff --git a/src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php b/src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php index 8d9e07fe26..210a25d06a 100644 --- a/src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php +++ b/src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php @@ -98,9 +98,10 @@ final class PhabricatorSubscriptionsUIEventListener $subscribers = PhabricatorSubscribersQuery::loadSubscribersForPHID( $object->getPHID()); if ($subscribers) { - $handles = id(new PhabricatorObjectHandleData($subscribers)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->loadHandles(); + ->withPHIDs($subscribers) + ->execute(); $sub_view = array(); foreach ($subscribers as $subscriber) { $sub_view[] = $handles[$subscriber]->renderLink(); diff --git a/src/applications/tokens/controller/PhabricatorTokenGiveController.php b/src/applications/tokens/controller/PhabricatorTokenGiveController.php index 41e755f5e5..480cc992a7 100644 --- a/src/applications/tokens/controller/PhabricatorTokenGiveController.php +++ b/src/applications/tokens/controller/PhabricatorTokenGiveController.php @@ -12,7 +12,10 @@ final class PhabricatorTokenGiveController extends PhabricatorTokenController { $request = $this->getRequest(); $user = $request->getUser(); - $handle = PhabricatorObjectHandleData::loadOneHandle($this->phid, $user); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs(array($this->phid)) + ->executeOne(); if (!$handle->isComplete()) { return new Aphront404Response(); } diff --git a/src/applications/tokens/controller/PhabricatorTokenGivenController.php b/src/applications/tokens/controller/PhabricatorTokenGivenController.php index 16a5643036..471bb47fc1 100644 --- a/src/applications/tokens/controller/PhabricatorTokenGivenController.php +++ b/src/applications/tokens/controller/PhabricatorTokenGivenController.php @@ -18,9 +18,10 @@ final class PhabricatorTokenGivenController extends PhabricatorTokenController { $object_phids = mpull($tokens_given, 'getObjectPHID'); $user_phids = mpull($tokens_given, 'getAuthorPHID'); $handle_phids = array_merge($object_phids, $user_phids); - $handles = id(new PhabricatorObjectHandleData($handle_phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->loadHandles(); + ->withPHIDs($handle_phids) + ->execute(); } $tokens = array(); diff --git a/src/applications/tokens/controller/PhabricatorTokenLeaderController.php b/src/applications/tokens/controller/PhabricatorTokenLeaderController.php index 1e6485a369..271a5f1ab7 100644 --- a/src/applications/tokens/controller/PhabricatorTokenLeaderController.php +++ b/src/applications/tokens/controller/PhabricatorTokenLeaderController.php @@ -19,9 +19,10 @@ final class PhabricatorTokenLeaderController $phids = array(); if ($counts) { $phids = mpull($objects, 'getPHID'); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); } $list = new PHUIObjectItemListView(); diff --git a/src/applications/tokens/editor/PhabricatorTokenGivenEditor.php b/src/applications/tokens/editor/PhabricatorTokenGivenEditor.php index 04014d2d46..56b2cee8f3 100644 --- a/src/applications/tokens/editor/PhabricatorTokenGivenEditor.php +++ b/src/applications/tokens/editor/PhabricatorTokenGivenEditor.php @@ -99,10 +99,10 @@ final class PhabricatorTokenGivenEditor } private function validateObject($object_phid) { - $objects = id(new PhabricatorObjectHandleData(array($object_phid))) + $object = id(new PhabricatorObjectQuery()) ->setViewer($this->requireActor()) - ->loadObjects(); - $object = head($objects); + ->withPHIDs(array($object_phid)) + ->executeOne(); if (!$object) { throw new Exception("No such object!"); diff --git a/src/applications/tokens/event/PhabricatorTokenUIEventListener.php b/src/applications/tokens/event/PhabricatorTokenUIEventListener.php index fba8e4e16e..97da41b95f 100644 --- a/src/applications/tokens/event/PhabricatorTokenUIEventListener.php +++ b/src/applications/tokens/event/PhabricatorTokenUIEventListener.php @@ -93,9 +93,10 @@ final class PhabricatorTokenUIEventListener $tokens = mpull($tokens, null, 'getPHID'); $author_phids = mpull($tokens_given, 'getAuthorPHID'); - $handles = id(new PhabricatorObjectHandleData($author_phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($user) - ->loadHandles(); + ->withPHIDs($author_phids) + ->execute(); Javelin::initBehavior('phabricator-tooltips'); diff --git a/src/applications/tokens/query/PhabricatorTokenGivenQuery.php b/src/applications/tokens/query/PhabricatorTokenGivenQuery.php index 6adbdac332..27a2c959dd 100644 --- a/src/applications/tokens/query/PhabricatorTokenGivenQuery.php +++ b/src/applications/tokens/query/PhabricatorTokenGivenQuery.php @@ -72,9 +72,10 @@ final class PhabricatorTokenGivenQuery return array(); } - $objects = id(new PhabricatorObjectHandleData($object_phids)) + $objects = id(new PhabricatorObjectQuery()) ->setViewer($this->getViewer()) - ->loadObjects(); + ->withPHIDs($object_phids) + ->execute(); foreach ($results as $key => $result) { $phid = $result->getObjectPHID(); diff --git a/src/applications/tokens/query/PhabricatorTokenReceiverQuery.php b/src/applications/tokens/query/PhabricatorTokenReceiverQuery.php index 196954d43b..bfa784fa41 100644 --- a/src/applications/tokens/query/PhabricatorTokenReceiverQuery.php +++ b/src/applications/tokens/query/PhabricatorTokenReceiverQuery.php @@ -19,9 +19,10 @@ final class PhabricatorTokenReceiverQuery } public function willFilterPage(array $phids) { - $objects = id(new PhabricatorObjectHandleData($phids)) + $objects = id(new PhabricatorObjectQuery()) ->setViewer($this->getViewer()) - ->loadObjects(); + ->withPHIDs($phids) + ->execute(); // Reorder the objects in the input order. $objects = array_select_keys($objects, $phids); diff --git a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentEditController.php b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentEditController.php index a03ee84e67..2c36781786 100644 --- a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentEditController.php +++ b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentEditController.php @@ -19,9 +19,6 @@ final class PhabricatorApplicationTransactionCommentEditController ->executeOne(); if (!$xaction) { - // TODO: This may also mean you don't have permission to edit the object, - // but we can't make that distinction via PhabricatorObjectHandleData - // at the moment. return new Aphront404Response(); } @@ -32,7 +29,10 @@ final class PhabricatorApplicationTransactionCommentEditController } $obj_phid = $xaction->getObjectPHID(); - $obj_handle = PhabricatorObjectHandleData::loadOneHandle($obj_phid, $user); + $obj_handle = id(new PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs(array($obj_phid)) + ->executeOne(); if ($request->isDialogFormPost()) { $text = $request->getStr('text'); diff --git a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentHistoryController.php b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentHistoryController.php index c925ab7c69..b7fa42486e 100644 --- a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentHistoryController.php +++ b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentHistoryController.php @@ -19,9 +19,6 @@ final class PhabricatorApplicationTransactionCommentHistoryController ->executeOne(); if (!$xaction) { - // TODO: This may also mean you don't have permission to edit the object, - // but we can't make that distinction via PhabricatorObjectHandleData - // at the moment. return new Aphront404Response(); } @@ -53,7 +50,10 @@ final class PhabricatorApplicationTransactionCommentHistoryController } $obj_phid = $xaction->getObjectPHID(); - $obj_handle = PhabricatorObjectHandleData::loadOneHandle($obj_phid, $user); + $obj_handle = id(new PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs(array($obj_phid)) + ->executeOne(); $view = id(new PhabricatorApplicationTransactionView()) ->setUser($user) diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 887a7910db..6995cf4802 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -535,9 +535,10 @@ abstract class PhabricatorApplicationTransactionEditor $handles = array(); $merged = array_mergev($phids); if ($merged) { - $handles = id(new PhabricatorObjectHandleData($merged)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireActor()) - ->loadHandles(); + ->withPHIDs($merged) + ->execute(); } foreach ($xactions as $key => $xaction) { $xaction->setHandles(array_select_keys($handles, $phids[$key])); @@ -1084,9 +1085,10 @@ abstract class PhabricatorApplicationTransactionEditor $email_cc = array_unique($this->getMailCC($object)); $phids = array_merge($email_to, $email_cc); - $handles = id(new PhabricatorObjectHandleData($phids)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->requireActor()) - ->loadHandles(); + ->withPHIDs($phids) + ->execute(); $template = $this->buildMailTemplate($object); $body = $this->buildMailBody($object, $xactions); diff --git a/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php b/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php index f41f0b44fd..8ddad3a366 100644 --- a/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php +++ b/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php @@ -100,9 +100,10 @@ abstract class PhabricatorApplicationTransactionQuery $handles = array(); $merged = array_mergev($phids); if ($merged) { - $handles = id(new PhabricatorObjectHandleData($merged)) + $handles = id(new PhabricatorHandleQuery()) ->setViewer($this->getViewer()) - ->loadHandles(); + ->withPHIDs($merged) + ->execute(); } foreach ($xactions as $xaction) { $xaction->setHandles( diff --git a/src/applications/uiexample/examples/PHUIObjectItemListExample.php b/src/applications/uiexample/examples/PHUIObjectItemListExample.php index 472d8dc8c3..815fddb217 100644 --- a/src/applications/uiexample/examples/PHUIObjectItemListExample.php +++ b/src/applications/uiexample/examples/PHUIObjectItemListExample.php @@ -15,9 +15,10 @@ final class PHUIObjectItemListExample extends PhabricatorUIExample { $request = $this->getRequest(); $user = $request->getUser(); - $handle = PhabricatorObjectHandleData::loadOneHandle( - $user->getPHID(), - $user); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs(array($user->getPHID())) + ->executeOne(); $out = array(); @@ -231,7 +232,7 @@ final class PHUIObjectItemListExample extends PhabricatorUIExample { id(new PHUIObjectItemView()) ->setHeader(pht('Ace of Hearts')) ->setSubHead( - pht('This is the most powerful card in the game "Hearts".')) + pht('This is a powerful card in the game "Hearts".')) ->setHref('#') ->addAttribute(pht('Suit: Hearts')) ->addAttribute(pht('Rank: Ace')) diff --git a/src/applications/uiexample/examples/PhabricatorTimelineExample.php b/src/applications/uiexample/examples/PhabricatorTimelineExample.php index ced405e78c..b1c53f6d60 100644 --- a/src/applications/uiexample/examples/PhabricatorTimelineExample.php +++ b/src/applications/uiexample/examples/PhabricatorTimelineExample.php @@ -15,9 +15,10 @@ final class PhabricatorTimelineExample extends PhabricatorUIExample { $request = $this->getRequest(); $user = $request->getUser(); - $handle = PhabricatorObjectHandleData::loadOneHandle( - $user->getPHID(), - $user); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer($user) + ->withPHIDs(array($user->getPHID())) + ->executeOne(); $events = array(); diff --git a/src/infrastructure/edges/query/PhabricatorEdgeQuery.php b/src/infrastructure/edges/query/PhabricatorEdgeQuery.php index 90bc8c807a..f42af09848 100644 --- a/src/infrastructure/edges/query/PhabricatorEdgeQuery.php +++ b/src/infrastructure/edges/query/PhabricatorEdgeQuery.php @@ -220,9 +220,10 @@ final class PhabricatorEdgeQuery extends PhabricatorQuery { * * // Gets all of the destinations. * $all_phids = $query->getDestinationPHIDs(); - * $handles = id(new PhabricatorObjectHandleData($all_phids)) + * $handles = id(new PhabricatorHandleQuery()) * ->setViewer($viewer) - * ->loadHandles(); + * ->withPHIDs($all_phids) + * ->execute(); * * foreach ($objects as $object) { * // Get all of the destinations for the given object.