Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14018280
D12314.id29587.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D12314.id29587.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1537,6 +1537,7 @@
'PhabricatorConduitTokensSettingsPanel' => 'applications/conduit/settings/PhabricatorConduitTokensSettingsPanel.php',
'PhabricatorConfigAllController' => 'applications/config/controller/PhabricatorConfigAllController.php',
'PhabricatorConfigApplication' => 'applications/config/application/PhabricatorConfigApplication.php',
+ 'PhabricatorConfigCacheController' => 'applications/config/controller/PhabricatorConfigCacheController.php',
'PhabricatorConfigColumnSchema' => 'applications/config/schema/PhabricatorConfigColumnSchema.php',
'PhabricatorConfigConfigPHIDType' => 'applications/config/phid/PhabricatorConfigConfigPHIDType.php',
'PhabricatorConfigController' => 'applications/config/controller/PhabricatorConfigController.php',
@@ -4841,6 +4842,7 @@
'PhabricatorConduitTokensSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorConfigAllController' => 'PhabricatorConfigController',
'PhabricatorConfigApplication' => 'PhabricatorApplication',
+ 'PhabricatorConfigCacheController' => 'PhabricatorConfigController',
'PhabricatorConfigColumnSchema' => 'PhabricatorConfigStorageSchema',
'PhabricatorConfigConfigPHIDType' => 'PhabricatorPHIDType',
'PhabricatorConfigController' => 'PhabricatorController',
diff --git a/src/applications/config/application/PhabricatorConfigApplication.php b/src/applications/config/application/PhabricatorConfigApplication.php
--- a/src/applications/config/application/PhabricatorConfigApplication.php
+++ b/src/applications/config/application/PhabricatorConfigApplication.php
@@ -55,6 +55,7 @@
'' => 'PhabricatorConfigIssueListController',
'(?P<key>[^/]+)/' => 'PhabricatorConfigIssueViewController',
),
+ 'cache/' => 'PhabricatorConfigCacheController',
),
);
}
diff --git a/src/applications/config/controller/PhabricatorConfigCacheController.php b/src/applications/config/controller/PhabricatorConfigCacheController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/config/controller/PhabricatorConfigCacheController.php
@@ -0,0 +1,173 @@
+<?php
+
+final class PhabricatorConfigCacheController
+ extends PhabricatorConfigController {
+
+ public function processRequest() {
+ $request = $this->getRequest();
+ $viewer = $request->getUser();
+
+ $nav = $this->buildSideNavView();
+ $nav->selectFilter('apc/');
+
+ $title = pht('Cache Status');
+
+ $crumbs = $this
+ ->buildApplicationCrumbs()
+ ->addTextCrumb(pht('Cache Status'));
+
+ $nav->setCrumbs($crumbs);
+
+ list($remedy, $properties) = $this->getProperties();
+
+ $property_list = id(new PHUIPropertyListView());
+ foreach ($properties as $property) {
+ list($name, $value) = $property;
+ $property_list->addProperty($name, $value);
+ }
+
+
+ $box = id(new PHUIObjectBoxView())
+ ->setFormErrors($remedy)
+ ->setHeaderText(pht('Cache'))
+ ->addPropertyList($property_list);
+
+ $nav->appendChild($box);
+
+ return $this->buildApplicationPage(
+ $nav,
+ array(
+ 'title' => $title,
+ ));
+ }
+
+ private function getProperties() {
+ $remedy = array();
+
+ $properties = array();
+
+ // NOTE: If APCu is installed, it reports that APC is installed.
+ if (extension_loaded('apc') && !extension_loaded('apcu')) {
+ $cache_installed = true;
+ $cache_name = pht('APC');
+ $cache_version = phpversion('apc');
+ $cache_enabled = (bool)ini_get('apc.enabled');
+ if (!$cache_enabled) {
+ $remedy[] = pht('Enable APC');
+ }
+ $datacache_installed = true;
+ $datacache_name = pht('APC User Cache');
+ $datacache_version = phpversion('apc');
+ $datacache_enabled = true;
+ } else {
+ if (extension_loaded('Zend OPcache')) {
+ $cache_installed = true;
+ $cache_name = pht('Zend Opcache');
+ $cache_enabled = (bool)ini_get('opcache.enable');
+ $cache_version = phpversion('Zend OPcache');
+ if (!$cache_enabled) {
+ $remedy[] = pht('Enable Opcache.');
+ }
+ } else {
+ if (version_compare(phpversion(), '5.5', '>=')) {
+ $remedy[] = pht('Install OPcache.');
+ } else {
+ $remedy[] = pht('Install APC.');
+ }
+
+ $cache_installed = false;
+ $cache_name = pht('None');
+ $cache_enabled = false;
+ $cache_version = null;
+ }
+
+ if (extension_loaded('apcu')) {
+ $datacache_installed = true;
+ $datacache_name = pht('APCu');
+ $datacache_version = phpversion('apcu');
+ $datacache_enabled = (bool)ini_get('apc.enabled');
+ } else {
+ if (version_compare(phpversion(), '5.5', '>=')) {
+ $remedy[] = pht('Install APCu.');
+ } else {
+ // We already suggested installing APC above.
+ }
+
+ $datacache_installed = false;
+ $datacache_name = pht('None');
+ $datacache_version = null;
+ $datacache_enabled = false;
+ }
+ }
+
+ if ($cache_installed) {
+ $cache_property = $this->renderYes($cache_name);
+ } else {
+ $cache_property = $this->renderNo($cache_name);
+ }
+
+ if ($cache_enabled) {
+ $cache_enabled_property = $this->renderYes(pht('Enabled'));
+ } else {
+ $cache_enabled_property = $this->renderNo(pht('Not Enabled'));
+ }
+
+ $properties[] = array(pht('Opcode Cache'), $cache_property);
+ $properties[] = array(pht('Enabled'), $cache_enabled_property);
+ if ($cache_version) {
+ $properties[] = array(
+ pht('Version'),
+ $this->renderInfo($cache_version),
+ );
+ }
+
+ if ($datacache_installed) {
+ $datacache_property = $this->renderYes($datacache_name);
+ } else {
+ $datacache_property = $this->renderNo($datacache_name);
+ }
+
+ if ($datacache_enabled) {
+ $datacache_enabled_property = $this->renderYes(pht('Enabled'));
+ } else {
+ $datacache_enabled_property = $this->renderNo(pht('Not Enabled'));
+ }
+
+ $properties[] = array(pht('Data Cache'), $datacache_property);
+ $properties[] = array(pht('Enabled'), $datacache_enabled_property);
+ if ($datacache_version) {
+ $properties[] = array(
+ pht('Version'),
+ $this->renderInfo($datacache_version),
+ );
+ }
+
+
+ return array($remedy, $properties);
+ }
+
+ private function renderYes($info) {
+ return array(
+ id(new PHUIIconView())->setIconFont('fa-check', 'green'),
+ ' ',
+ $info,
+ );
+ }
+
+ private function renderNo($info) {
+ return array(
+ id(new PHUIIconView())->setIconFont('fa-times-circle', 'red'),
+ ' ',
+ $info,
+ );
+ }
+
+ private function renderInfo($info) {
+ return array(
+ id(new PHUIIconView())->setIconFont('fa-info-circle', 'grey'),
+ ' ',
+ $info,
+ );
+ }
+
+}
diff --git a/src/applications/config/controller/PhabricatorConfigController.php b/src/applications/config/controller/PhabricatorConfigController.php
--- a/src/applications/config/controller/PhabricatorConfigController.php
+++ b/src/applications/config/controller/PhabricatorConfigController.php
@@ -20,6 +20,8 @@
$nav->addLabel(pht('Database'));
$nav->addFilter('database/', pht('Database Status'));
$nav->addFilter('dbissue/', pht('Database Issues'));
+ $nav->addLabel(pht('Cache'));
+ $nav->addFilter('cache/', pht('Cache Status'));
$nav->addLabel(pht('Welcome'));
$nav->addFilter('welcome/', pht('Welcome Screen'));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 7:35 AM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6760375
Default Alt Text
D12314.id29587.diff (7 KB)
Attached To
Mode
D12314: Add a very basic cache status page
Attached
Detach File
Event Timeline
Log In to Comment