UpdateManager
in package
Uses
Singleton
Update manager
Handles the CMS install and update process.
Tags
Table of Contents
- $baseDirectory : string
- $disableCoreUpdates : bool
- $instance : mixed
- $key : string
- $migrator : Migrator
- $notes : array<string|int, mixed>
- $notesOutput : OutputStyle
- $pluginManager : PluginManager
- $productCache : array<string|int, mixed>
- $repository : DatabaseMigrationRepository
- $secret : string
- $tempDirectory : string
- $themeManager : ThemeManager
- $versionManager : VersionManager
- __clone() : mixed
- __wakeup() : mixed
- bindContainerObjects() : mixed
- These objects are "soft singletons" and may be lost when the IoC container reboots. This provides a way to rebuild for the purposes of unit testing.
- check() : int
- Checks for new updates and returns the amount of unapplied updates.
- downloadCore() : void
- Downloads the core from the update server.
- downloadPlugin() : self
- Downloads a plugin from the update server.
- downloadTheme() : self
- Downloads a theme from the update server.
- extractCore() : void
- Extracts the core after it has been downloaded.
- extractPlugin() : mixed
- Extracts a plugin after it has been downloaded.
- extractTheme() : mixed
- Extracts a theme after it has been downloaded.
- forgetInstance() : mixed
- Forget this singleton's instance if it exists
- getHash() : string
- Returns the currently installed system hash.
- getMigrationTableName() : string
- getNotes() : array<string|int, mixed>
- Get the notes for the last operation.
- instance() : mixed
- Create a new instance of this singleton.
- migrateModule() : self
- Run migrations on a single module
- requestChangelog() : mixed
- Returns the latest changelog information.
- requestPluginContent() : array<string|int, mixed>
- Looks up content for a plugin from the update server.
- requestPluginDetails() : array<string|int, mixed>
- Looks up a plugin from the update server.
- requestPopularProducts() : mixed
- Returns popular themes found on the marketplace.
- requestProductDetails() : mixed
- requestProjectDetails() : array<string|int, mixed>
- Requests details about a project based on its identifier.
- requestServerData() : array<string|int, mixed>
- Contacts the update server for a response.
- requestServerFile() : void
- Downloads a file from the update server.
- requestThemeDetails() : array<string|int, mixed>
- Looks up a theme from the update server.
- requestUpdateList() : array<string|int, mixed>
- Requests an update list used for checking for new updates.
- resetNotes() : self
- Resets the notes store.
- rollbackPlugin() : self
- Rollback an existing plugin
- seedModule() : self
- Run seeds on a module
- setBuild() : void
- Sets the build number and hash
- setBuildNumberManually() : void
- Asks the gateway for the lastest build number and stores it.
- setNotesOutput() : self
- Sets an output stream for writing notes.
- setSecurity() : mixed
- Set the API security for all transmissions.
- uninstall() : self
- Roll back all modules and plugins.
- update() : self
- Creates the migration table and updates
- updatePlugin() : self
- Runs update on a single plugin
- __construct() : mixed
- Constructor.
- applyHttpAttributes() : void
- Modifies the Network HTTP object with common attributes.
- cacheProductDetail() : mixed
- createNonce() : int
- Create a nonce based on millisecond time
- createServerUrl() : string
- Create a complete gateway server URL from supplied URI
- createSignature() : string
- Create a unique signature for transmission.
- getFilePath() : string
- Calculates a file path for a file code
- init() : mixed
- Initialize this singleton.
- loadProductDetailCache() : mixed
- note() : self
- Raise a note event for the migrator.
- saveProductDetailCache() : mixed
Properties
$baseDirectory
protected
string
$baseDirectory
Application base path.
$disableCoreUpdates
protected
bool
$disableCoreUpdates
= false
If set to true, core updates will not be downloaded or extracted.
$instance
protected
static mixed
$instance
$key
protected
string
$key
Secure API Key
$migrator
protected
Migrator
$migrator
$notes
protected
array<string|int, mixed>
$notes
= []
The notes for the current operation.
$notesOutput
protected
OutputStyle
$notesOutput
$pluginManager
protected
PluginManager
$pluginManager
$productCache
protected
array<string|int, mixed>
$productCache
Cache of gateway products
$repository
protected
DatabaseMigrationRepository
$repository
$secret
protected
string
$secret
Secure API Secret
$tempDirectory
protected
string
$tempDirectory
A temporary working directory.
$themeManager
protected
ThemeManager
$themeManager
$versionManager
protected
VersionManager
$versionManager
Methods
__clone()
public
__clone() : mixed
Return values
mixed —__wakeup()
public
__wakeup() : mixed
Return values
mixed —bindContainerObjects()
These objects are "soft singletons" and may be lost when the IoC container reboots. This provides a way to rebuild for the purposes of unit testing.
public
bindContainerObjects() : mixed
Return values
mixed —check()
Checks for new updates and returns the amount of unapplied updates.
public
check([bool $force = false ]) : int
Only requests from the server at a set interval (retry timer).
Parameters
- $force : bool = false
-
Ignore the retry timer.
Return values
int —Number of unapplied updates.
downloadCore()
Downloads the core from the update server.
public
downloadCore(string $hash) : void
Parameters
- $hash : string
-
Expected file hash.
Return values
void —downloadPlugin()
Downloads a plugin from the update server.
public
downloadPlugin(string $name, string $hash[, bool $installation = false ]) : self
Parameters
- $name : string
-
Plugin name.
- $hash : string
-
Expected file hash.
- $installation : bool = false
-
Indicates whether this is a plugin installation request.
Return values
self —downloadTheme()
Downloads a theme from the update server.
public
downloadTheme(string $name, string $hash) : self
Parameters
- $name : string
-
Theme name.
- $hash : string
-
Expected file hash.
Return values
self —extractCore()
Extracts the core after it has been downloaded.
public
extractCore() : void
Return values
void —extractPlugin()
Extracts a plugin after it has been downloaded.
public
extractPlugin(mixed $name, mixed $hash) : mixed
Parameters
- $name : mixed
- $hash : mixed
Return values
mixed —extractTheme()
Extracts a theme after it has been downloaded.
public
extractTheme(mixed $name, mixed $hash) : mixed
Parameters
- $name : mixed
- $hash : mixed
Return values
mixed —forgetInstance()
Forget this singleton's instance if it exists
public
final static forgetInstance() : mixed
Return values
mixed —getHash()
Returns the currently installed system hash.
public
getHash() : string
Return values
string —getMigrationTableName()
public
getMigrationTableName() : string
Return values
string —getNotes()
Get the notes for the last operation.
public
getNotes() : array<string|int, mixed>
Return values
array<string|int, mixed> —instance()
Create a new instance of this singleton.
public
final static instance() : mixed
Return values
mixed —migrateModule()
Run migrations on a single module
public
migrateModule(string $module) : self
Parameters
- $module : string
-
Module name
Return values
self —requestChangelog()
Returns the latest changelog information.
public
requestChangelog() : mixed
Return values
mixed —requestPluginContent()
Looks up content for a plugin from the update server.
public
requestPluginContent(string $name) : array<string|int, mixed>
Parameters
- $name : string
-
Plugin name.
Return values
array<string|int, mixed> —Content for the plugin.
requestPluginDetails()
Looks up a plugin from the update server.
public
requestPluginDetails(string $name) : array<string|int, mixed>
Parameters
- $name : string
-
Plugin name.
Return values
array<string|int, mixed> —Details about the plugin.
requestPopularProducts()
Returns popular themes found on the marketplace.
public
requestPopularProducts([mixed $type = null ]) : mixed
Parameters
- $type : mixed = null
Return values
mixed —requestProductDetails()
public
requestProductDetails(mixed $codes[, mixed $type = null ]) : mixed
Parameters
- $codes : mixed
- $type : mixed = null
Return values
mixed —requestProjectDetails()
Requests details about a project based on its identifier.
public
requestProjectDetails(string $projectId) : array<string|int, mixed>
Parameters
- $projectId : string
Return values
array<string|int, mixed> —requestServerData()
Contacts the update server for a response.
public
requestServerData(string $uri[, array<string|int, mixed> $postData = [] ]) : array<string|int, mixed>
Parameters
- $uri : string
-
Gateway API URI
- $postData : array<string|int, mixed> = []
-
Extra post data
Return values
array<string|int, mixed> —requestServerFile()
Downloads a file from the update server.
public
requestServerFile(string $uri, string $fileCode, string $expectedHash[, array<string|int, mixed> $postData = [] ]) : void
Parameters
- $uri : string
-
Gateway API URI
- $fileCode : string
-
A unique code for saving the file.
- $expectedHash : string
-
The expected file hash of the file.
- $postData : array<string|int, mixed> = []
-
Extra post data
Return values
void —requestThemeDetails()
Looks up a theme from the update server.
public
requestThemeDetails(string $name) : array<string|int, mixed>
Parameters
- $name : string
-
Theme name.
Return values
array<string|int, mixed> —Details about the theme.
requestUpdateList()
Requests an update list used for checking for new updates.
public
requestUpdateList([bool $force = false ]) : array<string|int, mixed>
Parameters
- $force : bool = false
-
Request application and plugins hash list regardless of version.
Return values
array<string|int, mixed> —resetNotes()
Resets the notes store.
public
resetNotes() : self
Return values
self —rollbackPlugin()
Rollback an existing plugin
public
rollbackPlugin(string $name[, string $stopOnVersion = null ]) : self
Parameters
- $name : string
-
Plugin name.
- $stopOnVersion : string = null
-
If this parameter is specified, the process stops once the provided version number is reached
Return values
self —seedModule()
Run seeds on a module
public
seedModule(string $module) : self
Parameters
- $module : string
-
Module name
Return values
self —setBuild()
Sets the build number and hash
public
setBuild(string $build[, string $hash = null ]) : void
Parameters
- $build : string
- $hash : string = null
Return values
void —setBuildNumberManually()
Asks the gateway for the lastest build number and stores it.
public
setBuildNumberManually() : void
Return values
void —setNotesOutput()
Sets an output stream for writing notes.
public
setNotesOutput(Command $output) : self
Parameters
- $output : Command
Return values
self —setSecurity()
Set the API security for all transmissions.
public
setSecurity(string $key, string $secret) : mixed
Parameters
- $key : string
-
API Key
- $secret : string
-
API Secret
Return values
mixed —uninstall()
Roll back all modules and plugins.
public
uninstall() : self
Return values
self —update()
Creates the migration table and updates
public
update() : self
Return values
self —updatePlugin()
Runs update on a single plugin
public
updatePlugin(string $name) : self
Parameters
- $name : string
-
Plugin name.
Return values
self —__construct()
Constructor.
protected
final __construct() : mixed
Return values
mixed —applyHttpAttributes()
Modifies the Network HTTP object with common attributes.
protected
applyHttpAttributes(Http $http, array<string|int, mixed> $postData) : void
Parameters
- $http : Http
-
Network object
- $postData : array<string|int, mixed>
-
Post data
Return values
void —cacheProductDetail()
protected
cacheProductDetail(mixed $type, mixed $code, mixed $data) : mixed
Parameters
- $type : mixed
- $code : mixed
- $data : mixed
Return values
mixed —createNonce()
Create a nonce based on millisecond time
protected
createNonce() : int
Return values
int —createServerUrl()
Create a complete gateway server URL from supplied URI
protected
createServerUrl(string $uri) : string
Parameters
- $uri : string
-
URI
Return values
string —URL
createSignature()
Create a unique signature for transmission.
protected
createSignature(mixed $data, mixed $secret) : string
Parameters
- $data : mixed
- $secret : mixed
Return values
string —getFilePath()
Calculates a file path for a file code
protected
getFilePath(string $fileCode) : string
Parameters
- $fileCode : string
-
A unique file code
Return values
string —Full path on the disk
init()
Initialize this singleton.
protected
init() : mixed
Return values
mixed —loadProductDetailCache()
protected
loadProductDetailCache() : mixed
Return values
mixed —note()
Raise a note event for the migrator.
protected
note(string $message) : self
Parameters
- $message : string
Return values
self —saveProductDetailCache()
protected
saveProductDetailCache() : mixed