Path: blob/master/src/applications/harbormaster/controller/HarbormasterBuildLogDownloadController.php
12256 views
<?php12final class HarbormasterBuildLogDownloadController3extends HarbormasterController {45public function shouldAllowPublic() {6return true;7}89public function handleRequest(AphrontRequest $request) {10$request = $this->getRequest();11$viewer = $request->getUser();1213$id = $request->getURIData('id');1415$log = id(new HarbormasterBuildLogQuery())16->setViewer($viewer)17->withIDs(array($id))18->executeOne();19if (!$log) {20return new Aphront404Response();21}2223$cancel_uri = $log->getURI();24$file_phid = $log->getFilePHID();2526if (!$file_phid) {27return $this->newDialog()28->setTitle(pht('Log Not Finalized'))29->appendParagraph(30pht(31'Logs must be fully written and processed before they can be '.32'downloaded. This log is still being written or processed.'))33->addCancelButton($cancel_uri, pht('Wait Patiently'));34}3536$file = id(new PhabricatorFileQuery())37->setViewer($viewer)38->withPHIDs(array($file_phid))39->executeOne();40if (!$file) {41return $this->newDialog()42->setTitle(pht('Unable to Load File'))43->appendParagraph(44pht(45'Unable to load the file for this log. The file may have been '.46'destroyed.'))47->addCancelButton($cancel_uri);48}4950return $file->newDownloadResponse();51}5253}545556