@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.

Add spacePHID infrastructure and implement in Paste

Summary:
Ref T8424. I'm using Paste as a testbed application because Spaces make some degree of sense for it but it's also flat/simple.

This doesn't do anything interesting or useful and mostly just making the next (more interesting) diff smaller.

Test Plan:
- Ran `bin/storage upgrade -f`.
- Browsed pastes.
- Created a paste.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8424

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

+50 -14
+2
resources/sql/autopatches/20150604.spaces.1.sql
··· 1 + ALTER TABLE {$NAMESPACE}_pastebin.pastebin_paste 2 + ADD spacePHID VARBINARY(64);
+1
src/__phutil_library_map__.php
··· 5615 5615 'PhabricatorProjectInterface', 5616 5616 'PhabricatorDestructibleInterface', 5617 5617 'PhabricatorApplicationTransactionInterface', 5618 + 'PhabricatorSpacesInterface', 5618 5619 ), 5619 5620 'PhabricatorPasteApplication' => 'PhabricatorApplication', 5620 5621 'PhabricatorPasteCommentController' => 'PhabricatorPasteController',
+10 -12
src/applications/paste/query/PhabricatorPasteQuery.php
··· 96 96 return $pastes; 97 97 } 98 98 99 - protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 100 - $where = array(); 101 - 102 - $where[] = $this->buildPagingClause($conn_r); 99 + protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 100 + $where = parent::buildWhereClauseParts($conn); 103 101 104 102 if ($this->ids) { 105 103 $where[] = qsprintf( 106 - $conn_r, 104 + $conn, 107 105 'id IN (%Ld)', 108 106 $this->ids); 109 107 } 110 108 111 109 if ($this->phids) { 112 110 $where[] = qsprintf( 113 - $conn_r, 111 + $conn, 114 112 'phid IN (%Ls)', 115 113 $this->phids); 116 114 } 117 115 118 116 if ($this->authorPHIDs) { 119 117 $where[] = qsprintf( 120 - $conn_r, 118 + $conn, 121 119 'authorPHID IN (%Ls)', 122 120 $this->authorPHIDs); 123 121 } 124 122 125 123 if ($this->parentPHIDs) { 126 124 $where[] = qsprintf( 127 - $conn_r, 125 + $conn, 128 126 'parentPHID IN (%Ls)', 129 127 $this->parentPHIDs); 130 128 } 131 129 132 130 if ($this->languages) { 133 131 $where[] = qsprintf( 134 - $conn_r, 132 + $conn, 135 133 'language IN (%Ls)', 136 134 $this->languages); 137 135 } 138 136 139 137 if ($this->dateCreatedAfter) { 140 138 $where[] = qsprintf( 141 - $conn_r, 139 + $conn, 142 140 'dateCreated >= %d', 143 141 $this->dateCreatedAfter); 144 142 } 145 143 146 144 if ($this->dateCreatedBefore) { 147 145 $where[] = qsprintf( 148 - $conn_r, 146 + $conn, 149 147 'dateCreated <= %d', 150 148 $this->dateCreatedBefore); 151 149 } 152 150 153 - return $this->formatWhereClause($where); 151 + return $where; 154 152 } 155 153 156 154 private function getContentCacheKey(PhabricatorPaste $paste) {
+11 -1
src/applications/paste/storage/PhabricatorPaste.php
··· 9 9 PhabricatorPolicyInterface, 10 10 PhabricatorProjectInterface, 11 11 PhabricatorDestructibleInterface, 12 - PhabricatorApplicationTransactionInterface { 12 + PhabricatorApplicationTransactionInterface, 13 + PhabricatorSpacesInterface { 13 14 14 15 protected $title; 15 16 protected $authorPHID; ··· 19 20 protected $viewPolicy; 20 21 protected $editPolicy; 21 22 protected $mailKey; 23 + protected $spacePHID; 22 24 23 25 private $content = self::ATTACHABLE; 24 26 private $rawContent = self::ATTACHABLE; ··· 204 206 AphrontRequest $request) { 205 207 206 208 return $timeline; 209 + } 210 + 211 + 212 + /* -( PhabricatorSpacesInterface )----------------------------------------- */ 213 + 214 + 215 + public function getSpacePHID() { 216 + return $this->spacePHID; 207 217 } 208 218 209 219 }
+16 -1
src/applications/spaces/interface/PhabricatorSpacesInterface.php
··· 1 1 <?php 2 2 3 - interface PhabricatorSpacesInterface extends PhabricatorPHIDInterface {} 3 + interface PhabricatorSpacesInterface extends PhabricatorPHIDInterface { 4 + 5 + public function getSpacePHID(); 6 + 7 + } 8 + 9 + // TEMPLATE IMPLEMENTATION ///////////////////////////////////////////////////// 10 + 11 + /* -( PhabricatorSpacesInterface )----------------------------------------- */ 12 + /* 13 + 14 + public function getSpacePHID() { 15 + return $this->spacePHID; 16 + } 17 + 18 + */
+10
src/infrastructure/storage/lisk/LiskDAO.php
··· 1897 1897 continue; 1898 1898 } 1899 1899 1900 + if ($property === 'spacePHID') { 1901 + $map[$property] = 'phid?'; 1902 + continue; 1903 + } 1904 + 1900 1905 // If the column is named `somethingPHID`, infer it is a PHID. 1901 1906 if (preg_match('/[a-z]PHID$/', $property)) { 1902 1907 $map[$property] = 'phid'; ··· 1935 1940 $default_map['key_phid'] = array( 1936 1941 'columns' => array('phid'), 1937 1942 'unique' => true, 1943 + ); 1944 + break; 1945 + case 'spacePHID': 1946 + $default_map['key_space'] = array( 1947 + 'columns' => array('spacePHID'), 1938 1948 ); 1939 1949 break; 1940 1950 }