Page MenuHomePhabricator

D19487.id46603.diff
No OneTemporary

D19487.id46603.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -4449,6 +4449,7 @@
'PhabricatorSystemDAO' => 'applications/system/storage/PhabricatorSystemDAO.php',
'PhabricatorSystemDestructionGarbageCollector' => 'applications/system/garbagecollector/PhabricatorSystemDestructionGarbageCollector.php',
'PhabricatorSystemDestructionLog' => 'applications/system/storage/PhabricatorSystemDestructionLog.php',
+ 'PhabricatorSystemObjectController' => 'applications/system/controller/PhabricatorSystemObjectController.php',
'PhabricatorSystemReadOnlyController' => 'applications/system/controller/PhabricatorSystemReadOnlyController.php',
'PhabricatorSystemRemoveDestroyWorkflow' => 'applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php',
'PhabricatorSystemRemoveLogWorkflow' => 'applications/system/management/PhabricatorSystemRemoveLogWorkflow.php',
@@ -10402,6 +10403,7 @@
'PhabricatorSystemDAO' => 'PhabricatorLiskDAO',
'PhabricatorSystemDestructionGarbageCollector' => 'PhabricatorGarbageCollector',
'PhabricatorSystemDestructionLog' => 'PhabricatorSystemDAO',
+ 'PhabricatorSystemObjectController' => 'PhabricatorController',
'PhabricatorSystemReadOnlyController' => 'PhabricatorController',
'PhabricatorSystemRemoveDestroyWorkflow' => 'PhabricatorSystemRemoveWorkflow',
'PhabricatorSystemRemoveLogWorkflow' => 'PhabricatorSystemRemoveWorkflow',
diff --git a/src/applications/system/application/PhabricatorSystemApplication.php b/src/applications/system/application/PhabricatorSystemApplication.php
--- a/src/applications/system/application/PhabricatorSystemApplication.php
+++ b/src/applications/system/application/PhabricatorSystemApplication.php
@@ -26,6 +26,7 @@
'/readonly/' => array(
'(?P<reason>[^/]+)/' => 'PhabricatorSystemReadOnlyController',
),
+ '/object/(?P<name>[^/]+)/' => 'PhabricatorSystemObjectController',
);
}
diff --git a/src/applications/system/controller/PhabricatorSystemObjectController.php b/src/applications/system/controller/PhabricatorSystemObjectController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/system/controller/PhabricatorSystemObjectController.php
@@ -0,0 +1,39 @@
+<?php
+
+final class PhabricatorSystemObjectController
+ extends PhabricatorController {
+
+ public function shouldAllowPublic() {
+ return true;
+ }
+
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $name = $request->getURIData('name');
+
+ $object = id(new PhabricatorObjectQuery())
+ ->setViewer($viewer)
+ ->withNames(array($name))
+ ->executeOne();
+ if (!$object) {
+ return new Aphront404Response();
+ }
+
+ $phid = $object->getPHID();
+ $handles = $viewer->loadHandles(array($phid));
+ $handle = $handles[$phid];
+
+ $object_uri = $handle->getURI();
+ if (!strlen($object_uri)) {
+ return $this->newDialog()
+ ->setTitle(pht('No Object URI'))
+ ->appendParagraph(
+ pht(
+ 'Object "%s" exists, but does not have a URI to redirect to.',
+ $name))
+ ->addCancelButton('/', pht('Done'));
+ }
+
+ return id(new AphrontRedirectResponse())->setURI($object_uri);
+ }
+}

File Metadata

Mime Type
text/plain
Expires
May 20 2024, 7:27 AM (5 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6303475
Default Alt Text
D19487.id46603.diff (3 KB)

Event Timeline