System\Classes\VersionManager

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

Version manager

Manages the versions and database updates for plugins.

Protected properties

protected array $notes

The notes for the current operation.

protected Illuminate\Console\OutputStyle $notesOutput

protected $fileVersions

Cache of plugin versions as files.

protected $databaseVersions

Cache of database versions

protected $databaseHistory

Cache of database history

protected October\Rain\Database\Updater $updater

protected System\Classes\PluginManager $pluginManager

protected static $instance

Public methods

public void __clone()

public void __wakeup()

public static void forgetInstance()

Forget this singleton's instance if it exists

public array getNotes()

Get the notes for the last operation.

public static void instance()

Create a new instance of this singleton.

public void listNewVersions($plugin)

Returns a list of unapplied plugin versions.

Parameters
  • $plugin

public void purgePlugin(string $pluginCode)

Deletes all records from the version and history tables for a plugin.

Parameters
  • string $pluginCode - Plugin code

public void removePlugin($plugin, $stopOnVersion=NULL)

Removes and packs down a plugin from the system. Files are left intact. If the $stopOnVersion parameter is specified, the process stops after the specified version is rolled back.

Parameters
  • $plugin
  • $stopOnVersion

public self resetNotes()

Resets the notes store.

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

Sets an output stream for writing notes.

Parameters
  • Illuminate\Console\Command $output

public void updatePlugin($plugin, $stopOnVersion=NULL)

Updates a single plugin by its code or object with it's latest changes. If the $stopOnVersion parameter is specified, the process stops after the specified version is applied.

Parameters
  • $plugin
  • $stopOnVersion

Protected methods

protected void __construct()

Constructor.

protected void applyDatabaseComment($code, $version, $comment)

Registers a database update comment in the history table.

Parameters
  • $code
  • $version
  • $comment

protected void applyDatabaseScript($code, $version, $script)

Registers a database update script in the history table.

Parameters
  • $code
  • $version
  • $script

protected void applyPluginUpdate($code, $version, $details)

Applies a single version update to a plugin.

Parameters
  • $code
  • $version
  • $details

protected void getDatabaseHistory($code)

Returns all the update history for a plugin.

Parameters
  • $code

protected void getDatabaseVersion($code)

Returns the latest version of a plugin from the database.

Parameters
  • $code

protected void getFileVersions($code)

Returns all versions of a plugin from its version file.

Parameters
  • $code

protected void getLatestFileVersion($code)

Returns the latest version of a plugin from its version file.

Parameters
  • $code

protected void getNewFileVersions($code, $version=NULL)

Returns any new versions from a supplied version, ie. unapplied versions.

Parameters
  • $code
  • $version

protected void getVersionFile($code)

Returns the absolute path to a version file for a plugin.

Parameters
  • $code

protected void hasDatabaseHistory($code, $version, $script=NULL)

Checks if a plugin has an applied update version.

Parameters
  • $code
  • $version
  • $script

protected void hasVersionFile($code)

Checks if a plugin has a version file.

Parameters
  • $code

protected void init()

protected void note(string $message)

Raise a note event for the migrator.

Parameters
  • string $message

protected void removeDatabaseComment($code, $version)

Removes a database update comment in the history table.

Parameters
  • $code
  • $version

protected void removeDatabaseScript($code, $version, $script)

Removes a database update script in the history table.

Parameters
  • $code
  • $version
  • $script

protected void setDatabaseVersion($code, $version=NULL)

Updates a plugin version in the database.

Parameters
  • $code
  • $version