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

Lightly modernize NamedQueryQuery

Summary: Ref T12956. No real behavioral changes here, just slightly more modern code.

Test Plan: Reviewed named queries in Maniphest and "Edit Queries...".

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12956

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

+16 -25
+16 -25
src/applications/search/query/PhabricatorNamedQueryQuery.php
··· 28 28 return $this; 29 29 } 30 30 31 + public function newResultObject() { 32 + return new PhabricatorNamedQuery(); 33 + } 34 + 31 35 protected function loadPage() { 32 - $table = new PhabricatorNamedQuery(); 33 - $conn_r = $table->establishConnection('r'); 34 - 35 - $data = queryfx_all( 36 - $conn_r, 37 - 'SELECT * FROM %T %Q %Q %Q', 38 - $table->getTableName(), 39 - $this->buildWhereClause($conn_r), 40 - $this->buildOrderClause($conn_r), 41 - $this->buildLimitClause($conn_r)); 42 - 43 - return $table->loadAllFromArray($data); 36 + return $this->loadStandardPage($this->newResultObject()); 44 37 } 45 38 46 - protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 47 - $where = array(); 39 + protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 40 + $where = parent::buildWhereClauseParts($conn); 48 41 49 - if ($this->ids) { 42 + if ($this->ids !== null) { 50 43 $where[] = qsprintf( 51 - $conn_r, 44 + $conn, 52 45 'id IN (%Ld)', 53 46 $this->ids); 54 47 } 55 48 56 - if ($this->engineClassNames) { 49 + if ($this->engineClassNames !== null) { 57 50 $where[] = qsprintf( 58 - $conn_r, 51 + $conn, 59 52 'engineClassName IN (%Ls)', 60 53 $this->engineClassNames); 61 54 } 62 55 63 - if ($this->userPHIDs) { 56 + if ($this->userPHIDs !== null) { 64 57 $where[] = qsprintf( 65 - $conn_r, 58 + $conn, 66 59 'userPHID IN (%Ls)', 67 60 $this->userPHIDs); 68 61 } 69 62 70 - if ($this->queryKeys) { 63 + if ($this->queryKeys !== null) { 71 64 $where[] = qsprintf( 72 - $conn_r, 65 + $conn, 73 66 'queryKey IN (%Ls)', 74 67 $this->queryKeys); 75 68 } 76 69 77 - $where[] = $this->buildPagingClause($conn_r); 78 - 79 - return $this->formatWhereClause($where); 70 + return $where; 80 71 } 81 72 82 73 public function getQueryApplicationClass() {