@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use application PHIDs in Paste

Summary: Ref T2715. Switch Paste to application PHIDs.

Test Plan: Used `conduit.query`; `conduit.lookup`; grepped for constants.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2715

Differential Revision: https://secure.phabricator.com/D6555

+79 -29
+2
src/__phutil_library_map__.php
··· 1353 1353 'PhabricatorPasteDAO' => 'applications/paste/storage/PhabricatorPasteDAO.php', 1354 1354 'PhabricatorPasteEditController' => 'applications/paste/controller/PhabricatorPasteEditController.php', 1355 1355 'PhabricatorPasteListController' => 'applications/paste/controller/PhabricatorPasteListController.php', 1356 + 'PhabricatorPastePHIDTypePaste' => 'applications/paste/phid/PhabricatorPastePHIDTypePaste.php', 1356 1357 'PhabricatorPasteQuery' => 'applications/paste/query/PhabricatorPasteQuery.php', 1357 1358 'PhabricatorPasteRemarkupRule' => 'applications/paste/remarkup/PhabricatorPasteRemarkupRule.php', 1358 1359 'PhabricatorPasteSearchEngine' => 'applications/paste/query/PhabricatorPasteSearchEngine.php', ··· 3367 3368 0 => 'PhabricatorPasteController', 3368 3369 1 => 'PhabricatorApplicationSearchResultsControllerInterface', 3369 3370 ), 3371 + 'PhabricatorPastePHIDTypePaste' => 'PhabricatorPHIDType', 3370 3372 'PhabricatorPasteQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 3371 3373 'PhabricatorPasteRemarkupRule' => 'PhabricatorRemarkupRuleObject', 3372 3374 'PhabricatorPasteSearchEngine' => 'PhabricatorApplicationSearchEngine',
+75
src/applications/paste/phid/PhabricatorPastePHIDTypePaste.php
··· 1 + <?php 2 + 3 + final class PhabricatorPastePHIDTypePaste extends PhabricatorPHIDType { 4 + 5 + const TYPECONST = 'PSTE'; 6 + 7 + public function getTypeConstant() { 8 + return self::TYPECONST; 9 + } 10 + 11 + public function getTypeName() { 12 + return pht('Paste'); 13 + } 14 + 15 + public function newObject() { 16 + return new PhabricatorPaste(); 17 + } 18 + 19 + public function loadObjects( 20 + PhabricatorObjectQuery $query, 21 + array $phids) { 22 + 23 + return id(new PhabricatorPasteQuery()) 24 + ->setViewer($query->getViewer()) 25 + ->withPHIDs($phids) 26 + ->execute(); 27 + } 28 + 29 + public function loadHandles( 30 + PhabricatorHandleQuery $query, 31 + array $handles, 32 + array $objects) { 33 + 34 + foreach ($handles as $phid => $handle) { 35 + $paste = $objects[$phid]; 36 + 37 + $id = $paste->getID(); 38 + $name = $paste->getFullName(); 39 + 40 + $handle->setName("P{$id}"); 41 + $handle->setFullName("P{$id}: {$name}"); 42 + $handle->setURI("/P{$id}"); 43 + } 44 + } 45 + 46 + public function canLoadNamedObject($name) { 47 + return preg_match('/^P\d*[1-9]\d*$/i', $name); 48 + } 49 + 50 + public function loadNamedObjects( 51 + PhabricatorObjectQuery $query, 52 + array $names) { 53 + 54 + $id_map = array(); 55 + foreach ($names as $name) { 56 + $id = (int)substr($name, 1); 57 + $id_map[$id][] = $name; 58 + } 59 + 60 + $objects = id(new PhabricatorPasteQuery()) 61 + ->setViewer($query->getViewer()) 62 + ->withIDs(array_keys($id_map)) 63 + ->execute(); 64 + 65 + $results = array(); 66 + foreach ($objects as $id => $object) { 67 + foreach (idx($id_map, $id, array()) as $name) { 68 + $results[$name] = $object; 69 + } 70 + } 71 + 72 + return $results; 73 + } 74 + 75 + }
+1 -1
src/applications/paste/storage/PhabricatorPaste.php
··· 26 26 27 27 public function generatePHID() { 28 28 return PhabricatorPHID::generateNewPHID( 29 - PhabricatorPHIDConstants::PHID_TYPE_PSTE); 29 + PhabricatorPastePHIDTypePaste::TYPECONST); 30 30 } 31 31 32 32 public function getCapabilities() {
-1
src/applications/phid/PhabricatorObjectHandle.php
··· 114 114 PhabricatorPHIDConstants::PHID_TYPE_BLOG => 'Blog', 115 115 PhabricatorPHIDConstants::PHID_TYPE_POST => 'Post', 116 116 PhabricatorPHIDConstants::PHID_TYPE_PVAR => 'Variable', 117 - PhabricatorPHIDConstants::PHID_TYPE_PSTE => 'Paste', 118 117 PhabricatorPHIDConstants::PHID_TYPE_LEGD => 'Legalpad Document', 119 118 ); 120 119
-1
src/applications/phid/PhabricatorPHIDConstants.php
··· 6 6 const PHID_TYPE_UNKNOWN = '????'; 7 7 const PHID_TYPE_MAGIC = '!!!!'; 8 8 const PHID_TYPE_OPKG = 'OPKG'; 9 - const PHID_TYPE_PSTE = 'PSTE'; 10 9 const PHID_TYPE_STRY = 'STRY'; 11 10 const PHID_TYPE_APRJ = 'APRJ'; 12 11 const PHID_TYPE_ACMT = 'ACMT';
-25
src/applications/phid/handle/PhabricatorObjectHandleData.php
··· 107 107 ->execute(); 108 108 return mpull($macros, null, 'getPHID'); 109 109 110 - case PhabricatorPHIDConstants::PHID_TYPE_PSTE: 111 - $pastes = id(new PhabricatorPasteQuery()) 112 - ->withPHIDs($phids) 113 - ->setViewer($this->viewer) 114 - ->execute(); 115 - return mpull($pastes, null, 'getPHID'); 116 - 117 110 case PhabricatorPHIDConstants::PHID_TYPE_BLOG: 118 111 $blogs = id(new PhameBlogQuery()) 119 112 ->withPHIDs($phids) ··· 287 280 } else { 288 281 $project = $objects[$phid]; 289 282 $handle->setName($project->getName()); 290 - $handle->setComplete(true); 291 - } 292 - $handles[$phid] = $handle; 293 - } 294 - break; 295 - 296 - case PhabricatorPHIDConstants::PHID_TYPE_PSTE: 297 - foreach ($phids as $phid) { 298 - $handle = new PhabricatorObjectHandle(); 299 - $handle->setPHID($phid); 300 - $handle->setType($type); 301 - if (empty($objects[$phid])) { 302 - $handle->setName('Unknown Paste'); 303 - } else { 304 - $paste = $objects[$phid]; 305 - $handle->setName('P'.$paste->getID()); 306 - $handle->setFullName($paste->getFullName()); 307 - $handle->setURI('/P'.$paste->getID()); 308 283 $handle->setComplete(true); 309 284 } 310 285 $handles[$phid] = $handle;
+1 -1
src/applications/ponder/phid/PonderPHIDTypeQuestion.php
··· 44 44 } 45 45 46 46 public function canLoadNamedObject($name) { 47 - return preg_match('/^Q\d*[1-9]\d*$/', $name); 47 + return preg_match('/^Q\d*[1-9]\d*$/i', $name); 48 48 } 49 49 50 50 public function loadNamedObjects(