System\Classes\VersionManager

VersionManager manages the versions and database updates for plugins

Protected properties

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 static void instance()

Create a new instance of this singleton.

public void listNewVersions($plugin)

listNewVersions returns a list of unapplied plugin versions

Parameters
  • $plugin

public void purgePlugin(string $pluginCode)

purgePlugin deletes all records from the version and history tables for a plugin

Parameters
  • string $pluginCode - Plugin code

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

removePlugin 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 setNotesOutput(Illuminate\Console\Command $output)

setNotesOutput sets an output stream for writing notes

Parameters
  • Illuminate\Console\Command $output

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

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

applyDatabaseComment registers a database update comment in the history table

Parameters
  • $code
  • $version
  • $comment

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

applyDatabaseScript 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 array extractScriptsAndComments($details)

extractScriptsAndComments extracts script and comments from version details

Parameters
  • $details

protected void getDatabaseHistory($code)

getDatabaseHistory returns all the update history for a plugin

Parameters
  • $code

protected void getDatabaseVersion($code)

getDatabaseVersion returns the latest version of a plugin from the database

Parameters
  • $code

protected void getFileVersions($code)

getFileVersions returns all versions of a plugin from its version file

Parameters
  • $code

protected void getLatestFileVersion($code)

getLatestFileVersion returns the latest version of a plugin from its version file

Parameters
  • $code

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

getNewFileVersions returns any new versions from a supplied version, ie. unapplied versions

Parameters
  • $code
  • $version

protected void getVersionFile($code)

getVersionFile returns the absolute path to a version file for a plugin

Parameters
  • $code

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

hasDatabaseHistory checks if a plugin has an applied update version

Parameters
  • $code
  • $version
  • $script

protected void hasVersionFile($code)

hasVersionFile checks if a plugin has a version file

Parameters
  • $code

protected void init()

protected void normalizeVersion($version)

normalizeVersion checks some versions start with v and others not

Parameters
  • $version

protected void note(string $message)

note raises a note event for the migrator

Parameters
  • string $message

protected void removeDatabaseComment($code, $version)

removeDatabaseComment removes a database update comment in the history table

Parameters
  • $code
  • $version

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

removeDatabaseScript removes a database update script in the history table

Parameters
  • $code
  • $version
  • $script

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

setDatabaseVersion updates a plugin version in the database

Parameters
  • $code
  • $version