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

Slightly modernize PholioImageQuery

Summary:
Ref T11351. My end goal is to remove `applyInitialEffects()` from Pholio to clear the way for D19897.

Start with some query modernization.

Test Plan: Browsed Pholio, nothing appeared to have changed.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T11351

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

+11 -22
+11 -22
src/applications/pholio/query/PholioImageQuery.php
··· 44 44 return $this->mockCache; 45 45 } 46 46 47 + public function newResultObject() { 48 + return new PholioImage(); 49 + } 50 + 47 51 protected function loadPage() { 48 - $table = new PholioImage(); 49 - $conn_r = $table->establishConnection('r'); 50 - 51 - $data = queryfx_all( 52 - $conn_r, 53 - 'SELECT * FROM %T %Q %Q %Q', 54 - $table->getTableName(), 55 - $this->buildWhereClause($conn_r), 56 - $this->buildOrderClause($conn_r), 57 - $this->buildLimitClause($conn_r)); 58 - 59 - $images = $table->loadAllFromArray($data); 60 - 61 - return $images; 52 + return $this->loadStandardPage($this->newResultObject()); 62 53 } 63 54 64 - protected function buildWhereClause(AphrontDatabaseConnection $conn) { 65 - $where = array(); 66 - 67 - $where[] = $this->buildPagingClause($conn); 55 + protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 56 + $where = parent::buildWhereClauseParts($conn); 68 57 69 - if ($this->ids) { 58 + if ($this->ids !== null) { 70 59 $where[] = qsprintf( 71 60 $conn, 72 61 'id IN (%Ld)', 73 62 $this->ids); 74 63 } 75 64 76 - if ($this->phids) { 65 + if ($this->phids !== null) { 77 66 $where[] = qsprintf( 78 67 $conn, 79 68 'phid IN (%Ls)', 80 69 $this->phids); 81 70 } 82 71 83 - if ($this->mockIDs) { 72 + if ($this->mockIDs !== null) { 84 73 $where[] = qsprintf( 85 74 $conn, 86 75 'mockID IN (%Ld)', ··· 94 83 $this->obsolete); 95 84 } 96 85 97 - return $this->formatWhereClause($conn, $where); 86 + return $where; 98 87 } 99 88 100 89 protected function willFilterPage(array $images) {