@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.

Make it easy to find deprecated calls in the Conduit call log

Summary: Ref T9980. This makes it much easier to look for calls to deprecated methods.

Test Plan: {F1025851}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9980

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

+58 -1
+10
src/applications/conduit/method/ConduitAPIMethod.php
··· 139 139 return "{$head}.{$ord}.{$tail}"; 140 140 } 141 141 142 + public static function getMethodStatusMap() { 143 + $map = array( 144 + self::METHOD_STATUS_STABLE => pht('Stable'), 145 + self::METHOD_STATUS_UNSTABLE => pht('Unstable'), 146 + self::METHOD_STATUS_DEPRECATED => pht('Deprecated'), 147 + ); 148 + 149 + return $map; 150 + } 151 + 142 152 public function getApplicationName() { 143 153 return head(explode('.', $this->getAPIMethodName(), 2)); 144 154 }
+32 -1
src/applications/conduit/query/PhabricatorConduitLogQuery.php
··· 4 4 extends PhabricatorCursorPagedPolicyAwareQuery { 5 5 6 6 private $methods; 7 + private $methodStatuses; 7 8 8 9 public function withMethods(array $methods) { 9 10 $this->methods = $methods; 10 11 return $this; 11 12 } 12 13 14 + public function withMethodStatuses(array $statuses) { 15 + $this->methodStatuses = $statuses; 16 + return $this; 17 + } 18 + 13 19 public function newResultObject() { 14 20 return new PhabricatorConduitMethodCallLog(); 15 21 } ··· 21 27 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 22 28 $where = parent::buildWhereClauseParts($conn); 23 29 24 - if ($this->methods) { 30 + if ($this->methods !== null) { 25 31 $where[] = qsprintf( 26 32 $conn, 27 33 'method IN (%Ls)', 28 34 $this->methods); 35 + } 36 + 37 + if ($this->methodStatuses !== null) { 38 + $statuses = array_fuse($this->methodStatuses); 39 + 40 + $methods = id(new PhabricatorConduitMethodQuery()) 41 + ->setViewer($this->getViewer()) 42 + ->execute(); 43 + 44 + $method_names = array(); 45 + foreach ($methods as $method) { 46 + $status = $method->getMethodStatus(); 47 + if (isset($statuses[$status])) { 48 + $method_names[] = $method->getAPIMethodName(); 49 + } 50 + } 51 + 52 + if (!$method_names) { 53 + throw new PhabricatorEmptyQueryException(); 54 + } 55 + 56 + $where[] = qsprintf( 57 + $conn, 58 + 'method IN (%Ls)', 59 + $method_names); 29 60 } 30 61 31 62 return $where;
+16
src/applications/conduit/query/PhabricatorConduitLogSearchEngine.php
··· 22 22 $query->withMethods($map['methods']); 23 23 } 24 24 25 + if ($map['statuses']) { 26 + $query->withMethodStatuses($map['statuses']); 27 + } 28 + 25 29 return $query; 26 30 } 27 31 ··· 31 35 ->setKey('methods') 32 36 ->setLabel(pht('Methods')) 33 37 ->setDescription(pht('Find calls to specific methods.')), 38 + id(new PhabricatorSearchCheckboxesField()) 39 + ->setKey('statuses') 40 + ->setLabel(pht('Method Status')) 41 + ->setAliases(array('status')) 42 + ->setOptions(ConduitAPIMethod::getMethodStatusMap()), 34 43 ); 35 44 } 36 45 ··· 41 50 protected function getBuiltinQueryNames() { 42 51 $names = array( 43 52 'all' => pht('All Logs'), 53 + 'deprecated' => pht('Deprecated Calls'), 44 54 ); 45 55 46 56 return $names; ··· 51 61 $query->setQueryKey($query_key); 52 62 53 63 switch ($query_key) { 64 + case 'deprecated': 65 + return $query->setParameter( 66 + 'statuses', 67 + array( 68 + ConduitAPIMethod::METHOD_STATUS_DEPRECATED, 69 + )); 54 70 case 'all': 55 71 return $query; 56 72 }