2014-09-18 17:22:18 +02:00
|
|
|
<?php
|
|
|
|
|
2014-09-19 20:46:30 +02:00
|
|
|
abstract class PhabricatorConfigDatabaseController
|
2014-09-18 17:22:18 +02:00
|
|
|
extends PhabricatorConfigController {
|
|
|
|
|
2014-09-18 17:32:21 +02:00
|
|
|
const MAX_INNODB_KEY_LENGTH = 767;
|
|
|
|
|
2014-09-19 20:46:30 +02:00
|
|
|
protected function buildSchemaQuery() {
|
2014-09-18 17:22:18 +02:00
|
|
|
$conf = PhabricatorEnv::newObjectFromConfig(
|
|
|
|
'mysql.configuration-provider',
|
|
|
|
array($dao = null, 'w'));
|
|
|
|
|
|
|
|
$api = id(new PhabricatorStorageManagementAPI())
|
|
|
|
->setUser($conf->getUser())
|
|
|
|
->setHost($conf->getHost())
|
|
|
|
->setPort($conf->getPort())
|
|
|
|
->setNamespace(PhabricatorLiskDAO::getDefaultStorageNamespace())
|
|
|
|
->setPassword($conf->getPassword());
|
|
|
|
|
|
|
|
$query = id(new PhabricatorConfigSchemaQuery())
|
|
|
|
->setAPI($api);
|
|
|
|
|
2014-09-19 20:46:30 +02:00
|
|
|
return $query;
|
2014-09-18 17:22:54 +02:00
|
|
|
}
|
|
|
|
|
2014-09-19 20:46:30 +02:00
|
|
|
protected function renderIcon($status) {
|
2014-09-18 17:22:54 +02:00
|
|
|
switch ($status) {
|
|
|
|
case PhabricatorConfigStorageSchema::STATUS_OKAY:
|
|
|
|
$icon = 'fa-check-circle green';
|
|
|
|
break;
|
2014-09-18 20:15:49 +02:00
|
|
|
case PhabricatorConfigStorageSchema::STATUS_NOTE:
|
|
|
|
$icon = 'fa-info-circle blue';
|
|
|
|
break;
|
2014-09-18 17:22:54 +02:00
|
|
|
case PhabricatorConfigStorageSchema::STATUS_WARN:
|
|
|
|
$icon = 'fa-exclamation-circle yellow';
|
|
|
|
break;
|
|
|
|
case PhabricatorConfigStorageSchema::STATUS_FAIL:
|
|
|
|
default:
|
|
|
|
$icon = 'fa-times-circle red';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return id(new PHUIIconView())
|
|
|
|
->setIconFont($icon);
|
|
|
|
}
|
|
|
|
|
2014-09-19 20:46:30 +02:00
|
|
|
protected function renderAttr($attr, $issue) {
|
2014-09-18 17:22:54 +02:00
|
|
|
if ($issue) {
|
|
|
|
return phutil_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'style' => 'color: #aa0000;',
|
|
|
|
),
|
|
|
|
$attr);
|
|
|
|
} else {
|
|
|
|
return $attr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-19 20:46:30 +02:00
|
|
|
protected function renderBoolean($value) {
|
2014-09-18 17:32:44 +02:00
|
|
|
if ($value === null) {
|
|
|
|
return '';
|
|
|
|
} else if ($value === true) {
|
|
|
|
return pht('Yes');
|
|
|
|
} else {
|
|
|
|
return pht('No');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-18 17:22:18 +02:00
|
|
|
}
|