[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/differential/conduit/ -> DifferentialGetCommitPathsConduitAPIMethod.php (source)

   1  <?php
   2  
   3  final class DifferentialGetCommitPathsConduitAPIMethod
   4    extends DifferentialConduitAPIMethod {
   5  
   6    public function getAPIMethodName() {
   7      return 'differential.getcommitpaths';
   8    }
   9  
  10    public function getMethodDescription() {
  11      return 'Query which paths should be included when committing a '.
  12             'Differential revision.';
  13    }
  14  
  15    public function defineParamTypes() {
  16      return array(
  17        'revision_id' => 'required int',
  18      );
  19    }
  20  
  21    public function defineReturnType() {
  22      return 'nonempty list<string>';
  23    }
  24  
  25    public function defineErrorTypes() {
  26      return array(
  27        'ERR_NOT_FOUND' => 'No such revision exists.',
  28      );
  29    }
  30  
  31    protected function execute(ConduitAPIRequest $request) {
  32      $id = $request->getValue('revision_id');
  33  
  34      $revision = id(new DifferentialRevisionQuery())
  35        ->setViewer($request->getUser())
  36        ->withIDs(array($id))
  37        ->executeOne();
  38      if (!$revision) {
  39        throw new ConduitException('ERR_NOT_FOUND');
  40      }
  41  
  42      $paths = array();
  43      $diff = id(new DifferentialDiff())->loadOneWhere(
  44        'revisionID = %d ORDER BY id DESC limit 1',
  45        $revision->getID());
  46  
  47      $diff->attachChangesets($diff->loadChangesets());
  48  
  49      foreach ($diff->getChangesets() as $changeset) {
  50        $paths[] = $changeset->getFilename();
  51      }
  52  
  53      return $paths;
  54    }
  55  
  56  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1