Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/differential/conduit/DifferentialQueryDiffsConduitAPIMethod.php
12256 views
1
<?php
2
3
final class DifferentialQueryDiffsConduitAPIMethod
4
extends DifferentialConduitAPIMethod {
5
6
public function getAPIMethodName() {
7
return 'differential.querydiffs';
8
}
9
10
public function getMethodDescription() {
11
return pht('Query differential diffs which match certain criteria.');
12
}
13
14
public function getMethodStatus() {
15
return self::METHOD_STATUS_FROZEN;
16
}
17
18
public function getMethodStatusDescription() {
19
return pht(
20
'This method is frozen and will eventually be deprecated. New code '.
21
'should use "differential.diff.search" instead.');
22
}
23
24
protected function defineParamTypes() {
25
return array(
26
'ids' => 'optional list<uint>',
27
'revisionIDs' => 'optional list<uint>',
28
);
29
}
30
31
protected function defineReturnType() {
32
return 'list<dict>';
33
}
34
35
protected function execute(ConduitAPIRequest $request) {
36
$ids = $request->getValue('ids', array());
37
$revision_ids = $request->getValue('revisionIDs', array());
38
39
if (!$ids && !$revision_ids) {
40
// This method just returns nothing if you pass no constraints because
41
// pagination hadn't been invented yet in 2008 when this method was
42
// written.
43
return array();
44
}
45
46
$query = id(new DifferentialDiffQuery())
47
->setViewer($request->getUser())
48
->needChangesets(true);
49
50
if ($ids) {
51
$query->withIDs($ids);
52
}
53
54
if ($revision_ids) {
55
$query->withRevisionIDs($revision_ids);
56
}
57
58
$diffs = $query->execute();
59
60
return mpull($diffs, 'getDiffDict', 'getID');
61
}
62
63
}
64
65