 855e085c6f
			
		
	
	855e085c6f
	
	
	
		
			
			Summary: Fixes T2698. When applications are installed, their Conduit calls should drop out. This will also let us land Releeph without exposing Conduit calls. Test Plan: - Viewed Conduit console; uninstalled some applications and verified their calls dropped out. - Tried to make an uninstalled call; got an appropriate error. Reviewers: edward, btrahan Reviewed By: edward CC: aran Maniphest Tasks: T2698 Differential Revision: https://secure.phabricator.com/D5302
		
			
				
	
	
		
			57 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| /**
 | |
|  * @group conduit
 | |
|  */
 | |
| final class ConduitAPI_diffusion_getrecentcommitsbypath_Method
 | |
|   extends ConduitAPI_diffusion_Method {
 | |
| 
 | |
|   const DEFAULT_LIMIT = 10;
 | |
| 
 | |
|   public function getMethodDescription() {
 | |
|     return "Get commit identifiers for recent commits affecting a given path.";
 | |
|   }
 | |
| 
 | |
|   public function defineParamTypes() {
 | |
|     return array(
 | |
|       'callsign' => 'required string',
 | |
|       'path' => 'required string',
 | |
|       'limit' => 'optional int',
 | |
|     );
 | |
|   }
 | |
| 
 | |
|   public function defineReturnType() {
 | |
|     return 'nonempty list<string>';
 | |
|   }
 | |
| 
 | |
|   public function defineErrorTypes() {
 | |
|     return array(
 | |
|     );
 | |
|   }
 | |
| 
 | |
|   protected function execute(ConduitAPIRequest $request) {
 | |
|     $drequest = DiffusionRequest::newFromDictionary(
 | |
|       array(
 | |
|         'callsign'  => $request->getValue('callsign'),
 | |
|         'path'      => $request->getValue('path'),
 | |
|       ));
 | |
| 
 | |
|     $limit = nonempty(
 | |
|       $request->getValue('limit'),
 | |
|       self::DEFAULT_LIMIT);
 | |
| 
 | |
|     $history = DiffusionHistoryQuery::newFromDiffusionRequest($drequest)
 | |
|     ->setLimit($limit)
 | |
|     ->needDirectChanges(true)
 | |
|     ->needChildChanges(true)
 | |
|     ->loadHistory();
 | |
| 
 | |
|     $raw_commit_identifiers = mpull($history, 'getCommitIdentifier');
 | |
|     $result = array();
 | |
|     foreach ($raw_commit_identifiers as $id) {
 | |
|       $result[] = 'r'.$request->getValue('callsign').$id;
 | |
|     }
 | |
|     return $result;
 | |
|   }
 | |
| }
 |