PHP Class Neos\Flow\Core\Migrations\Manager

显示文件 Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$currentPackageData array ..)
$eventCallbacks array Callbacks to be invoked when an event is triggered
$ignoredPackageCategories array
$migrations AbstractMigration[]
$packagesData array
$packagesPath string

Public Methods

Method Description
getCurrentPackageKey ( ) : string
getStatus ( string $packageKey = null, string $versionNumber = null ) : array Returns the migration status for all packages.
migrate ( string $packageKey = null, string $versionNumber = null, boolean $force = false ) : void This iterates over available migrations and applies them to the existing packages if - the package needs the migration - is a clean git working copy
on ( string $eventIdentifier, Closure $callback ) Attaches a new event handler
setPackagesPath ( string $packagesPath ) : void Allows to set the packages path.

Protected Methods

Method Description
commitMigration ( AbstractMigration $migration, string $commitMessageNotice = null ) : string Commit changes done to the package described by $packageData. The migration that was did the changes is given with $versionNumber and $versionPackageKey and will be recorded in the commit message.
getMigrations ( string $versionNumber = null ) : AbstractMigration[]
getPackagesData ( string $packageKey = null ) : array
hasMigrationApplied ( AbstractMigration $migration ) : boolean Whether or not the given $migration has been applied to the current package
importMigrationLogFromGitHistory ( boolean $commitChanges = false ) : string Imports the core migration log from the git history if it has not been imported previously (the "applied-flow-migrations" composer manifest property does not exist)
initialize ( ) : void Initialize the manager: read package information and register migrations.
markMigrationApplied ( AbstractMigration $migration ) : boolean Whether or not the given migration has been applied in the given path
migratePackage ( AbstractMigration $migration, boolean $force = false ) : void Apply the given migration to the package and commit the result.
registerMigrationFiles ( string $packagePath ) : void Look for code migration files in the given package path and register them for further action.
shouldPackageBeSkippedByDefault ( ) : boolean By default we skip "TYPO3.*" and "Neos.*" packages and all packages of the ignored categories (@see ignoredPackageCategories)
triggerEvent ( string $eventIdentifier, array $eventData = null ) Trigger a custom event
writeComposerManifest ( ) : void

Method Details

commitMigration() protected method

Commit changes done to the package described by $packageData. The migration that was did the changes is given with $versionNumber and $versionPackageKey and will be recorded in the commit message.
protected commitMigration ( AbstractMigration $migration, string $commitMessageNotice = null ) : string
$migration AbstractMigration
$commitMessageNotice string
return string

getCurrentPackageKey() public method

public getCurrentPackageKey ( ) : string
return string

getMigrations() protected method

protected getMigrations ( string $versionNumber = null ) : AbstractMigration[]
$versionNumber string if specified only the migration with the specified version is returned
return AbstractMigration[]

getPackagesData() protected method

protected getPackagesData ( string $packageKey = null ) : array
$packageKey string if specified, only the package data for the given key is returned
return array in the format [' ['packageKey' => '', 'category' => , 'path' => '', 'meta' => '', 'composerManifest' => ''], [...]]

getStatus() public method

Returns the migration status for all packages.
public getStatus ( string $packageKey = null, string $versionNumber = null ) : array
$packageKey string key of the package to migrate, or NULL to migrate all packages
$versionNumber string version of the migration to fetch the status for (e.g. "20120126163610"), or NULL to consider all migrations
return array in the format [ => ['migration' => , 'state' => ], [...]]

hasMigrationApplied() protected method

Whether or not the given $migration has been applied to the current package
protected hasMigrationApplied ( AbstractMigration $migration ) : boolean
$migration AbstractMigration
return boolean

importMigrationLogFromGitHistory() protected method

Imports the core migration log from the git history if it has not been imported previously (the "applied-flow-migrations" composer manifest property does not exist)
protected importMigrationLogFromGitHistory ( boolean $commitChanges = false ) : string
$commitChanges boolean if TRUE the modified composer manifest is committed - if it changed
return string

initialize() protected method

Initialize the manager: read package information and register migrations.
protected initialize ( ) : void
return void

markMigrationApplied() protected method

Whether or not the given migration has been applied in the given path
protected markMigrationApplied ( AbstractMigration $migration ) : boolean
$migration AbstractMigration
return boolean

migrate() public method

This iterates over available migrations and applies them to the existing packages if - the package needs the migration - is a clean git working copy
public migrate ( string $packageKey = null, string $versionNumber = null, boolean $force = false ) : void
$packageKey string key of the package to migrate, or NULL to migrate all packages
$versionNumber string version of the migration to execute (e.g. "20120126163610"), or NULL to execute all migrations
$force boolean if TRUE migrations will be applied even if the corresponding package is not a git working copy or contains local changes
return void

migratePackage() protected method

Apply the given migration to the package and commit the result.
protected migratePackage ( AbstractMigration $migration, boolean $force = false ) : void
$migration AbstractMigration
$force boolean if TRUE the migration will be applied even if the current package is not a git working copy or contains local changes
return void

on() public method

Attaches a new event handler
public on ( string $eventIdentifier, Closure $callback )
$eventIdentifier string one of the EVENT_* constants
$callback Closure a closure to be invoked when the corresponding event was triggered

registerMigrationFiles() protected method

Look for code migration files in the given package path and register them for further action.
protected registerMigrationFiles ( string $packagePath ) : void
$packagePath string
return void

setPackagesPath() public method

The level directly inside is expected to consist of package "categories" (Framework, Application, Plugins, ...).
public setPackagesPath ( string $packagesPath ) : void
$packagesPath string
return void

shouldPackageBeSkippedByDefault() protected method

By default we skip "TYPO3.*" and "Neos.*" packages and all packages of the ignored categories (@see ignoredPackageCategories)

triggerEvent() protected method

Trigger a custom event
protected triggerEvent ( string $eventIdentifier, array $eventData = null )
$eventIdentifier string one of the EVENT_* constants
$eventData array optional arguments to be passed to the handler closure

writeComposerManifest() protected method

protected writeComposerManifest ( ) : void
return void

Property Details

$currentPackageData protected_oe property

..)
protected array $currentPackageData
return array

$eventCallbacks protected_oe property

Callbacks to be invoked when an event is triggered
See also: triggerEvent()
protected array $eventCallbacks
return array

$ignoredPackageCategories protected_oe property

protected array $ignoredPackageCategories
return array

$migrations protected_oe property

protected AbstractMigration[],Neos\Flow\Core\Migrations $migrations
return AbstractMigration[]

$packagesData protected_oe property

protected array $packagesData
return array

$packagesPath protected_oe property

protected string $packagesPath
return string