UpdateManager
Update manager
class System\Classes\UpdateManager
Handles the CMS install and update process.
Traits
Trait | Description |
---|---|
Singleton
|
Singleton trait. |
Properties
protected $baseDirectory : string
Application base path.
protected
$disableCoreUpdates
:
bool
= false
If set to true, core updates will not be downloaded or extracted.
protected $key : string
Secure API Key
protected
$messages
:
array
= []
An array of messages returned by migrations / seeders. Returned at the end of the update process.
protected $migrator : Illuminate\Database\Migrations\Migrator
protected $notesOutput : Illuminate\Console\OutputStyle
protected $pluginManager : System\Classes\PluginManager
protected $productCache : array
Cache of gateway products
protected $repository : Illuminate\Database\Migrations\DatabaseMigrationRepository
protected $secret : string
Secure API Secret
protected $tempDirectory : string
A temporary working directory.
protected $themeManager : Cms\Classes\ThemeManager
protected $versionManager : System\Classes\VersionManager
Methods
public 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
check (boolean $force = false
)
: int
Checks for new updates and returns the amount of unapplied updates.
Only requests from the server at a set interval (retry timer).
Property | Type | Description |
---|---|---|
$force | boolean |
boolean
Ignore the retry timer. |
Number of unapplied updates.
public downloadCore (string $hash) : void
Downloads the core from the update server.
Property | Type | Description |
---|---|---|
$hash | string |
string
Expected file hash. |
public
downloadPlugin (string $name, string $hash, boolean $installation = false
)
: self
Downloads a plugin from the update server.
Property | Type | Description |
---|---|---|
$name | string |
string
Plugin name. |
$hash | string |
string
Expected file hash. |
$installation | boolean |
boolean
Indicates whether this is a plugin installation request. |
public downloadTheme (string $name, string $hash) : self
Downloads a theme from the update server.
Property | Type | Description |
---|---|---|
$name | string |
string
Theme name. |
$hash | string |
string
Expected file hash. |
public extractCore () : void
Extracts the core after it has been downloaded.
public extractPlugin ($name, $hash)
Extracts a plugin after it has been downloaded.
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
$hash | mixed |
mixed
|
public extractTheme ($name, $hash)
Extracts a theme after it has been downloaded.
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
$hash | mixed |
mixed
|
public
getBuildNumberManually (boolean $detailed = false
)
: array
Determines build number from source manifest.
This will return an array with the following information:
-
build
: The build number we determined was most likely the build installed. -
modified
: Whether we detected any modifications between the installed build and the manifest. -
confident
: Whether we are at least 60% sure that this is the installed build. More modifications to to the code = less confidence. -
changes
: If $detailed is true, this will include the list of files modified, created and deleted.
Property | Type | Description |
---|---|---|
$detailed | boolean |
boolean
If true, the list of files modified, added and deleted will be included in the result. |
public getHash () : string
Returns the currently installed system hash.
public getMigrationTableName () : string
public migrateModule (string $module) : self
Run migrations on a single module
Property | Type | Description |
---|---|---|
$module | string |
string
Module name |
public requestChangelog ()
Returns the latest changelog information.
public requestPluginContent (string $name) : array
Looks up content for a plugin from the update server.
Property | Type | Description |
---|---|---|
$name | string |
string
Plugin name. |
Content for the plugin.
public requestPluginDetails (string $name) : array
Looks up a plugin from the update server.
Property | Type | Description |
---|---|---|
$name | string |
string
Plugin name. |
Details about the plugin.
public
requestPopularProducts ($type = null
)
Returns popular themes found on the marketplace.
Property | Type | Description |
---|---|---|
$type | mixed |
mixed
|
public
requestProductDetails ($codes, $type = null
)
Property | Type | Description |
---|---|---|
$codes | mixed |
mixed
|
$type | mixed |
mixed
|
public requestProjectDetails (string $projectId) : array
Requests details about a project based on its identifier.
Property | Type | Description |
---|---|---|
$projectId | string |
string
|
public
requestServerData (string $uri, array $postData = []
)
: array
Contacts the update server for a response.
Property | Type | Description |
---|---|---|
$uri | string |
string
Gateway API URI |
$postData | array |
array
Extra post data |
public
requestServerFile (string $uri, string $fileCode, string $expectedHash, array $postData = []
)
: void
Downloads a file from the update server.
Property | Type | Description |
---|---|---|
$uri | string |
string
Gateway API URI |
$fileCode | string |
string
A unique code for saving the file. |
$expectedHash | string |
string
The expected file hash of the file. |
$postData | array |
array
Extra post data |
public requestThemeDetails (string $name) : array
Looks up a theme from the update server.
Property | Type | Description |
---|---|---|
$name | string |
string
Theme name. |
Details about the theme.
public
requestUpdateList (boolean $force = false
)
: array
Requests an update list used for checking for new updates.
Property | Type | Description |
---|---|---|
$force | boolean |
boolean
Request application and plugins hash list regardless of version. |
public
rollbackPlugin (string $name, string $stopOnVersion = null
)
: self
Rollback an existing plugin
Property | Type | Description |
---|---|---|
$name | string |
string
Plugin name. |
$stopOnVersion | string |
string
If this parameter is specified, the process stops once the provided version number is reached |
public seedModule (string $module) : self
Run seeds on a module
Property | Type | Description |
---|---|---|
$module | string |
string
Module name |
public
setBuild (string $build, string $hash = null
, boolean $modified = false
)
: void
Sets the build number and hash
Property | Type | Description |
---|---|---|
$build | string |
string
|
$hash | string |
string
|
$modified | boolean |
boolean
|
public
setBuildNumberManually (boolean $detailed = false
)
: void
Sets the build number in the database.
Property | Type | Description |
---|---|---|
$detailed | boolean |
boolean
If true, the list of files modified, added and deleted will be included in the result. |
public setNotesOutput (Illuminate\Console\Command $output) : self
Sets an output stream for writing notes.
Property | Type | Description |
---|---|---|
$output | Illuminate\Console\Command |
Illuminate\Console\Command
|
public setSecurity (string $key, string $secret)
Set the API security for all transmissions.
Property | Type | Description |
---|---|---|
$key | string |
string
API Key |
$secret | string |
string
API Secret |
public uninstall () : self
Roll back all modules and plugins.
public update () : self
Creates the migration table and updates
public updatePlugin (string $name) : self
Runs update on a single plugin
Property | Type | Description |
---|---|---|
$name | string |
string
Plugin name. |
protected addMessage (string | object $class, string | array $message) : void
Adds a message from a specific migration or seeder.
Property | Type | Description |
---|---|---|
$class | string | object |
string | object
|
$message | string | array |
string | array
|
protected applyHttpAttributes (Http $http, array $postData) : void
Modifies the Network HTTP object with common attributes.
Property | Type | Description |
---|---|---|
$http | Http |
Http
Network object |
$postData | array |
array
Post data |
protected cacheProductDetail ($type, $code, $data)
Property | Type | Description |
---|---|---|
$type | mixed |
mixed
|
$code | mixed |
mixed
|
$data | mixed |
mixed
|
protected createNonce () : int
Create a nonce based on millisecond time
protected createServerUrl (string $uri) : string
Create a complete gateway server URL from supplied URI
Property | Type | Description |
---|---|---|
$uri | string |
string
URI |
URL
protected createSignature ($data, $secret) : string
Create a unique signature for transmission.
Property | Type | Description |
---|---|---|
$data | mixed |
mixed
|
$secret | mixed |
mixed
|
protected getFilePath (string $fileCode) : string
Calculates a file path for a file code
Property | Type | Description |
---|---|---|
$fileCode | string |
string
A unique file code |
Full path on the disk
protected init ()
Initialize this singleton.
protected loadProductDetailCache ()
protected
out (string $message, boolean $newline = false
)
: static
Writes output to the console.
Property | Type | Description |
---|---|---|
$message | string |
string
|
$newline | boolean |
boolean
|
protected printMessages () : void
Prints collated messages from the migrations and seeders
protected saveProductDetailCache ()
protected write (Illuminate\Console\View\Components\Component $component, array $arguments) : static
Writes output to the console using a Laravel CLI View component.
Property | Type | Description |
---|---|---|
$component | Illuminate\Console\View\Components\Component |
Illuminate\Console\View\Components\Component
|
$arguments | array |
array
|
inherited public __clone ()
inherited public __wakeup ()
inherited
public
static
final
forgetInstance ($container = null
)
: void
Forget this singleton's instance if it exists
Property | Type | Description |
---|---|---|
$container | mixed |
mixed
|
inherited
public
static
final
instance ($container = null
)
: static
Create a new instance of this singleton.
Property | Type | Description |
---|---|---|
$container | mixed |
mixed
|
inherited protected final __construct ()
Constructor.