Differential D15679 Diff 37784 src/applications/config/controller/PhabricatorConfigClusterDatabasesController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/controller/PhabricatorConfigClusterDatabasesController.php
Show All 29 Lines | private function buildClusterDatabaseStatus() { | ||||
$databases = PhabricatorDatabaseRef::queryAll(); | $databases = PhabricatorDatabaseRef::queryAll(); | ||||
$connection_map = PhabricatorDatabaseRef::getConnectionStatusMap(); | $connection_map = PhabricatorDatabaseRef::getConnectionStatusMap(); | ||||
$replica_map = PhabricatorDatabaseRef::getReplicaStatusMap(); | $replica_map = PhabricatorDatabaseRef::getReplicaStatusMap(); | ||||
Javelin::initBehavior('phabricator-tooltips'); | Javelin::initBehavior('phabricator-tooltips'); | ||||
$rows = array(); | $rows = array(); | ||||
foreach ($databases as $database) { | foreach ($databases as $database) { | ||||
$messages = array(); | |||||
if ($database->getIsMaster()) { | if ($database->getIsMaster()) { | ||||
$role_icon = id(new PHUIIconView()) | $role_icon = id(new PHUIIconView()) | ||||
->setIcon('fa-database sky') | ->setIcon('fa-database sky') | ||||
->addSigil('has-tooltip') | ->addSigil('has-tooltip') | ||||
->setMetadata( | ->setMetadata( | ||||
array( | array( | ||||
'tip' => pht('Master'), | 'tip' => pht('Master'), | ||||
)); | )); | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | foreach ($databases as $database) { | ||||
$health_down = $health->getDownEventCount(); | $health_down = $health->getDownEventCount(); | ||||
if ($health->getIsHealthy()) { | if ($health->getIsHealthy()) { | ||||
$health_icon = id(new PHUIIconView()) | $health_icon = id(new PHUIIconView()) | ||||
->setIcon('fa-plus green'); | ->setIcon('fa-plus green'); | ||||
} else { | } else { | ||||
$health_icon = id(new PHUIIconView()) | $health_icon = id(new PHUIIconView()) | ||||
->setIcon('fa-times red'); | ->setIcon('fa-times red'); | ||||
$messages[] = pht( | |||||
'UNHEALTHY: This database has failed recent health checks. Traffic '. | |||||
'will not be sent to it until it recovers.'); | |||||
} | } | ||||
$health_count = pht( | $health_count = pht( | ||||
'%s / %s', | '%s / %s', | ||||
new PhutilNumber($health_up), | new PhutilNumber($health_up), | ||||
new PhutilNumber($health_up + $health_down)); | new PhutilNumber($health_up + $health_down)); | ||||
$health_status = array( | $health_status = array( | ||||
$health_icon, | $health_icon, | ||||
' ', | ' ', | ||||
$health_count, | $health_count, | ||||
); | ); | ||||
$messages = array(); | |||||
$conn_message = $database->getConnectionMessage(); | $conn_message = $database->getConnectionMessage(); | ||||
if ($conn_message) { | if ($conn_message) { | ||||
$messages[] = $conn_message; | $messages[] = $conn_message; | ||||
} | } | ||||
$replica_message = $database->getReplicaMessage(); | $replica_message = $database->getReplicaMessage(); | ||||
if ($replica_message) { | if ($replica_message) { | ||||
$messages[] = $replica_message; | $messages[] = $replica_message; | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |