Differential D10526 Diff 25300 src/applications/config/controller/PhabricatorConfigDatabaseStatusController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/controller/PhabricatorConfigDatabaseStatusController.php
Show First 20 Lines • Show All 274 Lines • ▼ Show 20 Lines | private function renderTable( | ||||
$database_name, | $database_name, | ||||
$table_name) { | $table_name) { | ||||
$type_issue = PhabricatorConfigStorageSchema::ISSUE_COLUMNTYPE; | $type_issue = PhabricatorConfigStorageSchema::ISSUE_COLUMNTYPE; | ||||
$charset_issue = PhabricatorConfigStorageSchema::ISSUE_CHARSET; | $charset_issue = PhabricatorConfigStorageSchema::ISSUE_CHARSET; | ||||
$collation_issue = PhabricatorConfigStorageSchema::ISSUE_COLLATION; | $collation_issue = PhabricatorConfigStorageSchema::ISSUE_COLLATION; | ||||
$nullable_issue = PhabricatorConfigStorageSchema::ISSUE_NULLABLE; | $nullable_issue = PhabricatorConfigStorageSchema::ISSUE_NULLABLE; | ||||
$unique_issue = PhabricatorConfigStorageSchema::ISSUE_UNIQUE; | $unique_issue = PhabricatorConfigStorageSchema::ISSUE_UNIQUE; | ||||
$columns_issue = PhabricatorConfigStorageSchema::ISSUE_KEYCOLUMNS; | |||||
$database = $comp->getDatabase($database_name); | $database = $comp->getDatabase($database_name); | ||||
if (!$database) { | if (!$database) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
$table = $database->getTable($table_name); | $table = $database->getTable($table_name); | ||||
if (!$table) { | if (!$table) { | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | foreach ($table->getKeys() as $key_name => $key) { | ||||
$expect_key = null; | $expect_key = null; | ||||
if ($expect_table) { | if ($expect_table) { | ||||
$expect_key = $expect_table->getKey($key_name); | $expect_key = $expect_table->getKey($key_name); | ||||
} | } | ||||
$status = $key->getStatus(); | $status = $key->getStatus(); | ||||
$size = 0; | $size = 0; | ||||
foreach ($key->getColumnNames() as $column_name) { | foreach ($key->getColumnNames() as $column_spec) { | ||||
list($column_name, $prefix) = $key->getKeyColumnAndPrefix($column_spec); | |||||
$column = $table->getColumn($column_name); | $column = $table->getColumn($column_name); | ||||
if (!$column) { | if (!$column) { | ||||
$size = 0; | $size = 0; | ||||
break; | break; | ||||
} | } | ||||
$size += $column->getKeyByteLength(); | $size += $column->getKeyByteLength($prefix); | ||||
} | } | ||||
$size_formatted = null; | $size_formatted = null; | ||||
if ($size) { | if ($size) { | ||||
$size_formatted = $this->renderAttr( | $size_formatted = $this->renderAttr( | ||||
$size, | $size, | ||||
($size > self::MAX_INNODB_KEY_LENGTH)); | ($size > self::MAX_INNODB_KEY_LENGTH)); | ||||
} | } | ||||
$key_rows[] = array( | $key_rows[] = array( | ||||
$this->renderIcon($status), | $this->renderIcon($status), | ||||
phutil_tag( | phutil_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'href' => $this->getApplicationURI( | 'href' => $this->getApplicationURI( | ||||
'database/'. | 'database/'. | ||||
$database_name.'/'. | $database_name.'/'. | ||||
$table_name.'/'. | $table_name.'/'. | ||||
'key/'. | 'key/'. | ||||
$key_name.'/'), | $key_name.'/'), | ||||
), | ), | ||||
$key_name), | $key_name), | ||||
$this->renderAttr( | |||||
implode(', ', $key->getColumnNames()), | implode(', ', $key->getColumnNames()), | ||||
$key->hasIssue($columns_issue)), | |||||
$this->renderAttr( | $this->renderAttr( | ||||
$this->renderBoolean($key->getUnique()), | $this->renderBoolean($key->getUnique()), | ||||
$key->hasIssue($unique_issue)), | $key->hasIssue($unique_issue)), | ||||
$size_formatted, | $size_formatted, | ||||
); | ); | ||||
} | } | ||||
$keys_view = id(new AphrontTableView($key_rows)) | $keys_view = id(new AphrontTableView($key_rows)) | ||||
▲ Show 20 Lines • Show All 320 Lines • Show Last 20 Lines |