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

Commit a1078344 authored by Arnau Vàzquez's avatar Arnau Vàzquez
Browse files

Merge branch 'master' into 'production'

Preversion and 0 for disabling

See merge request !38
parents 038e6cd2 e51926ec
Loading
Loading
Loading
Loading
+22 −12
Original line number Diff line number Diff line
@@ -71,12 +71,12 @@
                      LINEAGE => [SIGNED] (ex. signed)
                )
            */
            preg_match_all('/(cm|lineage|eelo|e)-([0-9\.]+)-\D?-?([\d_]+)?-([\w+]+)-([A-Za-z0-9]+)?-?([\w+]+)?/', $fileName, $tokens);
            preg_match_all('/(e)-([0-9\.]+)-?((alpha|beta|rc)(\.\d)?)?-\D-?([\d_]+)?-([\w+]+)-([A-Za-z0-9]+)?-?([\w+]+)?/', $fileName, $tokens);
            $this->filePath = (substr($physicalPath, -1) === '/') ? $physicalPath . $fileName : $physicalPath . '/' . $fileName;
            $tokens = $this->formatTokens($tokens);

            $this->migrationFilePath = $physicalPath . '/migration_paths.json';
            $this->channel = $this->_getChannel(str_replace(range(0, 9), '', $tokens[4]), $tokens[1], $tokens[2]);
            $this->channel = $this->_getChannel(str_replace(range(0, 9), '', $tokens[7]), $tokens[1], $tokens[2]);
            $this->filename = $fileName;

            // Try to load the build.prop from two possible paths:
@@ -88,8 +88,9 @@
            $this->timestamp = intval($this->getBuildPropValue('ro.build.date.utc') ?? filemtime($this->filePath));
            $this->incremental = $this->getBuildPropValue('ro.build.version.incremental') ?? '';
            $this->apiLevel = $this->getBuildPropValue('ro.build.version.sdk') ?? '';
            $this->model = $this->getBuildPropValue('ro.lineage.device') ?? $this->getBuildPropValue('ro.cm.device') ?? ($tokens[1] == 'cm' ? $tokens[6] : $tokens[5]);
            $this->model = $this->getBuildPropValue('ro.lineage.device') ?? $this->getBuildPropValue('ro.cm.device') ?? ($tokens[1] == 'cm' ? $tokens[9] : $tokens[8]);
            $this->version = $tokens[2];
            $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') ?? '';
            $this->uid = hash('sha256', $this->timestamp.$this->model.$this->apiLevel, false);
@@ -349,6 +350,15 @@
            return $this->version;
        }

        /**
         * Get the preversion of the current build (alpha, beta.3, etc)
         * @return string the preversion value
         */
        public function getPreversion()
        {
            return $this->preversion;
        }

        /**
         * Get the version of the current build
         * @return string the version value
@@ -548,7 +558,7 @@
        public function checkRollout()
        {
            $rolloutpercentage = isset($this->confProp['rollout']['percentage']) ? (int) $this->confProp['rollout']['percentage'] : 100;
            if ($rolloutpercentage <= 0 || $rolloutpercentage > 100) {
            if ($rolloutpercentage < 0 || $rolloutpercentage > 100) {
                return TRUE;
            }
            $rand_number = rand(1, 100);
+2 −1
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@
                    'romtype' => $build->getChannel(),
                    'datetime' => $build->getTimestamp(),
                    'version' => $build->getVersion(),
                    'pre_version' => $build->getPreversion(),
                    'display_version' => $build->getDisplayVersion(),
                    'android_version' => $build->getAndroidVersion(),
                    'id' => $build->getUid(),