From 31a66b6619c6804b94b7eaac3f958cd1514948bb Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 10 Jan 2022 18:20:08 +0100 Subject: [PATCH] DeploymentStatus: little fix, formatting --- .../Director/Deployment/DeploymentStatus.php | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/library/Director/Deployment/DeploymentStatus.php b/library/Director/Deployment/DeploymentStatus.php index e649dab5..27c81c0d 100644 --- a/library/Director/Deployment/DeploymentStatus.php +++ b/library/Director/Deployment/DeploymentStatus.php @@ -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( - 'checksum' => $this->db->dbHexFunc('l.config_checksum'), - 'deployed' => 'l.startup_succeeded' - ) - )->where('l.config_checksum IN (?)', $binaryConfigChecksums); + $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); return $db->fetchPairs($deploymentLogQuery); } }