System\Classes\UpdateManager

Source: ~/modules/system/classes/UpdateManager.php

Update manager

Handles the CMS install and update process.

Protected properties

protected array $notes

The notes for the current operation.

protected Illuminate\Console\OutputStyle $notesOutput

protected string $baseDirectory

Application base path.

protected string $tempDirectory

A temporary working directory.

protected System\Classes\PluginManager $pluginManager

protected Cms\Classes\ThemeManager $themeManager

protected System\Classes\VersionManager $versionManager

protected string $key

Secure API Key

protected string $secret

Secure API Secret

protected boolean $disableCoreUpdates

If set to true, core updates will not be downloaded or extracted.

protected array $productCache

Cache of gateway products

protected Illuminate\Database\Migrations\Migrator $migrator

protected Illuminate\Database\Migrations\DatabaseMigrationRepository $repository

protected static $instance

Public methods

public void __clone()

public void __wakeup()

public void 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 int check(boolean $force=false)

Checks for new updates and returns the amount of unapplied updates. Only requests from the server at a set interval (retry timer).

Parameters
  • boolean $force - Ignore the retry timer.

public void downloadCore(string $hash)

Downloads the core from the update server.

Parameters
  • string $hash - Expected file hash.

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

Downloads a plugin from the update server.

Parameters
  • string $name - Plugin name.
  • string $hash - Expected file hash.
  • boolean $installation - Indicates whether this is a plugin installation request.

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

Downloads a theme from the update server.

Parameters
  • string $name - Theme name.
  • string $hash - Expected file hash.

public void extractCore()

Extracts the core after it has been downloaded.

public void extractPlugin($name, $hash)

Extracts a plugin after it has been downloaded.

Parameters
  • $name
  • $hash

public void extractTheme($name, $hash)

Extracts a theme after it has been downloaded.

Parameters
  • $name
  • $hash

public static void forgetInstance()

Forget this singleton's instance if it exists

public string getHash()

Returns the currently installed system hash.

public string getMigrationTableName()

public array getNotes()

Get the notes for the last operation.

public static void instance()

Create a new instance of this singleton.

public self migrateModule(string $module)

Run migrations on a single module

Parameters
  • string $module - Module name

public void requestChangelog()

Returns the latest changelog information.

public array requestPluginContent(string $name)

Looks up content for a plugin from the update server.

Parameters
  • string $name - Plugin name.

public array requestPluginDetails(string $name)

Looks up a plugin from the update server.

Parameters
  • string $name - Plugin name.

public void requestPopularProducts($type=NULL)

Returns popular themes found on the marketplace.

Parameters
  • $type

public void requestProductDetails($codes, $type=NULL)
Parameters
  • $codes
  • $type

public array requestProjectDetails(string $projectId)

Requests details about a project based on its identifier.

Parameters
  • string $projectId

public array requestServerData(string $uri, array $postData=array())

Contacts the update server for a response.

Parameters
  • string $uri - Gateway API URI
  • array $postData - Extra post data

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

Downloads a file from the update server.

Parameters
  • string $uri - Gateway API URI
  • string $fileCode - A unique code for saving the file.
  • string $expectedHash - The expected file hash of the file.
  • array $postData - Extra post data

public array requestThemeDetails(string $name)

Looks up a theme from the update server.

Parameters
  • string $name - Theme name.

public array requestUpdateList(boolean $force=false)

Requests an update list used for checking for new updates.

Parameters
  • boolean $force - Request application and plugins hash list regardless of version.

public self resetNotes()

Resets the notes store.

public self rollbackPlugin(string $name)

Removes an existing plugin

Parameters
  • string $name - Plugin name.

public self seedModule(string $module)

Run seeds on a module

Parameters
  • string $module - Module name

public void setBuild(string $hash, string $build=NULL)

Sets the build number and hash

Parameters
  • string $hash
  • string $build

public void setBuildNumberManually()

Asks the gateway for the lastest build number and stores it.

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

Sets an output stream for writing notes.

Parameters
  • Illuminate\Console\Command $output

public void setSecurity(string $key, string $secret)

Set the API security for all transmissions.

Parameters
  • string $key - API Key
  • string $secret - API Secret

public self uninstall()

Roll back all modules and plugins.

public self update()

Creates the migration table and updates

public self updatePlugin(string $name)

Runs update on a single plugin

Parameters
  • string $name - Plugin name.

Protected methods

protected void __construct()

Constructor.

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

Modifies the Network HTTP object with common attributes.

Parameters
  • Http $http - Network object
  • array $postData - Post data

protected void cacheProductDetail($type, $code, $data)
Parameters
  • $type
  • $code
  • $data

protected int createNonce()

Create a nonce based on millisecond time

protected string createServerUrl(string $uri)

Create a complete gateway server URL from supplied URI

Parameters
  • string $uri - URI

protected string createSignature($data, $secret)

Create a unique signature for transmission.

Parameters
  • $data
  • $secret

protected string getFilePath(string $fileCode)

Calculates a file path for a file code

Parameters
  • string $fileCode - A unique file code

protected void init()

Initialize this singleton.

protected void loadProductDetailCache()

protected self note(string $message)

Raise a note event for the migrator.

Parameters
  • string $message

protected void saveProductDetailCache()