Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / cache / spec / PhabricatorCacheSpec.php
blob3f3273fd2ad3ca4dbf3d51ccc87ffe176cf5fd9d
1 <?php
3 abstract class PhabricatorCacheSpec extends Phobject {
5 private $name;
6 private $isEnabled = false;
7 private $version;
8 private $clearCacheCallback = null;
9 private $issues = array();
11 private $usedMemory = 0;
12 private $totalMemory = 0;
13 private $entryCount = null;
15 public function setName($name) {
16 $this->name = $name;
17 return $this;
20 public function getName() {
21 return $this->name;
24 public function setIsEnabled($is_enabled) {
25 $this->isEnabled = $is_enabled;
26 return $this;
29 public function getIsEnabled() {
30 return $this->isEnabled;
33 public function setVersion($version) {
34 $this->version = $version;
35 return $this;
38 public function getVersion() {
39 return $this->version;
42 protected function newIssue($key) {
43 $issue = id(new PhabricatorSetupIssue())
44 ->setIssueKey($key);
45 $this->issues[$key] = $issue;
47 return $issue;
50 public function getIssues() {
51 return $this->issues;
54 public function setUsedMemory($used_memory) {
55 $this->usedMemory = $used_memory;
56 return $this;
59 public function getUsedMemory() {
60 return $this->usedMemory;
63 public function setTotalMemory($total_memory) {
64 $this->totalMemory = $total_memory;
65 return $this;
68 public function getTotalMemory() {
69 return $this->totalMemory;
72 public function setEntryCount($entry_count) {
73 $this->entryCount = $entry_count;
74 return $this;
77 public function getEntryCount() {
78 return $this->entryCount;
81 protected function raiseInstallAPCIssue() {
82 $message = pht(
83 "Installing the PHP extension 'APC' (Alternative PHP Cache) will ".
84 "dramatically improve performance. Note that APC versions 3.1.14 and ".
85 "3.1.15 are broken; 3.1.13 is recommended instead.");
87 return $this
88 ->newIssue('extension.apc')
89 ->setShortName(pht('APC'))
90 ->setName(pht("PHP Extension 'APC' Not Installed"))
91 ->setMessage($message)
92 ->addPHPExtension('apc');
95 protected function raiseEnableAPCIssue() {
96 $summary = pht('Enabling APC/APCu will improve performance.');
97 $message = pht(
98 'The APC or APCu PHP extensions are installed, but not enabled in your '.
99 'PHP configuration. Enabling these extensions will improve performance. '.
100 'Edit the "%s" setting to enable these extensions.',
101 'apc.enabled');
103 return $this
104 ->newIssue('extension.apc.enabled')
105 ->setShortName(pht('APC/APCu Disabled'))
106 ->setName(pht('APC/APCu Extensions Not Enabled'))
107 ->setSummary($summary)
108 ->setMessage($message)
109 ->addPHPConfig('apc.enabled');
112 public function setClearCacheCallback($callback) {
113 $this->clearCacheCallback = $callback;
114 return $this;
117 public function getClearCacheCallback() {
118 return $this->clearCacheCallback;