Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / phurl / controller / PhabricatorPhurlURLAccessController.php
blob377b627a7ec8cd7ab697bcb15265cd7628789aad
1 <?php
3 final class PhabricatorPhurlURLAccessController
4 extends PhabricatorPhurlController {
6 public function shouldAllowPublic() {
7 return true;
10 public function handleRequest(AphrontRequest $request) {
11 $viewer = $this->getViewer();
12 $id = $request->getURIData('id');
13 $alias = $request->getURIData('alias');
15 if ($id) {
16 $url = id(new PhabricatorPhurlURLQuery())
17 ->setViewer($viewer)
18 ->withIDs(array($id))
19 ->executeOne();
20 } else if ($alias) {
21 $url = id(new PhabricatorPhurlURLQuery())
22 ->setViewer($viewer)
23 ->withAliases(array($alias))
24 ->executeOne();
27 if (!$url) {
28 return new Aphront404Response();
31 if ($url->isValid()) {
32 return id(new AphrontRedirectResponse())
33 ->setURI($url->getLongURL())
34 ->setIsExternal(true);
35 } else {
36 return id(new AphrontRedirectResponse())->setURI('/'.$url->getMonogram());