Loading index.php +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ else $protocol = 'http://'; $logger = new Logger('main'); $logger->pushHandler(new StreamHandler('LineageOTA.log', Logger::WARNING)); $logger->pushHandler(new StreamHandler('LineageOTA.log', Logger::INFO)); $app = new CmOta($logger); $app Loading src/Helpers/Build.php +15 −7 Original line number Diff line number Diff line Loading @@ -88,7 +88,7 @@ $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->version = $tokens[2]; $this->version = $tokens[2][0]; $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); Loading Loading @@ -187,7 +187,7 @@ return false; // Invalid build if timestamp older } return(version_compare($currentBuild->getVersion(), $this->getVersion(), "<")); return(version_compare($currentBuild->getVersion(), $this->getVersion(), "<=")); } /** Loading Loading @@ -244,7 +244,9 @@ */ public function getIsUpgradeSupported($compareVersion) { $isSameVersion = boolval(!strcmp($this->androidVersion, $compareVersion)); // Check if Android version is same $thisMajorVersion = explode(".", $this->androidVersion)[0]; $compareMajorVersion = explode(".", $compareVersion)[0]; $isSameVersion = boolval(!strcmp($thisMajorVersion, $compareMajorVersion)); // Check if Android version is same $migrationContents = NULL; if(file_exists($this->migrationFilePath)) { $migrationContents = file_get_contents($this->migrationFilePath); Loading @@ -252,8 +254,8 @@ if (!empty($migrationContents)) { $migrations = json_decode($migrationContents, true); // Contains migration rules if (!empty($migrations[$compareVersion]) && is_array($migrations[$compareVersion])) { return in_array($this->androidVersion, $migrations[$compareVersion]); if (!empty($migrations[$compareMajorVersion]) && is_array($migrations[$compareMajorVersion])) { return in_array(intval($thisMajorVersion), $migrations[$compareMajorVersion]); } } return $isSameVersion; Loading Loading @@ -392,8 +394,14 @@ private function removeTrailingDashes($token) { foreach ($token as $key => $value) { if(isset($value[0]) && !empty($value[0])) { $token[$key] = trim($value[0], '-'); } else { $this->logger->warning("Token value null or not array for build located at: " . $this->filePath ); continue; } } return $token; } Loading Loading
index.php +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ else $protocol = 'http://'; $logger = new Logger('main'); $logger->pushHandler(new StreamHandler('LineageOTA.log', Logger::WARNING)); $logger->pushHandler(new StreamHandler('LineageOTA.log', Logger::INFO)); $app = new CmOta($logger); $app Loading
src/Helpers/Build.php +15 −7 Original line number Diff line number Diff line Loading @@ -88,7 +88,7 @@ $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->version = $tokens[2]; $this->version = $tokens[2][0]; $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); Loading Loading @@ -187,7 +187,7 @@ return false; // Invalid build if timestamp older } return(version_compare($currentBuild->getVersion(), $this->getVersion(), "<")); return(version_compare($currentBuild->getVersion(), $this->getVersion(), "<=")); } /** Loading Loading @@ -244,7 +244,9 @@ */ public function getIsUpgradeSupported($compareVersion) { $isSameVersion = boolval(!strcmp($this->androidVersion, $compareVersion)); // Check if Android version is same $thisMajorVersion = explode(".", $this->androidVersion)[0]; $compareMajorVersion = explode(".", $compareVersion)[0]; $isSameVersion = boolval(!strcmp($thisMajorVersion, $compareMajorVersion)); // Check if Android version is same $migrationContents = NULL; if(file_exists($this->migrationFilePath)) { $migrationContents = file_get_contents($this->migrationFilePath); Loading @@ -252,8 +254,8 @@ if (!empty($migrationContents)) { $migrations = json_decode($migrationContents, true); // Contains migration rules if (!empty($migrations[$compareVersion]) && is_array($migrations[$compareVersion])) { return in_array($this->androidVersion, $migrations[$compareVersion]); if (!empty($migrations[$compareMajorVersion]) && is_array($migrations[$compareMajorVersion])) { return in_array(intval($thisMajorVersion), $migrations[$compareMajorVersion]); } } return $isSameVersion; Loading Loading @@ -392,8 +394,14 @@ private function removeTrailingDashes($token) { foreach ($token as $key => $value) { if(isset($value[0]) && !empty($value[0])) { $token[$key] = trim($value[0], '-'); } else { $this->logger->warning("Token value null or not array for build located at: " . $this->filePath ); continue; } } return $token; } Loading