2015-04-07 23:38:03 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class PhabricatorCacheSpec extends Phobject {
|
|
|
|
|
|
|
|
private $name;
|
|
|
|
private $isEnabled = false;
|
|
|
|
private $version;
|
|
|
|
private $issues = array();
|
|
|
|
|
2015-04-08 00:08:47 +02:00
|
|
|
private $usedMemory = 0;
|
|
|
|
private $totalMemory = 0;
|
|
|
|
private $entryCount = null;
|
|
|
|
|
2015-04-07 23:38:03 +02:00
|
|
|
public function setName($name) {
|
|
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName() {
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setIsEnabled($is_enabled) {
|
|
|
|
$this->isEnabled = $is_enabled;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIsEnabled() {
|
|
|
|
return $this->isEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setVersion($version) {
|
|
|
|
$this->version = $version;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getVersion() {
|
|
|
|
return $this->version;
|
|
|
|
}
|
|
|
|
|
2015-04-08 20:31:01 +02:00
|
|
|
protected function newIssue($key) {
|
|
|
|
$issue = id(new PhabricatorSetupIssue())
|
|
|
|
->setIssueKey($key);
|
|
|
|
$this->issues[$key] = $issue;
|
2015-04-07 23:38:03 +02:00
|
|
|
|
|
|
|
return $issue;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIssues() {
|
|
|
|
return $this->issues;
|
|
|
|
}
|
|
|
|
|
2015-04-08 00:08:47 +02:00
|
|
|
public function setUsedMemory($used_memory) {
|
|
|
|
$this->usedMemory = $used_memory;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getUsedMemory() {
|
|
|
|
return $this->usedMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setTotalMemory($total_memory) {
|
|
|
|
$this->totalMemory = $total_memory;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTotalMemory() {
|
|
|
|
return $this->totalMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setEntryCount($entry_count) {
|
|
|
|
$this->entryCount = $entry_count;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getEntryCount() {
|
|
|
|
return $this->entryCount;
|
|
|
|
}
|
|
|
|
|
2015-04-08 20:31:01 +02:00
|
|
|
protected function raiseInstallAPCIssue() {
|
|
|
|
$message = pht(
|
|
|
|
"Installing the PHP extension 'APC' (Alternative PHP Cache) will ".
|
|
|
|
"dramatically improve performance. Note that APC versions 3.1.14 and ".
|
|
|
|
"3.1.15 are broken; 3.1.13 is recommended instead.");
|
|
|
|
|
|
|
|
return $this
|
|
|
|
->newIssue('extension.apc')
|
|
|
|
->setShortName(pht('APC'))
|
|
|
|
->setName(pht("PHP Extension 'APC' Not Installed"))
|
|
|
|
->setMessage($message)
|
|
|
|
->addPHPExtension('apc');
|
|
|
|
}
|
2015-04-08 00:08:47 +02:00
|
|
|
|
2015-04-08 20:31:01 +02:00
|
|
|
protected function raiseEnableAPCIssue() {
|
|
|
|
$summary = pht('Enabling APC/APCu will improve performance.');
|
|
|
|
$message = pht(
|
|
|
|
'The APC or APCu PHP extensions are installed, but not enabled in your '.
|
|
|
|
'PHP configuration. Enabling these extensions will improve Phabricator '.
|
2015-05-22 09:27:56 +02:00
|
|
|
'performance. Edit the "%s" setting to enable these extensions.',
|
|
|
|
'apc.enabled');
|
2015-04-08 20:31:01 +02:00
|
|
|
|
|
|
|
return $this
|
|
|
|
->newIssue('extension.apc.enabled')
|
|
|
|
->setShortName(pht('APC/APCu Disabled'))
|
|
|
|
->setName(pht('APC/APCu Extensions Not Enabled'))
|
|
|
|
->setSummary($summary)
|
|
|
|
->setMessage($message)
|
|
|
|
->addPHPConfig('apc.enabled');
|
|
|
|
}
|
2015-04-08 00:08:47 +02:00
|
|
|
|
2015-04-07 23:38:03 +02:00
|
|
|
}
|