Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15467762
D14781.id35742.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D14781.id35742.diff
View Options
diff --git a/src/applications/conduit/method/ConduitAPIMethod.php b/src/applications/conduit/method/ConduitAPIMethod.php
--- a/src/applications/conduit/method/ConduitAPIMethod.php
+++ b/src/applications/conduit/method/ConduitAPIMethod.php
@@ -139,6 +139,16 @@
return "{$head}.{$ord}.{$tail}";
}
+ public static function getMethodStatusMap() {
+ $map = array(
+ self::METHOD_STATUS_STABLE => pht('Stable'),
+ self::METHOD_STATUS_UNSTABLE => pht('Unstable'),
+ self::METHOD_STATUS_DEPRECATED => pht('Deprecated'),
+ );
+
+ return $map;
+ }
+
public function getApplicationName() {
return head(explode('.', $this->getAPIMethodName(), 2));
}
diff --git a/src/applications/conduit/query/PhabricatorConduitLogQuery.php b/src/applications/conduit/query/PhabricatorConduitLogQuery.php
--- a/src/applications/conduit/query/PhabricatorConduitLogQuery.php
+++ b/src/applications/conduit/query/PhabricatorConduitLogQuery.php
@@ -4,12 +4,18 @@
extends PhabricatorCursorPagedPolicyAwareQuery {
private $methods;
+ private $methodStatuses;
public function withMethods(array $methods) {
$this->methods = $methods;
return $this;
}
+ public function withMethodStatuses(array $statuses) {
+ $this->methodStatuses = $statuses;
+ return $this;
+ }
+
public function newResultObject() {
return new PhabricatorConduitMethodCallLog();
}
@@ -21,13 +27,38 @@
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
$where = parent::buildWhereClauseParts($conn);
- if ($this->methods) {
+ if ($this->methods !== null) {
$where[] = qsprintf(
$conn,
'method IN (%Ls)',
$this->methods);
}
+ if ($this->methodStatuses !== null) {
+ $statuses = array_fuse($this->methodStatuses);
+
+ $methods = id(new PhabricatorConduitMethodQuery())
+ ->setViewer($this->getViewer())
+ ->execute();
+
+ $method_names = array();
+ foreach ($methods as $method) {
+ $status = $method->getMethodStatus();
+ if (isset($statuses[$status])) {
+ $method_names[] = $method->getAPIMethodName();
+ }
+ }
+
+ if (!$method_names) {
+ throw new PhabricatorEmptyQueryException();
+ }
+
+ $where[] = qsprintf(
+ $conn,
+ 'method IN (%Ls)',
+ $method_names);
+ }
+
return $where;
}
diff --git a/src/applications/conduit/query/PhabricatorConduitLogSearchEngine.php b/src/applications/conduit/query/PhabricatorConduitLogSearchEngine.php
--- a/src/applications/conduit/query/PhabricatorConduitLogSearchEngine.php
+++ b/src/applications/conduit/query/PhabricatorConduitLogSearchEngine.php
@@ -22,6 +22,10 @@
$query->withMethods($map['methods']);
}
+ if ($map['statuses']) {
+ $query->withMethodStatuses($map['statuses']);
+ }
+
return $query;
}
@@ -31,6 +35,11 @@
->setKey('methods')
->setLabel(pht('Methods'))
->setDescription(pht('Find calls to specific methods.')),
+ id(new PhabricatorSearchCheckboxesField())
+ ->setKey('statuses')
+ ->setLabel(pht('Method Status'))
+ ->setAliases(array('status'))
+ ->setOptions(ConduitAPIMethod::getMethodStatusMap()),
);
}
@@ -41,6 +50,7 @@
protected function getBuiltinQueryNames() {
$names = array(
'all' => pht('All Logs'),
+ 'deprecated' => pht('Deprecated Calls'),
);
return $names;
@@ -51,6 +61,12 @@
$query->setQueryKey($query_key);
switch ($query_key) {
+ case 'deprecated':
+ return $query->setParameter(
+ 'statuses',
+ array(
+ ConduitAPIMethod::METHOD_STATUS_DEPRECATED,
+ ));
case 'all':
return $query;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 4, 5:49 PM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7388971
Default Alt Text
D14781.id35742.diff (3 KB)
Attached To
Mode
D14781: Make it easy to find deprecated calls in the Conduit call log
Attached
Detach File
Event Timeline
Log In to Comment