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

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.

Returns
mixed

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).

Parameters
Property Description
$force
boolean

Ignore the retry timer.

Returns
int

Number of unapplied updates.

public downloadCore (string $hash) : void

Downloads the core from the update server.

Parameters
Property Description
$hash
string

Expected file hash.

Returns
void

public downloadPlugin (string $name, string $hash, boolean $installation = false) : self

Downloads a plugin from the update server.

Parameters
Property Description
$name
string

Plugin name.

$hash
string

Expected file hash.

$installation
boolean

Indicates whether this is a plugin installation request.

Returns
self

public downloadTheme (string $name, string $hash) : self

Downloads a theme from the update server.

Parameters
Property Description
$name
string

Theme name.

$hash
string

Expected file hash.

Returns
self

public extractCore () : void

Extracts the core after it has been downloaded.

Returns
void

public extractPlugin ($name, $hash)

Extracts a plugin after it has been downloaded.

Parameters
Property Description
$name
mixed
$hash
mixed
Returns
mixed

public extractTheme ($name, $hash)

Extracts a theme after it has been downloaded.

Parameters
Property Description
$name
mixed
$hash
mixed
Returns
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.
Parameters
Property Description
$detailed
boolean

If true, the list of files modified, added and deleted will be included in the result.

Returns
array

public getHash () : string

Returns the currently installed system hash.

Returns
string

public getMigrationTableName () : string

Returns
string

public migrateModule (string $module) : self

Run migrations on a single module

Parameters
Property Description
$module
string

Module name

Returns
self

public requestChangelog ()

Returns the latest changelog information.

Returns
mixed

public requestPluginContent (string $name) : array

Looks up content for a plugin from the update server.

Parameters
Property Description
$name
string

Plugin name.

Returns
array

Content for the plugin.

public requestPluginDetails (string $name) : array

Looks up a plugin from the update server.

Parameters
Property Description
$name
string

Plugin name.

Returns
array

Details about the plugin.

public requestPopularProducts ($type = null)

Returns popular themes found on the marketplace.

Parameters
Property Description
$type
mixed
Returns
mixed

public requestProductDetails ($codes, $type = null)

Parameters
Property Description
$codes
mixed
$type
mixed
Returns
mixed

public requestProjectDetails (string $projectId) : array

Requests details about a project based on its identifier.

Parameters
Property Description
$projectId
string
Returns
array

public requestServerData (string $uri, array $postData = []) : array

Contacts the update server for a response.

Parameters
Property Description
$uri
string

Gateway API URI

$postData
array

Extra post data

Returns
array

public requestServerFile (string $uri, string $fileCode, string $expectedHash, array $postData = []) : void

Downloads a file from the update server.

Parameters
Property Description
$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

Extra post data

Returns
void

public requestThemeDetails (string $name) : array

Looks up a theme from the update server.

Parameters
Property Description
$name
string

Theme name.

Returns
array

Details about the theme.

public requestUpdateList (boolean $force = false) : array

Requests an update list used for checking for new updates.

Parameters
Property Description
$force
boolean

Request application and plugins hash list regardless of version.

Returns
array

public rollbackPlugin (string $name, string $stopOnVersion = null) : self

Rollback an existing plugin

Parameters
Property Description
$name
string

Plugin name.

$stopOnVersion
string

If this parameter is specified, the process stops once the provided version number is reached

Returns
self

public seedModule (string $module) : self

Run seeds on a module

Parameters
Property Description
$module
string

Module name

Returns
self

public setBuild (string $build, string $hash = null, boolean $modified = false) : void

Sets the build number and hash

Parameters
Property Description
$build
string
$hash
string
$modified
boolean
Returns
void

public setBuildNumberManually (boolean $detailed = false) : void

Sets the build number in the database.

Parameters
Property Description
$detailed
boolean

If true, the list of files modified, added and deleted will be included in the result.

Returns
void

public setNotesOutput (Illuminate\Console\Command $output) : self

Sets an output stream for writing notes.

Parameters
Property Description
$output
Illuminate\Console\Command
Returns
self

public setSecurity (string $key, string $secret)

Set the API security for all transmissions.

Parameters
Property Description
$key
string

API Key

$secret
string

API Secret

Returns
mixed

public uninstall () : self

Roll back all modules and plugins.

Returns
self

public update () : self

Creates the migration table and updates

Returns
self

public updatePlugin (string $name) : self

Runs update on a single plugin

Parameters
Property Description
$name
string

Plugin name.

Returns
self

protected addMessage (string | object $class, string | array $message) : void

Adds a message from a specific migration or seeder.

Parameters
Property Description
$class
string | object
$message
string | array
Returns
void

protected applyHttpAttributes (Http $http, array $postData) : void

Modifies the Network HTTP object with common attributes.

Parameters
Property Description
$http
Http

Network object

$postData
array

Post data

Returns
void

protected cacheProductDetail ($type, $code, $data)

Parameters
Property Description
$type
mixed
$code
mixed
$data
mixed
Returns
mixed

protected createNonce () : int

Create a nonce based on millisecond time

Returns
int

protected createServerUrl (string $uri) : string

Create a complete gateway server URL from supplied URI

Parameters
Property Description
$uri
string

URI

Returns
string

URL

protected createSignature ($data, $secret) : string

Create a unique signature for transmission.

Parameters
Property Description
$data
mixed
$secret
mixed
Returns
string

protected getFilePath (string $fileCode) : string

Calculates a file path for a file code

Parameters
Property Description
$fileCode
string

A unique file code

Returns
string

Full path on the disk

protected init ()

Initialize this singleton.

Returns
mixed

protected loadProductDetailCache ()

Returns
mixed

protected out (string $message, boolean $newline = false) : static

Writes output to the console.

Parameters
Property Description
$message
string
$newline
boolean
Returns
static

protected printMessages () : void

Prints collated messages from the migrations and seeders

Returns
void

protected saveProductDetailCache ()

Returns
mixed

protected write (Illuminate\Console\View\Components\Component $component, array $arguments) : static

Writes output to the console using a Laravel CLI View component.

Parameters
Property Description
$component
Illuminate\Console\View\Components\Component
$arguments
array
Returns
static

inherited public __clone ()

Inherited from Singleton
Returns
mixed

inherited public __wakeup ()

Inherited from Singleton
Returns
mixed

inherited public static final forgetInstance ($container = null) : void

Inherited from Singleton

Forget this singleton's instance if it exists

Parameters
Property Description
$container
mixed
Returns
void

inherited public static final instance ($container = null) : static

Inherited from Singleton

Create a new instance of this singleton.

Parameters
Property Description
$container
mixed
Returns
static

inherited protected final __construct ()

Inherited from Singleton

Constructor.

Returns
mixed
Copyright © 2024 Winter CMS