Differential D18519 Diff 44486 src/applications/config/controller/PhabricatorConfigCacheController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/controller/PhabricatorConfigCacheController.php
<?php | <?php | ||||
final class PhabricatorConfigCacheController | final class PhabricatorConfigCacheController | ||||
extends PhabricatorConfigController { | extends PhabricatorConfigController { | ||||
public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$nav = $this->buildSideNavView(); | $nav = $this->buildSideNavView(); | ||||
$nav->selectFilter('cache/'); | $nav->selectFilter('cache/'); | ||||
$title = pht('Cache Status'); | $purge_button = id(new PHUIButtonView()) | ||||
->setText(pht('Purge Caches')) | |||||
->setHref('/config/cache/purge/') | |||||
->setTag('a') | |||||
->setWorkflow(true) | |||||
->setIcon('fa-exclamation-triangle'); | |||||
$header = id(new PHUIHeaderView()) | $title = pht('Cache Status'); | ||||
->setHeader($title) | $header = $this->buildHeaderView($title, $purge_button); | ||||
->setProfileHeader(true); | |||||
$crumbs = $this | |||||
->buildApplicationCrumbs() | |||||
->addTextCrumb(pht('Cache Status')) | |||||
->setBorder(true); | |||||
$code_box = $this->renderCodeBox(); | $code_box = $this->renderCodeBox(); | ||||
$data_box = $this->renderDataBox(); | $data_box = $this->renderDataBox(); | ||||
$page = array( | $page = array( | ||||
$code_box, | $code_box, | ||||
$data_box, | $data_box, | ||||
); | ); | ||||
$content = id(new PhabricatorConfigPageView()) | $content = id(new PHUITwoColumnView()) | ||||
->setHeader($header) | ->setHeader($header) | ||||
->setContent($page); | ->setNavigation($nav) | ||||
->setFixed(true) | |||||
->setMainColumn($page); | |||||
return $this->newPage() | return $this->newPage() | ||||
->setTitle($title) | ->setTitle($title) | ||||
->setCrumbs($crumbs) | ->appendChild($content); | ||||
->setNavigation($nav) | |||||
->appendChild($content) | |||||
->addClass('white-background'); | |||||
} | } | ||||
private function renderCodeBox() { | private function renderCodeBox() { | ||||
$cache = PhabricatorOpcodeCacheSpec::getActiveCacheSpec(); | $cache = PhabricatorOpcodeCacheSpec::getActiveCacheSpec(); | ||||
$properties = id(new PHUIPropertyListView()); | $properties = id(new PHUIPropertyListView()); | ||||
$this->renderCommonProperties($properties, $cache); | $this->renderCommonProperties($properties, $cache); | ||||
return $this->buildConfigBoxView(pht('Opcode Cache'), $properties); | |||||
$purge_button = id(new PHUIButtonView()) | |||||
->setText(pht('Purge Caches')) | |||||
->setHref('/config/cache/purge/') | |||||
->setTag('a') | |||||
->setWorkflow(true) | |||||
->setIcon('fa-exclamation-triangle'); | |||||
$header = id(new PHUIHeaderView()) | |||||
->setHeader(pht('Opcode Cache')) | |||||
->addActionLink($purge_button); | |||||
return id(new PHUIObjectBoxView()) | |||||
->setHeader($header) | |||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | |||||
->addPropertyList($properties); | |||||
} | } | ||||
private function renderDataBox() { | private function renderDataBox() { | ||||
$cache = PhabricatorDataCacheSpec::getActiveCacheSpec(); | $cache = PhabricatorDataCacheSpec::getActiveCacheSpec(); | ||||
$properties = id(new PHUIPropertyListView()); | $properties = id(new PHUIPropertyListView()); | ||||
$this->renderCommonProperties($properties, $cache); | $this->renderCommonProperties($properties, $cache); | ||||
Show All 31 Lines | if ($cache->getName() !== null) { | ||||
'wide', | 'wide', | ||||
'n', | 'n', | ||||
'n', | 'n', | ||||
'n', | 'n', | ||||
'n', | 'n', | ||||
)); | )); | ||||
} | } | ||||
return id(new PHUIObjectBoxView()) | $properties = $this->buildConfigBoxView(pht('Data Cache'), $properties); | ||||
->setHeaderText(pht('Data Cache')) | $table = $this->buildConfigBoxView(pht('Cache Storage'), $table); | ||||
->addPropertyList($properties) | return array($properties, $table); | ||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | |||||
->setTable($table); | |||||
} | } | ||||
private function renderCommonProperties( | private function renderCommonProperties( | ||||
PHUIPropertyListView $properties, | PHUIPropertyListView $properties, | ||||
PhabricatorCacheSpec $cache) { | PhabricatorCacheSpec $cache) { | ||||
if ($cache->getName() !== null) { | if ($cache->getName() !== null) { | ||||
$name = $this->renderYes($cache->getName()); | $name = $this->renderYes($cache->getName()); | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |