@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<?php
2
3final class PHIDInfoConduitAPIMethod extends PHIDConduitAPIMethod {
4
5 public function getAPIMethodName() {
6 return 'phid.info';
7 }
8
9 public function getMethodStatus() {
10 return self::METHOD_STATUS_DEPRECATED;
11 }
12
13 public function getMethodStatusDescription() {
14 return pht(
15 'This method has been deprecated since %s in favor of %s.',
16 '04/2012',
17 'phid.query');
18 }
19
20 public function getMethodDescription() {
21 return pht('Retrieve information about an arbitrary PHID.');
22 }
23
24 protected function defineParamTypes() {
25 return array(
26 'phid' => 'required phid',
27 );
28 }
29
30 protected function defineReturnType() {
31 return 'nonempty dict<string, wild>';
32 }
33
34 protected function defineErrorTypes() {
35 return array(
36 'ERR-BAD-PHID' => pht('No such object exists.'),
37 );
38 }
39
40 protected function execute(ConduitAPIRequest $request) {
41 $phid = $request->getValue('phid');
42
43 $handle = id(new PhabricatorHandleQuery())
44 ->setViewer($request->getUser())
45 ->withPHIDs(array($phid))
46 ->executeOne();
47
48 if (!$handle->isComplete()) {
49 throw new ConduitException('ERR-BAD-PHID');
50 }
51
52 return $this->buildHandleInformationDictionary($handle);
53 }
54
55}