[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DiffusionPathCompleteController extends DiffusionController { 4 5 public function willProcessRequest(array $data) { 6 // Don't build a DiffusionRequest. 7 } 8 9 public function processRequest() { 10 $request = $this->getRequest(); 11 12 $repository_phid = $request->getStr('repositoryPHID'); 13 $repository = id(new PhabricatorRepositoryQuery()) 14 ->setViewer($request->getUser()) 15 ->withPHIDs(array($repository_phid)) 16 ->executeOne(); 17 if (!$repository) { 18 return new Aphront400Response(); 19 } 20 21 $query_path = $request->getStr('q'); 22 if (preg_match('@/$@', $query_path)) { 23 $query_dir = $query_path; 24 } else { 25 $query_dir = dirname($query_path).'/'; 26 } 27 $query_dir = ltrim($query_dir, '/'); 28 29 $drequest = DiffusionRequest::newFromDictionary( 30 array( 31 'user' => $request->getUser(), 32 'repository' => $repository, 33 'path' => $query_dir, 34 )); 35 $this->setDiffusionRequest($drequest); 36 37 $browse_results = DiffusionBrowseResultSet::newFromConduit( 38 $this->callConduitWithDiffusionRequest( 39 'diffusion.browsequery', 40 array( 41 'path' => $drequest->getPath(), 42 'commit' => $drequest->getCommit(), 43 ))); 44 $paths = $browse_results->getPaths(); 45 46 $output = array(); 47 foreach ($paths as $path) { 48 $full_path = $query_dir.$path->getPath(); 49 if ($path->getFileType() == DifferentialChangeType::FILE_DIRECTORY) { 50 $full_path .= '/'; 51 } 52 $output[] = array('/'.$full_path, null, substr(md5($full_path), 0, 7)); 53 } 54 55 return id(new AphrontAjaxResponse())->setContent($output); 56 } 57 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |