public function manualUpdate(string $desiredVersion) : bool
{
$debugArgs = ['supplier' => $this->supplier->getName(), 'name' => $this->name, 'version' => $desiredVersion];
$this->log('Begin Cabin manual update routine', LogLevel::DEBUG, $debugArgs);
$found = false;
if ($this instanceof Cabin) {
if ($this->isAirshipSpecialCabin()) {
// This only gets touched by core updates.
return false;
}
}
try {
/**
* @var UpdateInfo[]
*/
$updates = $this->updateCheck($this->supplier->getName(), $this->name, $this->manifest['version']);
foreach ($updates as $updateInfo) {
// We only want a specific version to be installed.
if ($updateInfo->getVersion() !== $desiredVersion) {
continue;
}
$found = true;
/**
* @var UpdateFile
*/
$updateFile = $this->downloadUpdateFile($updateInfo);
$this->log('Downloaded Cabin update file', LogLevel::DEBUG, $debugArgs);
if ($this->bypassSecurityAndJustInstall) {
$this->log('Cabin update verification bypassed', LogLevel::ALERT, $debugArgs);
$this->install($updateInfo, $updateFile);
return true;
}
/**
* Don't proceed unless we've verified the signatures
*/
if ($this->verifyUpdateSignature($updateInfo, $updateFile)) {
if ($this->checkKeyggdrasil($updateInfo, $updateFile)) {
$this->install($updateInfo, $updateFile);
return true;
} else {
$this->log('Keyggdrasil check failed for this Cabin', LogLevel::ALERT, $debugArgs);
}
} else {
$this->log('Signature check failed for this Cabin', LogLevel::ALERT, $debugArgs);
}
}
} catch (NoAPIResponse $ex) {
// We should log this.
$this->log('Automatic update failure: NO API Response.', LogLevel::ERROR, \Airship\throwableToArray($ex));
}
return $found;
}