PHP Class Airship\Engine\Continuum\AutoUpdater

The base class for the auto-updaters.
Inheritance: use trait LogBolt
Show file Open project: paragonie/airship

Protected Properties

Property Type Description
$bypassSecurityAndJustInstall boolean
$channels Channel[]
$continuumLogger Log
$ext string
$filePath string
$hail Hail
$localUpdateFile UpdateFile
$manifest array
$name string
$pharAlias string
$supplier Supplier
$type string

Public Methods

Method Description
bypassSecurityAndJustInstall ( boolean $set = false ) : self This is for manual installations and update scripts. It should never be invoked automatically.
checkKeyggdrasil ( UpdateInfo $info, UpdateFile $file ) : boolean Was the checksum of this update stored in Keyggdrasil?
downloadUpdateFile ( UpdateInfo $update, string $apiEndpoint = 'download' ) : UpdateFile Download an update into a temp file
manualUpdate ( string $desiredVersion ) : boolean Process manual updates:
updateCheck ( string $supplier = '', string $packageName = '', string $minVersion = '', string $apiEndpoint = 'version' ) : array Are any updates available?
updateDBRecord ( string $type, UpdateInfo $info ) : boolean Update the version string in airship_package_cache
useLocalUpdateFile ( string $path, string $version = '' ) : self For CLI usage: Bypass the download process, use a local file instead.
verifyUpdateSignature ( UpdateInfo $info, UpdateFile $file ) : boolean Verify the Ed25519 signature of the update file against the supplier's public key.

Protected Methods

Method Description
autoRunScript ( array $autoRun ) : mixed Automatic script execution
bringSiteBackUp ( ) After we finish our update, we should bring the site back online:
bringSiteDown ( ) Let's bring the site down while we're upgrading:
checkVersionSettings ( UpdateInfo $info, string $currentVersion ) : boolean Should this automatic update be permitted?
getChannel ( string $name ) : Channel Get the channels
getLogContext ( UpdateInfo $updateInfo, UpdateFile $updateFile ) : array Get information for logging purposes
install ( UpdateInfo $info, UpdateFile $file ) This is the method that actually does the installation
sortUpdatesByVersion ( variadic $updates ) : array Sort updates by version (newest to latest)

Method Details

autoRunScript() protected method

Automatic script execution
protected autoRunScript ( array $autoRun ) : mixed
$autoRun array
return mixed

bringSiteBackUp() protected method

After we finish our update, we should bring the site back online:
protected bringSiteBackUp ( )

bringSiteDown() protected method

Let's bring the site down while we're upgrading:
protected bringSiteDown ( )

bypassSecurityAndJustInstall() public method

This is for manual installations and update scripts. It should never be invoked automatically.
public bypassSecurityAndJustInstall ( boolean $set = false ) : self
$set boolean
return self

checkKeyggdrasil() public method

Dear future security auditors: This is important.
public checkKeyggdrasil ( UpdateInfo $info, UpdateFile $file ) : boolean
$info UpdateInfo
$file UpdateFile
return boolean

checkVersionSettings() protected method

Should this automatic update be permitted?
protected checkVersionSettings ( UpdateInfo $info, string $currentVersion ) : boolean
$info UpdateInfo
$currentVersion string
return boolean

downloadUpdateFile() public method

Download an update into a temp file
public downloadUpdateFile ( UpdateInfo $update, string $apiEndpoint = 'download' ) : UpdateFile
$update UpdateInfo
$apiEndpoint string
return UpdateFile

getChannel() protected method

Get the channels
protected getChannel ( string $name ) : Channel
$name string
return Channel

getLogContext() protected method

Get information for logging purposes
protected getLogContext ( UpdateInfo $updateInfo, UpdateFile $updateFile ) : array
$updateInfo UpdateInfo
$updateFile UpdateFile
return array

install() abstract protected method

This is the method that actually does the installation
abstract protected install ( UpdateInfo $info, UpdateFile $file )
$info UpdateInfo
$file UpdateFile

manualUpdate() public method

1. Check if a new update is available. 2. Download the upload file, store in a temporary file. 3. Verify the signature (via Halite). 4. Verify the update is recorded in Keyggdrasil. 5. If all is well, run the update script.
public manualUpdate ( string $desiredVersion ) : boolean
$desiredVersion string
return boolean

sortUpdatesByVersion() protected method

Sort updates by version (newest to latest)
protected sortUpdatesByVersion ( variadic $updates ) : array
$updates variadic
return array

updateCheck() public method

Are any updates available?
public updateCheck ( string $supplier = '', string $packageName = '', string $minVersion = '', string $apiEndpoint = 'version' ) : array
$supplier string
$packageName string
$minVersion string
$apiEndpoint string
return array

updateDBRecord() public method

Update the version string in airship_package_cache
public updateDBRecord ( string $type, UpdateInfo $info ) : boolean
$type string
$info UpdateInfo
return boolean

useLocalUpdateFile() public method

For CLI usage: Bypass the download process, use a local file instead.
public useLocalUpdateFile ( string $path, string $version = '' ) : self
$path string
$version string
return self

verifyUpdateSignature() public method

Dear future security auditors: This is important.
public verifyUpdateSignature ( UpdateInfo $info, UpdateFile $file ) : boolean
$info UpdateInfo
$file UpdateFile
return boolean

Property Details

$bypassSecurityAndJustInstall protected property

protected bool $bypassSecurityAndJustInstall
return boolean

$channels protected static property

protected static Channel[],Airship\Engine\Continuum $channels
return Channel[]

$continuumLogger protected static property

protected static Log,Airship\Engine\Continuum $continuumLogger
return Log

$ext protected property

protected string $ext
return string

$filePath protected property

protected string $filePath
return string

$hail protected property

protected Hail $hail
return Hail

$localUpdateFile protected property

protected UpdateFile $localUpdateFile
return UpdateFile

$manifest protected property

protected array $manifest
return array

$name protected property

protected string $name
return string

$pharAlias protected property

protected string $pharAlias
return string

$supplier protected property

protected Supplier,Airship\Engine\Continuum $supplier
return Supplier

$type protected property

protected string $type
return string