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

Fix transaction queries using withComments() for transactions with no comments

Summary:
See <https://discourse.phabricator-community.org/t/daemons-tasks-crashing-in-a-loop-during-reindex/506/1>. Some object types (for example, Passphrase Credentials) support indexing but not commenting.

Make `withComments(...)` work properly if the transaction type does not support comments.

Test Plan:
Indexed a credential (no comments) and a revision (comments) with `bin/search index --trace ...`.

Before, credential fataled.

After, credetial succeeds, and skips the transaction query.

Before and after, the revision queries the transaction table.

Reviewers: amckinley

Reviewed By: amckinley

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

+22 -9
+22 -9
src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
··· 203 203 $xaction = $this->getTemplateApplicationTransaction(); 204 204 $comment = $xaction->getApplicationTransactionCommentObject(); 205 205 206 - if ($this->withComments) { 207 - $joins[] = qsprintf( 208 - $conn, 209 - 'JOIN %T c ON x.phid = c.transactionPHID', 210 - $comment->getTableName()); 206 + // Not every transaction type has comments, so we may be able to 207 + // implement this constraint trivially. 208 + 209 + if (!$comment) { 210 + if ($this->withComments) { 211 + throw new PhabricatorEmptyQueryException(); 212 + } else { 213 + // If we're querying for transactions with no comments and the 214 + // transaction type does not support comments, we don't need to 215 + // do anything. 216 + } 211 217 } else { 212 - $joins[] = qsprintf( 213 - $conn, 214 - 'LEFT JOIN %T c ON x.phid = c.transactionPHID', 215 - $comment->getTableName()); 218 + if ($this->withComments) { 219 + $joins[] = qsprintf( 220 + $conn, 221 + 'JOIN %T c ON x.phid = c.transactionPHID', 222 + $comment->getTableName()); 223 + } else { 224 + $joins[] = qsprintf( 225 + $conn, 226 + 'LEFT JOIN %T c ON x.phid = c.transactionPHID', 227 + $comment->getTableName()); 228 + } 216 229 } 217 230 } 218 231