Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14003917
D13321.id32240.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13321.id32240.diff
View Options
diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php
--- a/src/applications/base/PhabricatorApplication.php
+++ b/src/applications/base/PhabricatorApplication.php
@@ -449,14 +449,25 @@
$class,
PhabricatorUser $viewer) {
- if (!self::isClassInstalled($class)) {
- return false;
+ $cache = PhabricatorCaches::getRequestCache();
+ $viewer_phid = $viewer->getPHID();
+ $key = 'app.'.$class.'.installed.'.$viewer_phid;
+
+ $result = $cache->getKey($key);
+ if ($result === null) {
+ if (!self::isClassInstalled($class)) {
+ $result = false;
+ } else {
+ $result = PhabricatorPolicyFilter::hasCapability(
+ $viewer,
+ self::getByClass($class),
+ PhabricatorPolicyCapability::CAN_VIEW);
+ }
+
+ $cache->setKey($key, $result);
}
- return PhabricatorPolicyFilter::hasCapability(
- $viewer,
- self::getByClass($class),
- PhabricatorPolicyCapability::CAN_VIEW);
+ return $result;
}
diff --git a/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php b/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
--- a/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
+++ b/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
@@ -35,7 +35,6 @@
private $workspace = array();
private $inFlightPHIDs = array();
private $policyFilteredPHIDs = array();
- private $canUseApplication;
/**
* Should we continue or throw an exception when a query result is filtered
@@ -679,21 +678,13 @@
* execute the query.
*/
public function canViewerUseQueryApplication() {
- if ($this->canUseApplication === null) {
- $class = $this->getQueryApplicationClass();
- if (!$class) {
- $this->canUseApplication = true;
- } else {
- $result = id(new PhabricatorApplicationQuery())
- ->setViewer($this->getViewer())
- ->withClasses(array($class))
- ->execute();
-
- $this->canUseApplication = (bool)$result;
- }
+ $class = $this->getQueryApplicationClass();
+ if (!$class) {
+ return true;
}
- return $this->canUseApplication;
+ $viewer = $this->getViewer();
+ return PhabricatorApplication::isClassInstalledForViewer($class, $viewer);
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 27, 12:43 PM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6733742
Default Alt Text
D13321.id32240.diff (2 KB)
Attached To
Mode
D13321: Cache application visibility in the request cache
Attached
Detach File
Event Timeline
Log In to Comment