Path: blob/master/src/applications/config/controller/services/PhabricatorConfigPurgeCacheController.php
12262 views
<?php12final class PhabricatorConfigPurgeCacheController3extends PhabricatorConfigController {45public function handleRequest(AphrontRequest $request) {6$viewer = $this->getViewer();7$cancel_uri = $this->getApplicationURI('cache/');89$opcode_cache = PhabricatorOpcodeCacheSpec::getActiveCacheSpec();10$data_cache = PhabricatorDataCacheSpec::getActiveCacheSpec();1112$opcode_clearable = $opcode_cache->getClearCacheCallback();13$data_clearable = $data_cache->getClearCacheCallback();1415if (!$opcode_clearable && !$data_clearable) {16return $this->newDialog()17->setTitle(pht('No Caches to Reset'))18->appendParagraph(19pht('None of the caches on this page can be cleared.'))20->addCancelButton($cancel_uri);21}2223if ($request->isDialogFormPost()) {24if ($opcode_clearable) {25call_user_func($opcode_cache->getClearCacheCallback());26}2728if ($data_clearable) {29call_user_func($data_cache->getClearCacheCallback());30}3132return id(new AphrontRedirectResponse())->setURI($cancel_uri);33}3435$caches = id(new PHUIPropertyListView())36->setUser($viewer);3738if ($opcode_clearable) {39$caches->addProperty(40pht('Opcode'),41$opcode_cache->getName());42}4344if ($data_clearable) {45$caches->addProperty(46pht('Data'),47$data_cache->getName());48}4950return $this->newDialog()51->setTitle(pht('Really Clear Cache?'))52->setShortTitle(pht('Really Clear Cache'))53->appendParagraph(pht('This will only affect the current web '.54'frontend. Daemons and any other web frontends may continue '.55'to use older, cached code from their opcache.'))56->appendParagraph(pht('The following caches will be cleared:'))57->appendChild($caches)58->addSubmitButton(pht('Clear Cache'))59->addCancelButton($cancel_uri);60}61}626364