Path: blob/master/src/applications/differential/conduit/DifferentialCloseConduitAPIMethod.php
12256 views
<?php12final class DifferentialCloseConduitAPIMethod3extends DifferentialConduitAPIMethod {45public function getAPIMethodName() {6return 'differential.close';7}89public function getMethodDescription() {10return pht('Close a Differential revision.');11}1213public function getMethodStatus() {14return self::METHOD_STATUS_FROZEN;15}1617public function getMethodStatusDescription() {18return pht(19'This method is frozen and will eventually be deprecated. New code '.20'should use "differential.revision.edit" instead.');21}2223protected function defineParamTypes() {24return array(25'revisionID' => 'required int',26);27}2829protected function defineReturnType() {30return 'void';31}3233protected function defineErrorTypes() {34return array(35'ERR_NOT_FOUND' => pht('Revision was not found.'),36);37}3839protected function execute(ConduitAPIRequest $request) {40$viewer = $request->getUser();41$id = $request->getValue('revisionID');4243$revision = id(new DifferentialRevisionQuery())44->withIDs(array($id))45->setViewer($viewer)46->needReviewers(true)47->executeOne();48if (!$revision) {49throw new ConduitException('ERR_NOT_FOUND');50}5152$xactions = array();53$xactions[] = id(new DifferentialTransaction())54->setTransactionType(55DifferentialRevisionCloseTransaction::TRANSACTIONTYPE)56->setNewValue(true);5758$content_source = $request->newContentSource();5960$editor = id(new DifferentialTransactionEditor())61->setActor($viewer)62->setContentSource($request->newContentSource())63->setContinueOnMissingFields(true)64->setContinueOnNoEffect(true);6566$editor->applyTransactions($revision, $xactions);6768return;69}7071}727374