From 4f93c5423a11d12dfe8ec9833da49aefb80a031b Mon Sep 17 00:00:00 2001 From: Alexandre Roux Date: Mon, 23 Jan 2023 16:20:53 +0000 Subject: [PATCH 1/3] Get current version from build.prop when not available in header --- src/Helpers/Builds.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Helpers/Builds.php b/src/Helpers/Builds.php index b7e84b4..206ad9f 100644 --- a/src/Helpers/Builds.php +++ b/src/Helpers/Builds.php @@ -157,7 +157,7 @@ /* Utility / Internal */ - private function getBuilds() +private function getBuilds() { $params = $this->postData['params']; preg_match_all('/.*(eOS) v([0-9\.]+)-?((alpha|beta|rc)(\.\d)?)?.*/', $_SERVER['HTTP_USER_AGENT'], $currentTokens); @@ -174,7 +174,7 @@ // Get physical paths of where the files resides $path = Flight::cfg()->get('realBasePath') . '/builds/full'; - + $dir = $path . '/' . $channels . '/' . $device; if(!is_dir($dir)){ return; @@ -182,7 +182,7 @@ // Get the file list and parse it $files = scandir($dir); if (count($files) > 2) { - + $all_builds = array(); foreach ($files as $file) { // Skip all files except for the ones that match the pattern // filename starting with e- and ending with .zip are considered as valid files @@ -204,17 +204,27 @@ } else { $build = new Build($file, $dir, $this->logger, $shouldDisplayPatch); } - - if ($build->includeInResults($this->postData['params'], $this->currenteOSVersion)) { - array_push($this->builds, $build); - } - + array_push($all_builds, $build); + $sourceIncremental = isset($this->postData['params']['source_incremental']) ? $this->postData['params']['source_incremental'] : NULL; if ($build->isValid($this->postData['params']) && $sourceIncremental && strcmp($sourceIncremental, $build->getIncremental()) === 0) { $this->currentBuild = $build; $this->logger->info($build->getIncremental().' is the current build'); + if($this->currenteOSVersion === -1){ + //get current version from build.prop + $this->currenteOSVersion = $this->currentBuild->getVersion(); + } } } + + $this->logger->info('Current version: '.$this->currenteOSVersion); + + foreach ($all_builds as $build){ + if ($build->includeInResults($this->postData['params'], $this->currenteOSVersion)) { + array_push($this->builds, $build); + } + } + } $this->logger->debug('Total execution time of getBuilds in seconds'); } -- GitLab From 44c9621b21e231ea03fb831e64c0d82dacbe1867 Mon Sep 17 00:00:00 2001 From: Alexandre Roux Date: Wed, 25 Jan 2023 14:28:59 +0000 Subject: [PATCH 2/3] indentation --- src/Helpers/Builds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Helpers/Builds.php b/src/Helpers/Builds.php index 206ad9f..968e99b 100644 --- a/src/Helpers/Builds.php +++ b/src/Helpers/Builds.php @@ -157,7 +157,7 @@ /* Utility / Internal */ -private function getBuilds() + private function getBuilds() { $params = $this->postData['params']; preg_match_all('/.*(eOS) v([0-9\.]+)-?((alpha|beta|rc)(\.\d)?)?.*/', $_SERVER['HTTP_USER_AGENT'], $currentTokens); -- GitLab From c4a3d61246fe3d4cc9bcb796cebc738871dbb40c Mon Sep 17 00:00:00 2001 From: Alexandre Roux Date: Wed, 25 Jan 2023 17:19:04 +0000 Subject: [PATCH 3/3] log into debug instead of info --- src/Helpers/Builds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Helpers/Builds.php b/src/Helpers/Builds.php index 968e99b..75cc37e 100644 --- a/src/Helpers/Builds.php +++ b/src/Helpers/Builds.php @@ -217,7 +217,7 @@ } } - $this->logger->info('Current version: '.$this->currenteOSVersion); + $this->logger->debug('Current version: '.$this->currenteOSVersion); foreach ($all_builds as $build){ if ($build->includeInResults($this->postData['params'], $this->currenteOSVersion)) { -- GitLab