getRequest(); $repository_phid = $request->getStr('repositoryPHID'); $repository = id(new PhabricatorRepository())->loadOneWhere( 'phid = %s', $repository_phid); if (!$repository) { return new Aphront400Response(); } $query_path = $request->getStr('q'); $query_path = ltrim($query_path, '/'); if (preg_match('@/$@', $query_path)) { $query_dir = $query_path; } else { $query_dir = dirname($query_path); if ($query_dir == '.') { $query_dir = ''; } } $drequest = DiffusionRequest::newFromAphrontRequestDictionary( array( 'callsign' => $repository->getCallsign(), 'path' => ':/'.$query_dir, )); $browse_query = DiffusionBrowseQuery::newFromDiffusionRequest($drequest); $paths = $browse_query->loadPaths(); $output = array(); foreach ($paths as $path) { $full_path = $query_dir.$path->getPath(); if ($path->getFileType() == DifferentialChangeType::FILE_DIRECTORY) { $full_path .= '/'; } $output[] = array('/'.$full_path, null, substr(md5($full_path), 0, 7)); } return id(new AphrontAjaxResponse())->setContent($output); } }