diff --git a/resources/sql/autopatches/20150604.spaces.1.sql b/resources/sql/autopatches/20150604.spaces.1.sql new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20150604.spaces.1.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_pastebin.pastebin_paste + ADD spacePHID VARBINARY(64); 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 @@ -5615,6 +5615,7 @@ 'PhabricatorProjectInterface', 'PhabricatorDestructibleInterface', 'PhabricatorApplicationTransactionInterface', + 'PhabricatorSpacesInterface', ), 'PhabricatorPasteApplication' => 'PhabricatorApplication', 'PhabricatorPasteCommentController' => 'PhabricatorPasteController', diff --git a/src/applications/paste/query/PhabricatorPasteQuery.php b/src/applications/paste/query/PhabricatorPasteQuery.php --- a/src/applications/paste/query/PhabricatorPasteQuery.php +++ b/src/applications/paste/query/PhabricatorPasteQuery.php @@ -96,61 +96,59 @@ return $pastes; } - protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { - $where = array(); - - $where[] = $this->buildPagingClause($conn_r); + protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { + $where = parent::buildWhereClauseParts($conn); if ($this->ids) { $where[] = qsprintf( - $conn_r, + $conn, 'id IN (%Ld)', $this->ids); } if ($this->phids) { $where[] = qsprintf( - $conn_r, + $conn, 'phid IN (%Ls)', $this->phids); } if ($this->authorPHIDs) { $where[] = qsprintf( - $conn_r, + $conn, 'authorPHID IN (%Ls)', $this->authorPHIDs); } if ($this->parentPHIDs) { $where[] = qsprintf( - $conn_r, + $conn, 'parentPHID IN (%Ls)', $this->parentPHIDs); } if ($this->languages) { $where[] = qsprintf( - $conn_r, + $conn, 'language IN (%Ls)', $this->languages); } if ($this->dateCreatedAfter) { $where[] = qsprintf( - $conn_r, + $conn, 'dateCreated >= %d', $this->dateCreatedAfter); } if ($this->dateCreatedBefore) { $where[] = qsprintf( - $conn_r, + $conn, 'dateCreated <= %d', $this->dateCreatedBefore); } - return $this->formatWhereClause($where); + return $where; } private function getContentCacheKey(PhabricatorPaste $paste) { diff --git a/src/applications/paste/storage/PhabricatorPaste.php b/src/applications/paste/storage/PhabricatorPaste.php --- a/src/applications/paste/storage/PhabricatorPaste.php +++ b/src/applications/paste/storage/PhabricatorPaste.php @@ -9,7 +9,8 @@ PhabricatorPolicyInterface, PhabricatorProjectInterface, PhabricatorDestructibleInterface, - PhabricatorApplicationTransactionInterface { + PhabricatorApplicationTransactionInterface, + PhabricatorSpacesInterface { protected $title; protected $authorPHID; @@ -19,6 +20,7 @@ protected $viewPolicy; protected $editPolicy; protected $mailKey; + protected $spacePHID; private $content = self::ATTACHABLE; private $rawContent = self::ATTACHABLE; @@ -206,4 +208,12 @@ return $timeline; } + +/* -( PhabricatorSpacesInterface )----------------------------------------- */ + + + public function getSpacePHID() { + return $this->spacePHID; + } + } diff --git a/src/applications/spaces/interface/PhabricatorSpacesInterface.php b/src/applications/spaces/interface/PhabricatorSpacesInterface.php --- a/src/applications/spaces/interface/PhabricatorSpacesInterface.php +++ b/src/applications/spaces/interface/PhabricatorSpacesInterface.php @@ -1,3 +1,18 @@ spacePHID; + } + +*/ diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php --- a/src/infrastructure/storage/lisk/LiskDAO.php +++ b/src/infrastructure/storage/lisk/LiskDAO.php @@ -1897,6 +1897,11 @@ continue; } + if ($property === 'spacePHID') { + $map[$property] = 'phid?'; + continue; + } + // If the column is named `somethingPHID`, infer it is a PHID. if (preg_match('/[a-z]PHID$/', $property)) { $map[$property] = 'phid'; @@ -1937,6 +1942,11 @@ 'unique' => true, ); break; + case 'spacePHID': + $default_map['key_space'] = array( + 'columns' => array('spacePHID'), + ); + break; } }