Something went wrong. Try again.
@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
Something went wrong. Try again.
1.6 kB · 63 lines
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364<?php
final class DifferentialQueryDiffsConduitAPIMethod extends DifferentialConduitAPIMethod {
public function getAPIMethodName() { return 'differential.querydiffs'; }
public function getMethodDescription() { return pht('Query differential diffs which match certain criteria.'); }
public function getMethodStatus() { return self::METHOD_STATUS_FROZEN; }
public function getMethodStatusDescription() { return pht( 'This method is frozen and will eventually be deprecated. New code '. 'should use "differential.diff.search" instead.'); }
protected function defineParamTypes() { return array( 'ids' => 'optional list<uint>', 'revisionIDs' => 'optional list<uint>', ); }
protected function defineReturnType() { return 'list<dict>'; }
protected function execute(ConduitAPIRequest $request) { $ids = $request->getValue('ids', array()); $revision_ids = $request->getValue('revisionIDs', array());
if (!$ids && !$revision_ids) { // This method just returns nothing if you pass no constraints because // pagination hadn't been invented yet in 2008 when this method was // written. return array(); }
$query = id(new DifferentialDiffQuery()) ->setViewer($request->getUser()) ->needChangesets(true);
if ($ids) { $query->withIDs($ids); }
if ($revision_ids) { $query->withRevisionIDs($revision_ids); }
$diffs = $query->execute();
return mpull($diffs, 'getDiffDict', 'getID'); }
}