PHP Class Piwik\Updates

Show file Open project: piwik/piwik Class Usage Examples

Public Methods

Method Description
deletePluginFromConfigFile ( $pluginToDelete )
disableMaintenanceMode ( ) Helper method to disable maintenance mode after large updates.
doUpdate ( Updater $updater ) Perform the incremental version update.
enableMaintenanceMode ( ) Enables maintenance mode. Should be used for updates where Piwik will be unavailable for a large amount of time.
getMigrationQueries ( Updater $updater ) : array Return SQL to be executed in this update.
getMigrations ( Updater $updater ) : Migration[] Return migrations to be executed in this update.
getSql ( )
isMajorUpdate ( ) : boolean Tell the updater that this is a major update.
update ( )

Method Details

deletePluginFromConfigFile() public static method

public static deletePluginFromConfigFile ( $pluginToDelete )

disableMaintenanceMode() public static method

Helper method to disable maintenance mode after large updates.
public static disableMaintenanceMode ( )

doUpdate() public method

This method should preform all updating logic. If you define migrations in an overridden getMigrations() method, you must call {@link Updater::executeMigrations()} here. See {@link \Piwik\Plugins\ExamplePlugin\Updates\Updates_0_0_2} for an example.
public doUpdate ( Updater $updater )
$updater Updater

enableMaintenanceMode() public static method

Enables maintenance mode. Should be used for updates where Piwik will be unavailable for a large amount of time.
public static enableMaintenanceMode ( )

getMigrationQueries() public method

Return SQL to be executed in this update.
Deprecation: since Piwik 3.0.0, implement {@link getMigrations()} instead. Will be removed in Piwik 4.0.0
public getMigrationQueries ( Updater $updater ) : array
$updater Updater
return array

getMigrations() public method

Migrations should be defined here, instead of in doUpdate(), since this method is used to display a preview of which migrations and database queries an update will run. If you execute migrations directly in doUpdate(), they won't be displayed to the user.
public getMigrations ( Updater $updater ) : Migration[]
$updater Updater
return Piwik\Updater\Migration[]

getSql() public static method

Deprecation: since v2.12.0 use getMigrationQueries() instead. Will be removed in Piwik 4.0.0
public static getSql ( )

isMajorUpdate() public static method

Leads to a more visible notice. NOTE to release manager: Remember to mention in the Changelog that this update contains major DB upgrades and will take some time!
public static isMajorUpdate ( ) : boolean
return boolean

update() public static method

Deprecation: since v2.12.0 use doUpdate() instead. Will be removed in Piwik 4.0.0
public static update ( )