Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15394335
D19487.id46609.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D19487.id46609.diff
View Options
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
@@ -4451,6 +4451,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',
@@ -10406,6 +10407,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
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 11:48 PM (2 w, 5 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7389868
Default Alt Text
D19487.id46609.diff (3 KB)
Attached To
Mode
D19487: Add a generic PHID-based object redirection controller
Attached
Detach File
Event Timeline
Log In to Comment