Skip to content

Commit

Permalink
fix: error then use old zip to update on local display up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
ga-devfront committed Oct 24, 2024
1 parent 7bab800 commit 8fd5972
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions classes/Upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,19 @@ public function isLastVersion(): bool
return version_compare($this->currentPsVersion, $this->getDestinationVersion(), '>=');
}

/**
* @throws DistributionApiException
* @throws UpgradeException
*/
public function isNewerVersionAvailableOnline(): bool
{
if ($this->getOnlineDestinationRelease() === null) {
return false;
}

return version_compare($this->currentPsVersion, $this->getOnlineDestinationRelease()->getVersion(), '<');
}

/**
* @throws DistributionApiException
* @throws UpgradeException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public function step(): string
protected function getParams(): array
{
$updateSteps = new UpdateSteps($this->upgradeContainer->getTranslator());
$isLastVersion = $this->upgradeContainer->getUpgrader()->isLastVersion();
$isNewerVersionAvailableOnline = $this->upgradeContainer->getUpgrader()->isNewerVersionAvailableOnline();
$onlineDestination = $this->upgradeContainer->getUpgrader()->getOnlineDestinationRelease();

if (!$isLastVersion) {
if ($isNewerVersionAvailableOnline) {
$updateType = VersionUtils::getUpdateType($this->getPsVersion(), $onlineDestination->getVersion());
$releaseNote = $this->upgradeContainer->getUpgrader()->getOnlineDestinationRelease()->getReleaseNoteUrl();
} else {
Expand Down Expand Up @@ -115,7 +115,7 @@ protected function getParams(): array
$params = array_merge(
$updateSteps->getStepParams($this::CURRENT_STEP),
[
'up_to_date' => $isLastVersion,
'up_to_date' => !$isNewerVersionAvailableOnline,
'no_local_archive' => !$this->upgradeContainer->getLocalArchiveRepository()->hasLocalArchive(),
'assets_base_path' => $this->upgradeContainer->getAssetsEnvironment()->getAssetsBaseUrl($this->request),
'current_prestashop_version' => $this->getPsVersion(),
Expand Down

0 comments on commit 8fd5972

Please sign in to comment.