1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-04 12:42:43 +01:00
phorge-phorge/src/applications/config/controller/PhabricatorConfigDatabaseController.php
epriestley 7dabc21154 Load all keys, support unique keys, and provide an "all issues" view
Summary:
Ref T1191. Three parts:

  - The old way of getting key information only got primary / unique / foreign keys, not all keys. Use `SHOW INDEXES` to get all keys instead.
  - Track key uniqueness and raise warnings about it.
  - Add a new "all issues" view to show an expanded, flat view of all issues. This is just an easier way to get a list so you don't have to dig around in the hierarchical view.

Test Plan:
{F206351}

{F206352}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T1191

Differential Revision: https://secure.phabricator.com/D10525
2014-09-19 11:46:30 -07:00

70 lines
1.7 KiB
PHP

<?php
abstract class PhabricatorConfigDatabaseController
extends PhabricatorConfigController {
const MAX_INNODB_KEY_LENGTH = 767;
protected function buildSchemaQuery() {
$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);
return $query;
}
protected function renderIcon($status) {
switch ($status) {
case PhabricatorConfigStorageSchema::STATUS_OKAY:
$icon = 'fa-check-circle green';
break;
case PhabricatorConfigStorageSchema::STATUS_NOTE:
$icon = 'fa-info-circle blue';
break;
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);
}
protected function renderAttr($attr, $issue) {
if ($issue) {
return phutil_tag(
'span',
array(
'style' => 'color: #aa0000;',
),
$attr);
} else {
return $attr;
}
}
protected function renderBoolean($value) {
if ($value === null) {
return '';
} else if ($value === true) {
return pht('Yes');
} else {
return pht('No');
}
}
}