diff --git a/src/applications/feed/query/PhabricatorFeedTransactionQuery.php b/src/applications/feed/query/PhabricatorFeedTransactionQuery.php index d0a9f53e35..42ee332c1c 100644 --- a/src/applications/feed/query/PhabricatorFeedTransactionQuery.php +++ b/src/applications/feed/query/PhabricatorFeedTransactionQuery.php @@ -155,6 +155,20 @@ final class PhabricatorFeedTransactionQuery ->setAncestorClass('PhabricatorApplicationTransactionQuery') ->execute(); + // Remove TransactionQuery classes that belong to previously installed apps + // which got uninstalled in the meantime: Increases query performance and + // decreases likeliness that a "Query Overheated" error will be displayed. + // See https://secure.phabricator.com/T13133, https://we.phorge.it/T15642 + foreach ($queries as $key => $query) { + if (method_exists($query, 'getApplicationClassName')) { + $application_class_name = $query->getApplicationClassName(); + $application = new $application_class_name(); + if (!$application->isInstalled()) { + unset($queries[$key]); + } + } + } + $type_map = array(); // If we're querying for specific transaction PHIDs, we only need to diff --git a/src/applications/maniphest/query/ManiphestTransactionQuery.php b/src/applications/maniphest/query/ManiphestTransactionQuery.php index 9826107b77..49efe36a20 100644 --- a/src/applications/maniphest/query/ManiphestTransactionQuery.php +++ b/src/applications/maniphest/query/ManiphestTransactionQuery.php @@ -7,4 +7,8 @@ final class ManiphestTransactionQuery return new ManiphestTransaction(); } + public function getApplicationClassName() { + return 'PhabricatorManiphestApplication'; + } + }