3 final class HarbormasterBuildLogDownloadController
4 extends HarbormasterController
{
6 public function shouldAllowPublic() {
10 public function handleRequest(AphrontRequest
$request) {
11 $request = $this->getRequest();
12 $viewer = $request->getUser();
14 $id = $request->getURIData('id');
16 $log = id(new HarbormasterBuildLogQuery())
21 return new Aphront404Response();
24 $cancel_uri = $log->getURI();
25 $file_phid = $log->getFilePHID();
28 return $this->newDialog()
29 ->setTitle(pht('Log Not Finalized'))
32 'Logs must be fully written and processed before they can be '.
33 'downloaded. This log is still being written or processed.'))
34 ->addCancelButton($cancel_uri, pht('Wait Patiently'));
37 $file = id(new PhabricatorFileQuery())
39 ->withPHIDs(array($file_phid))
42 return $this->newDialog()
43 ->setTitle(pht('Unable to Load File'))
46 'Unable to load the file for this log. The file may have been '.
48 ->addCancelButton($cancel_uri);
51 return $file->newDownloadResponse();