DeploymentStatus: little fix, formatting

This commit is contained in:
Thomas Gelf 2022-01-10 18:20:08 +01:00
parent 251cd309be
commit 31a66b6619

View File

@ -74,8 +74,8 @@ class DeploymentStatus
{
$db = $this->db->getDbAdapter();
$query = $db->select()->from(
array('l' => 'director_deployment_log'),
array('checksum' => $this->db->dbHexFunc('l.config_checksum'))
['l' => 'director_deployment_log'],
['checksum' => $this->db->dbHexFunc('l.config_checksum')]
)->where('l.stage_name = ?', $stageName);
return $db->fetchOne($query);
@ -103,8 +103,8 @@ class DeploymentStatus
} else {
// check if it's in generated_config table it is undeployed
$generatedConfigQuery = $db->select()->from(
array('g' => 'director_generated_config'),
array('checksum' => 'g.checksum')
['g' => 'director_generated_config'],
['checksum' => 'g.checksum']
)->where('g.checksum = ?', $binaryConfigChecksums[$singleChecksum]);
if ($db->fetchOne($generatedConfigQuery)) {
$status = 'undeployed';
@ -131,12 +131,12 @@ class DeploymentStatus
} else {
// get last deployed activity id and check if it's less than the passed one
$generatedConfigQuery = $db->select()->from(
array('a' => 'director_activity_log'),
array('id' => 'a.id')
['a' => 'director_activity_log'],
['id' => 'a.id']
)->where('a.checksum = ?', $this->db->quoteBinary(hex2bin($singleActivityLogChecksum)));
if ($singleActivityLogData = $db->fetchOne($generatedConfigQuery)) {
if ($lastDeploymentActivityLogId = $db->getLastDeploymentActivityLogId()) {
if ($singleActivityLogData->id > $lastDeploymentActivityLogId) {
if ($lastDeploymentActivityLogId = $this->db->getLastDeploymentActivityLogId()) {
if ((int) $singleActivityLogData > $lastDeploymentActivityLogId) {
$status = 'undeployed';
} else {
$status = 'deployed';
@ -156,13 +156,10 @@ class DeploymentStatus
public function getDeployedConfigs(array $binaryConfigChecksums)
{
$db = $this->db->getDbAdapter();
$deploymentLogQuery = $db->select()->from(
array('l' => 'director_deployment_log'),
array(
$deploymentLogQuery = $db->select()->from(['l' => 'director_deployment_log'], [
'checksum' => $this->db->dbHexFunc('l.config_checksum'),
'deployed' => 'l.startup_succeeded'
)
)->where('l.config_checksum IN (?)', $binaryConfigChecksums);
])->where('l.config_checksum IN (?)', $binaryConfigChecksums);
return $db->fetchPairs($deploymentLogQuery);
}
}