diff --git a/src/Helpers/Builds.php b/src/Helpers/Builds.php index b7e84b44fa29272fa8258344d052ec0b1f65b7a9..75cc37e3d0da2ac28b25e5323a3fd7b1ca667d0a 100644 --- a/src/Helpers/Builds.php +++ b/src/Helpers/Builds.php @@ -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->debug('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'); }