Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions app/Console/Commands/PerformUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ public function handle(): int
/** @var Site $site */
$site = Site::findOrFail($this->input->getArgument('siteId'));

if (!$site->update_requirement_state) {
$this->output->writeln('Update requirements not met, aborting!');

return Command::FAILURE;
}

UpdateSite::dispatchSync(
$site,
$targetVersion
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/QueueUpdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function handle(): int
$this->output->writeln('Pushing update jobs');

$sites = Site::query()
->where('update_requirement_state', '=', true)
->where(
'cms_version',
'like',
Expand Down
14 changes: 8 additions & 6 deletions app/Jobs/UpdateSite.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ public function handle(): void
return;
}

if (!$healthResult->update_requirement_state) {
Log::info("Site does not meet requirements, abort");

return;
}

// Do not make a major version update
$majorVersionCms = (int) $healthResult->cms_version;
$majorTargetVersion = (int) $this->targetVersion;
Expand All @@ -67,6 +61,14 @@ public function handle(): void
return;
}

// Update is available, but let's check if the requirements are met
if (!$healthResult->update_requirement_state) {
throw new UpdateException(
'verify',
"Site does not meet requirements"
);
}

// Store pre-update response code
$this->preUpdateCode = $this->site->getFrontendStatus();

Expand Down
10 changes: 2 additions & 8 deletions tests/Unit/Jobs/UpdateSiteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,17 @@ public function testJobQuitsIfNoUpdateIsAvailable()

public function testJobQuitsIfRequirementsArentMet()
{
$this->expectExceptionMessage("Site does not meet requirements");

$site = $this->getSiteMock(
[
'checkHealth' => $this->getHealthCheckMock(['update_requirement_state' => false])
]
);

Log::spy();

$object = new UpdateSite($site, "1.0.1");
$object->handle();

Log::shouldHaveReceived('info')
->once()
->withArgs(function ($message) {
return str_contains($message, 'Site does not meet requirements, abort');
});

$this->assertTrue(true);
}

Expand Down