Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit efd1e9a1 authored by Alexandre Roux's avatar Alexandre Roux Committed by Nivesh Krishna
Browse files

Get current version from build.prop when not available in header

parent ba160ca4
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -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');
        }