System\Classes\UpdateManager

UpdateManager handles the CMS install and update process.

Protected properties

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

check for new updates and returns the amount of unapplied updates

Parameters
  • $force

public void checkVersions($force=false)

checkVersions checks for available versions

Parameters
  • $force

public static void forgetInstance()

Forget this singleton's instance if it exists

public void getComposerUrl($withProtocol=true)

getComposerUrl returns the endpoint for composer

Parameters
  • $withProtocol

public void getCurrentVersion()

getCurrentVersion returns the current version, with or without build

public void getMigrationTableName()

getMigrationTableName returns the migration table name

public void getProjectDetails()

getProjectDetails returns the active project details

public void getProjectKey()

getProjectKey locates the project key from the file system and seeds the parameter

public static void instance()

Create a new instance of this singleton.

public void migrateModule($module)

migrateModule runs migrations on a single module

Parameters
  • $module

public void requestBrowseProducts($type=NULL, $page=NULL)

requestBrowseProducts will list available products

Parameters
  • $type
  • $page

public void requestBrowseProject()

requestBrowseProject will list project details and cache it

public void requestChangelog()

requestChangelog returns the latest changelog information.

public void requestPluginContent($name)

requestPluginContent looks up content for a plugin from the update server

Parameters
  • $name

public void requestPluginDetails($name)

requestPluginDetails looks up a plugin from the update server

Parameters
  • $name

public void requestProjectDetails($projectKey=NULL)

requestProjectDetails requests details about a project based on its identifier

Parameters
  • $projectKey

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

requestServerFile 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 void requestThemeContent($name)

requestThemeContent looks up content for a theme from the update server

Parameters
  • $name

public void requestThemeDetails($name)

requestThemeDetails looks up a theme from the update server

Parameters
  • $name

public array requestUpdateList()

Requests an update list used for checking for new updates.

public void rollbackPlugin($name)

rollbackPlugin removes an existing plugin database and version record

Parameters
  • $name

public void seedModule($module)

seedModule runs seeds on a module

Parameters
  • $module

public void setBuild($build)

setBuild sets the build number and hash

Parameters
  • $build

public void setBuildNumberManually()

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 void syncProjectPackages()

syncProjectPackages compares installed packages to project packages

public void uninstall()

uninstall rolls back all modules and plugins.

public void update()

update creates the migration table and updates

public void updatePlugin($name)

updatePlugin runs update on a single plugin

Parameters
  • $name

Protected methods

protected void __construct()

Constructor.

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

applyHttpAttributes modifies the Network HTTP object with common attributes.

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

protected int createNonce()

Create a nonce based on millisecond time

protected string createServerUrl(string $uri)

createServerUrl creates 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 void getBuildFromVersion($version)

getBuildFromVersion will return the patch version of a semver string eg: 1.2.3 -> 3, 1.2.3-dev -> 3

Parameters
  • $version

protected string getFilePath(string $fileCode)

getFilePath calculates a file path for a file code

Parameters
  • string $fileCode - A unique file code

protected void init()

Initialize this singleton.

protected self note(string $message)

Raise a note event for the migrator.

Parameters
  • string $message