2012-05-03 23:46:11 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorFileShortcutController
|
|
|
|
extends PhabricatorFileController {
|
|
|
|
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
public function willProcessRequest(array $data) {
|
|
|
|
$this->id = $data['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function processRequest() {
|
2013-09-30 18:38:13 +02:00
|
|
|
$file = id(new PhabricatorFileQuery())
|
|
|
|
->setViewer($this->getRequest()->getUser())
|
|
|
|
->withIDs(array($this->id))
|
|
|
|
->executeOne();
|
2012-05-03 23:46:11 +02:00
|
|
|
if (!$file) {
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
2013-09-30 18:38:13 +02:00
|
|
|
|
2012-05-03 23:46:11 +02:00
|
|
|
return id(new AphrontRedirectResponse())->setURI($file->getBestURI());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|