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

Feed: Do not query and display data of uninstalled applications

Summary:
Make it less likely to run into a "Query overheated" error in the Feed Transaction Log by not querying data of applications that got uninstalled and thus are not accessible anymore anyway.

Mitigates T15642

Test Plan:
* Install D25500
* Create 900 tasks with a View Policy set to User1
* As an admin, uninstall Maniphest via `/applications/view/PhabricatorManiphestApplication/`
* Log into Phorge as User2; go to `/feed/transactions/query/all/` and see no "Query overheated" anymore due to no Maniphest task activity listed in transaction feed query results anymore
* Set "Can Use Application" on `/applications/view/PhabricatorManiphestApplication/` to `Administrators`
* Perform steps above as non-admin

Reviewers: O1 Blessed Committers, valerio.bozzolan, 20after4, mainframe98

Reviewed By: O1 Blessed Committers, valerio.bozzolan, 20after4, mainframe98

Subscribers: mainframe98, 20after4, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15642

Differential Revision: https://we.phorge.it/D25501

authored by

Valerio Bozzolan and committed by
Andre Klapper
c57167f2 3efb5325

+34
+21
src/applications/base/PhabricatorApplication.php
··· 468 468 return $result; 469 469 } 470 470 471 + /** 472 + * Determine if an application is installed at all, and if a viewer is given 473 + * if the application is available to a viewer, by application class name. 474 + * 475 + * To check if an application is installed at all, use 476 + * @{method:isClassInstalled}. 477 + * 478 + * @param string Application class name. 479 + * @param PhabricatorUser|null Viewing user. 480 + * @return bool True if the class is installed or if the installed class is 481 + * available to the viewer when a viewer is given. 482 + * @task meta 483 + */ 484 + final public static function isClassInstalledForViewerIfAny( 485 + $class, 486 + ?PhabricatorUser $viewer) { 487 + 488 + return $viewer 489 + ? self::isClassInstalledForViewer($class, $viewer) 490 + : self::isClassInstalled($class); 491 + } 471 492 472 493 /* -( PhabricatorPolicyInterface )----------------------------------------- */ 473 494
+13
src/applications/feed/query/PhabricatorFeedTransactionQuery.php
··· 155 155 ->setAncestorClass('PhabricatorApplicationTransactionQuery') 156 156 ->execute(); 157 157 158 + // Remove TransactionQuery classes of uninstalled apps. Increases query 159 + // performance and decreases likeliness of a "Query Overheated" error if 160 + // an app got uninstalled so data in it cannot be accessed anymore anyway. 161 + // See https://secure.phabricator.com/T13133, https://we.phorge.it/T15642 162 + foreach ($queries as $key => $query) { 163 + $app = $query->getQueryApplicationClass(); 164 + if ($app !== null && 165 + PhabricatorApplication::isClassInstalledForViewerIfAny($app, 166 + $viewer)) { 167 + unset($queries[$key]); 168 + } 169 + } 170 + 158 171 $type_map = array(); 159 172 160 173 // If we're querying for specific transaction PHIDs, we only need to