Method | Description | |
---|---|---|
__construct ( string | null $pathUpdateFileCore = null, string | null $pathUpdateFilePlugins = null, |
Constructor. | |
addUpdateObserver ( |
Adds an UpdateObserver to the internal list of listeners. | |
executeMigration ( $file, |
||
executeMigrationQueries ( $file, $migrationQueries ) | ||
executeMigrations ( string $file, |
Execute multiple migration queries from a single Update file. | |
getComponentUpdates ( ) : string[] | null | Returns any updates that should occur for core and all plugins that are both loaded and installed. Also includes updates required for dimensions. | |
getComponentsWithNewVersion ( string[] $componentsToCheck ) : array | Construct list of outdated components | |
getComponentsWithUpdateFile ( string[] $componentsToCheck ) : array( | Returns a list of components (core | plugin) that need to run through the upgrade process. | |
getCurrentComponentVersion ( string $name ) : string | Returns the currently installed version of a Piwik component. | |
getSqlQueriesToExecute ( ) : |
Returns the list of SQL queries that would be executed during the update | |
getUpdateClassName ( $componentName, $fileVersion ) | ||
hasMajorDbUpdate ( ) : boolean | Does one of the new versions involve a major database update? Note: getSqlQueriesToExecute() must be called before this method! | |
hasNewVersion ( string $componentName ) : boolean | Component has a new version? | |
markComponentSuccessfullyUninstalled ( string $name ) | Marks a component as successfully uninstalled. Deletes an option that looks like "version_$componentName". | |
markComponentSuccessfullyUpdated ( string $name, string $version, boolean $isNew = false ) | Marks a component as successfully updated to a specific version in the database. Sets an option that looks like "version_$componentName". | |
recordComponentSuccessfullyUpdated ( string $name, string $version ) | Record version of successfully completed component update | |
update ( string $componentName ) : array | Update the named component | |
updateComponents ( string[] $componentsWithUpdateFile ) : array | Updates multiple components, while capturing & returning errors and warnings. | |
updateDatabase ( string $file, array $sqlarray ) | Performs database update(s) |
Method | Description | |
---|---|---|
executeListenerHook ( $hookName, $arguments ) | ||
executeSingleUpdateClass ( $className ) | ||
getNameInOptionTable ( string $name ) : string | Returns the flag name to use in the option table to record current schema version | |
keepBcForOldMigrationQueryFormat ( $index, $migration ) | ||
loadComponentsWithUpdateFile ( ) : array( | Construct list of update files for the outdated components |
public __construct ( string | null $pathUpdateFileCore = null, string | null $pathUpdateFilePlugins = null, |
||
$pathUpdateFileCore | string | null | The path to core Update files. |
$pathUpdateFilePlugins | string | null | The path to plugin update files. Should contain a `'%s'` placeholder for the plugin name. |
$columnsUpdater | The dimensions updater instance. |
public addUpdateObserver ( |
||
$listener |
public executeMigration ( $file, |
||
$file | ||
$migration |
public executeMigrations ( string $file, |
||
$file | string | The path to the Updates file. |
$migrations | An array of migrations |
public getComponentUpdates ( ) : string[] | null | ||
return | string[] | null | Returns the result of `getComponentsWithUpdateFile()`. |
public getComponentsWithNewVersion ( string[] $componentsToCheck ) : array | ||
$componentsToCheck | string[] | An array mapping component names to the latest locally available version. If the version is later than the currently installed version, the component must be upgraded. Example: `array('core' => '2.11.0')` |
return | array | array( componentName => array( oldVersion, newVersion), [...]) |
public getComponentsWithUpdateFile ( string[] $componentsToCheck ) : array( | ||
$componentsToCheck | string[] | An array mapping component names to the latest locally available version. If the version is later than the currently installed version, the component must be upgraded. Example: `array('core' => '2.11.0')` |
return | array( |
public getCurrentComponentVersion ( string $name ) : string | ||
$name | string | The component name. Eg, a plugin name, `'core'` or dimension column name. |
return | string | A semantic version. |
public getSqlQueriesToExecute ( ) : |
||
return | of SQL queries |
public hasMajorDbUpdate ( ) : boolean | ||
return | boolean |
public hasNewVersion ( string $componentName ) : boolean | ||
$componentName | string | |
return | boolean | TRUE if compoment is to be updated; FALSE if not |
public markComponentSuccessfullyUninstalled ( string $name ) | ||
$name | string | The component name. Eg, a plugin name, `'core'` or dimension column name. |
public markComponentSuccessfullyUpdated ( string $name, string $version, boolean $isNew = false ) | ||
$name | string | The component name. Eg, a plugin name, `'core'` or dimension column name. |
$version | string | The component version (should use semantic versioning). |
$isNew | boolean | indicates if the component is a new one (for plugins) |
public static recordComponentSuccessfullyUpdated ( string $name, string $version ) | ||
$name | string | |
$version | string |
public updateComponents ( string[] $componentsWithUpdateFile ) : array | ||
$componentsWithUpdateFile | string[] | Component names mapped with arrays of update files. Same structure as the result of `getComponentsWithUpdateFile()`. |
return | array | Information about the update process, including: * **warnings**: The list of warnings that occurred during the update process. * **errors**: The list of updater exceptions thrown during individual component updates. * **coreError**: True if an exception was thrown while updating core. * **deactivatedPlugins**: The list of plugins that were deactivated due to an error in the update process. |
public static updateDatabase ( string $file, array $sqlarray ) | ||
$file | string | Update script filename |
$sqlarray | array | An array of SQL queries to be executed |