Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / config / controller / services / PhabricatorConfigPurgeCacheController.php
blob9f40453fdec71ab719d2e30de0d693d460b1fd73
1 <?php
3 final class PhabricatorConfigPurgeCacheController
4 extends PhabricatorConfigController {
6 public function handleRequest(AphrontRequest $request) {
7 $viewer = $this->getViewer();
8 $cancel_uri = $this->getApplicationURI('cache/');
10 $opcode_cache = PhabricatorOpcodeCacheSpec::getActiveCacheSpec();
11 $data_cache = PhabricatorDataCacheSpec::getActiveCacheSpec();
13 $opcode_clearable = $opcode_cache->getClearCacheCallback();
14 $data_clearable = $data_cache->getClearCacheCallback();
16 if (!$opcode_clearable && !$data_clearable) {
17 return $this->newDialog()
18 ->setTitle(pht('No Caches to Reset'))
19 ->appendParagraph(
20 pht('None of the caches on this page can be cleared.'))
21 ->addCancelButton($cancel_uri);
24 if ($request->isDialogFormPost()) {
25 if ($opcode_clearable) {
26 call_user_func($opcode_cache->getClearCacheCallback());
29 if ($data_clearable) {
30 call_user_func($data_cache->getClearCacheCallback());
33 return id(new AphrontRedirectResponse())->setURI($cancel_uri);
36 $caches = id(new PHUIPropertyListView())
37 ->setUser($viewer);
39 if ($opcode_clearable) {
40 $caches->addProperty(
41 pht('Opcode'),
42 $opcode_cache->getName());
45 if ($data_clearable) {
46 $caches->addProperty(
47 pht('Data'),
48 $data_cache->getName());
51 return $this->newDialog()
52 ->setTitle(pht('Really Clear Cache?'))
53 ->setShortTitle(pht('Really Clear Cache'))
54 ->appendParagraph(pht('This will only affect the current web '.
55 'frontend. Daemons and any other web frontends may continue '.
56 'to use older, cached code from their opcache.'))
57 ->appendParagraph(pht('The following caches will be cleared:'))
58 ->appendChild($caches)
59 ->addSubmitButton(pht('Clear Cache'))
60 ->addCancelButton($cancel_uri);