diff --git a/resources/sql/autopatches/20150604.spaces.1.sql b/resources/sql/autopatches/20150604.spaces.1.sql new file mode 100644 index 0000000000..6fdfd66d82 --- /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 index 02780ee822..682bf8a835 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -5615,6 +5615,7 @@ phutil_register_library_map(array( 'PhabricatorProjectInterface', 'PhabricatorDestructibleInterface', 'PhabricatorApplicationTransactionInterface', + 'PhabricatorSpacesInterface', ), 'PhabricatorPasteApplication' => 'PhabricatorApplication', 'PhabricatorPasteCommentController' => 'PhabricatorPasteController', diff --git a/src/applications/paste/query/PhabricatorPasteQuery.php b/src/applications/paste/query/PhabricatorPasteQuery.php index d5a5daf9e3..9b0d644a37 100644 --- a/src/applications/paste/query/PhabricatorPasteQuery.php +++ b/src/applications/paste/query/PhabricatorPasteQuery.php @@ -96,61 +96,59 @@ final class PhabricatorPasteQuery 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 index 3a0ae754e7..c0eeda8c92 100644 --- a/src/applications/paste/storage/PhabricatorPaste.php +++ b/src/applications/paste/storage/PhabricatorPaste.php @@ -9,7 +9,8 @@ final class PhabricatorPaste extends PhabricatorPasteDAO PhabricatorPolicyInterface, PhabricatorProjectInterface, PhabricatorDestructibleInterface, - PhabricatorApplicationTransactionInterface { + PhabricatorApplicationTransactionInterface, + PhabricatorSpacesInterface { protected $title; protected $authorPHID; @@ -19,6 +20,7 @@ final class PhabricatorPaste extends PhabricatorPasteDAO protected $viewPolicy; protected $editPolicy; protected $mailKey; + protected $spacePHID; private $content = self::ATTACHABLE; private $rawContent = self::ATTACHABLE; @@ -206,4 +208,12 @@ final class PhabricatorPaste extends PhabricatorPasteDAO 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 index 713eb69d46..d60fd06281 100644 --- 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 index 9d8172e02a..4e02d42269 100644 --- a/src/infrastructure/storage/lisk/LiskDAO.php +++ b/src/infrastructure/storage/lisk/LiskDAO.php @@ -1897,6 +1897,11 @@ abstract class LiskDAO { 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 @@ abstract class LiskDAO { 'unique' => true, ); break; + case 'spacePHID': + $default_map['key_space'] = array( + 'columns' => array('spacePHID'), + ); + break; } }