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

Commit 8200c314 authored by Alexandre Roux's avatar Alexandre Roux Committed by Arnau Vàzquez
Browse files

remove maintenance number on older updater

parent 335e3065
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@
         * @param type $fileName The current filename of the build
         * @param type $physicalPath The current path where the build lives
         */
        public function __construct($fileName, $physicalPath, $logger)
        public function __construct($fileName, $physicalPath, $logger, $shouldDisplayPatch = false)
        {
            $this->logger = $logger;

@@ -90,6 +90,9 @@
            $this->apiLevel = $this->getBuildPropValue('ro.build.version.sdk') ?? '';
            $this->model = $this->getBuildPropValue('ro.lineage.device') ?? $this->getBuildPropValue('ro.cm.device') ?? ($tokens[1] == 'cm' ? $tokens[9] : $tokens[8]);
            $this->version = $tokens[2];
            if(substr_count($this->version, ".") > 1 && !$shouldDisplayPatch) { 
               $this->version = substr($this->version, 0, strrpos($this->version, '.'));//remove maintenance number when using an old updater to avoid crash
            }
            $this->preversion = $tokens[3];
            $this->displayVersion = $this->getBuildPropValue('ro.cm.display.version') ?? $this->getBuildPropValue('ro.lineage.display.version') ?? '';
            $this->androidVersion = $this->getBuildPropValue('ro.build.version.release') ?? '';
+7 −3
Original line number Diff line number Diff line
@@ -160,7 +160,11 @@
        private function getBuilds()
        {
            $params = $this->postData['params'];
            
            preg_match_all('/.*(eOS) v([0-9\.]+)-?((alpha|beta|rc)(\.\d)?)?.*/', $_SERVER['HTTP_USER_AGENT'], $currentTokens);
            $shouldDisplayPatch=false;
            if(count($currentTokens[0])>0){
               $shouldDisplayPatch = true;
            }
            $device = isset($params['device']) ? $params['device'] : '';
            $channels = isset($params['channels']) ? $params['channels'][0] : '';

@@ -189,12 +193,12 @@

                        // If not found there, we have to find it with the old fashion method...
                        if ($build === false) {
                            $build = new Build($file, $dir, $this->logger);
                            $build = new Build($file, $dir, $this->logger, $shouldDisplayPatch);
                            // ...and then save it for 72h until it expires again
                            apcu_store($file, $build, 72*60*60);
                        }
                    } else {
                        $build = new Build($file, $dir, $this->logger);
                        $build = new Build($file, $dir, $this->logger, $shouldDisplayPatch);
                    }
                    
                    if ($build->includeInResults($this->postData['params'])) {