PHP 클래스 Piwik\Updater

파일 보기 프로젝트 열기: piwik/piwik 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string | null $pathUpdateFileCore = null, string | null $pathUpdateFilePlugins = null, Updater $columnsUpdater = null ) Constructor.
addUpdateObserver ( UpdateObserver $listener ) Adds an UpdateObserver to the internal list of listeners.
executeMigration ( $file, Migration $migration )
executeMigrationQueries ( $file, $migrationQueries )
executeMigrations ( string $file, Migration[] $migrations ) 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 ( ) : Sql[] 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)

비공개 메소드들

메소드 설명
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

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( string | null $pathUpdateFileCore = null, string | null $pathUpdateFilePlugins = null, Updater $columnsUpdater = 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 Piwik\Columns\Updater The dimensions updater instance.

addUpdateObserver() 공개 메소드

Adds an UpdateObserver to the internal list of listeners.
public addUpdateObserver ( UpdateObserver $listener )
$listener Piwik\Updater\UpdateObserver

executeMigration() 공개 메소드

public executeMigration ( $file, Migration $migration )
$file
$migration Piwik\Updater\Migration

executeMigrationQueries() 공개 메소드

사용 중단: since Piwik 3.0.0, use {@link executeMigrations()} instead.
public executeMigrationQueries ( $file, $migrationQueries )

executeMigrations() 공개 메소드

Execute multiple migration queries from a single Update file.
public executeMigrations ( string $file, Migration[] $migrations )
$file string The path to the Updates file.
$migrations Piwik\Updater\Migration[] An array of migrations

getComponentUpdates() 공개 메소드

Returns any updates that should occur for core and all plugins that are both loaded and installed. Also includes updates required for dimensions.
public getComponentUpdates ( ) : string[] | null
리턴 string[] | null Returns the result of `getComponentsWithUpdateFile()`.

getComponentsWithNewVersion() 공개 메소드

Construct list of outdated components
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')`
리턴 array array( componentName => array( oldVersion, newVersion), [...])

getComponentsWithUpdateFile() 공개 메소드

Returns a list of components (core | plugin) that need to run through the upgrade process.
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')`
리턴 array(

getCurrentComponentVersion() 공개 메소드

Returns the currently installed version of a Piwik component.
public getCurrentComponentVersion ( string $name ) : string
$name string The component name. Eg, a plugin name, `'core'` or dimension column name.
리턴 string A semantic version.

getSqlQueriesToExecute() 공개 메소드

Returns the list of SQL queries that would be executed during the update
public getSqlQueriesToExecute ( ) : Sql[]
리턴 Piwik\Updater\Migration\Db\Sql[] of SQL queries

getUpdateClassName() 공개 메소드

public getUpdateClassName ( $componentName, $fileVersion )

hasMajorDbUpdate() 공개 메소드

Does one of the new versions involve a major database update? Note: getSqlQueriesToExecute() must be called before this method!
public hasMajorDbUpdate ( ) : boolean
리턴 boolean

hasNewVersion() 공개 메소드

Component has a new version?
public hasNewVersion ( string $componentName ) : boolean
$componentName string
리턴 boolean TRUE if compoment is to be updated; FALSE if not

markComponentSuccessfullyUninstalled() 공개 메소드

Marks a component as successfully uninstalled. Deletes an option that looks like "version_$componentName".
public markComponentSuccessfullyUninstalled ( string $name )
$name string The component name. Eg, a plugin name, `'core'` or dimension column name.

markComponentSuccessfullyUpdated() 공개 메소드

Marks a component as successfully updated to a specific version in the database. Sets an option that looks like "version_$componentName".
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)

recordComponentSuccessfullyUpdated() 공개 정적인 메소드

Record version of successfully completed component update
public static recordComponentSuccessfullyUpdated ( string $name, string $version )
$name string
$version string

update() 공개 메소드

Update the named component
public update ( string $componentName ) : array
$componentName string 'core', or plugin name
리턴 array of warning strings if applicable

updateComponents() 공개 메소드

Updates multiple components, while capturing & returning errors and warnings.
public updateComponents ( string[] $componentsWithUpdateFile ) : array
$componentsWithUpdateFile string[] Component names mapped with arrays of update files. Same structure as the result of `getComponentsWithUpdateFile()`.
리턴 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.

updateDatabase() 공개 정적인 메소드

Performs database update(s)
사용 중단:
public static updateDatabase ( string $file, array $sqlarray )
$file string Update script filename
$sqlarray array An array of SQL queries to be executed