PHP Класс Neos\Flow\Package\PackageManager

Наследование: implements Neos\Flow\Package\PackageManagerInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$activePackages array List of active packages as package key => package object
$bootstrap Neos\Flow\Core\Bootstrap
$composerNameToPackageKeyMap array A map between ComposerName and PackageKey, only available when scanAvailablePackages is run
$dispatcher Neos\Flow\SignalSlot\Dispatcher
$packageFactory PackageFactory
$packageKeys array A translation table between lower cased and upper camel cased package keys
$packageStatesConfiguration array Package states configuration as stored in the PackageStates.php file
$packageStatesPathAndFilename string
$packages array Array of available packages, indexed by package key (case sensitive)
$packagesBasePath string Absolute path leading to the various package directories
$settings array

Открытые методы

Метод Описание
__construct ( string $packageStatesPathAndFilename = '' )
activatePackage ( string $packageKey ) : void Activates a package
createPackage ( string $packageKey, array $manifest = [], string $packagesPath = null ) : Neos\Flow\Package\PackageInterface Create a package, given the package key
deactivatePackage ( string $packageKey ) : void Deactivates a package
deletePackage ( string $packageKey ) : void Removes a package from registry and deletes it from filesystem
freezePackage ( string $packageKey ) : void Freezes a package
getActivePackages ( ) : array Returns an array of PackageInterface objects of all active packages.
getAvailablePackages ( ) : array Returns an array of PackageInterface objects of all available packages.
getCaseSensitivePackageKey ( string $unknownCasedPackageKey ) : mixed Returns the correctly cased version of the given package key or FALSE if no such package is available.
getFilteredPackages ( string $packageState = 'available', string $packagePath = null, string $packageType = null ) : array Returns an array of PackageInterface objects of all packages that match the given package state, path, and type filters. All three filters must match, if given.
getFrozenPackages ( ) : array Returns an array of PackageInterface objects of all frozen packages.
getPackage ( string $packageKey ) : Neos\Flow\Package\PackageInterface Returns a PackageInterface object for the specified package.
getPackageKeyFromComposerName ( string $composerName ) : string Resolves a Flow package key from a composer package name.
getPackageVersion ( string $composerName ) : string Get the package version of the given package Return normalized package version.
getPackagesBasePath ( ) : string Returns the base path for packages
initialize ( Bootstrap $bootstrap ) : void Initializes the package manager
injectSettings ( array $settings ) : void
isPackageActive ( string $packageKey ) : boolean Returns TRUE if a package is activated or FALSE if it's not.
isPackageAvailable ( string $packageKey ) : boolean Returns TRUE if a package is available (the package's files exist in the packages directory) or FALSE if it's not. If a package is available it doesn't mean necessarily that it's active!
isPackageFrozen ( string $packageKey ) : boolean Tells if a package is frozen
isPackageKeyValid ( string $packageKey ) : boolean Check the conformance of the given package key
refreezePackage ( string $packageKey ) : void Refreezes a package
rescanPackages ( boolean $reloadPackageStates = true ) : array Rescans available packages, order and write a new PackageStates file.
unfreezePackage ( string $packageKey ) : void Unfreezes a package

Защищенные методы

Метод Описание
buildActivePackageRelativePath ( string $inactivePackagePath ) : string Build the relative path to store an active package from the given inactive path
buildInactivePackageRelativePath ( string $packagePath ) : string Build the relative path to store a deactivated package based on the package.
collectPackageManifestData ( array $packageStates ) : array Collects the manifest data for all packages in the given package states array
derivePackageKey ( string $composerName, string $packageType = null, string $packagePath = null, string $autoloadNamespace = null ) : string Derive a flow package key from the given information.
emitPackageStatesUpdated ( ) : void Emits a signal when package states have been changed (e.g. when a package was created or activated)
filterPackagesByPath ( array &$packages, string $filterPath ) : array Returns an array of PackageInterface objects in the given array of packages that are in the specified Package Path
filterPackagesByType ( array &$packages, string $packageType ) : array Returns an array of PackageInterface objects in the given array of packages that are of the specified package type.
findComposerPackagesInPath ( string $startingDirectory ) : Generator Recursively traverses directories from the given starting points and returns all folder paths that contain a composer.json and which does NOT have the key "extra.neos.is-merged-repository" set, as that indicates a composer package that joins several "real" packages together.
getCurrentPackageStates ( ) : array Loads the states of available packages from the PackageStates.php file and initialises a package scan if the file was not found or the configuration format was not current.
getPackageKeyFromManifest ( array $manifest, string $packagePath ) : string Resolves package key from Composer manifest
loadPackageStates ( ) : array Load the current package states
movePackage ( string $fromAbsolutePath, string $toAbsolutePath ) : void Moves a package from one path to another.
movePackageToActivatedPackages ( string $inactivePackagePath ) : void Moves a package from the given inactive package path to the active package path.
movePackageToDeactivatedPackages ( string $packagePath ) : void Moves a package from the regular package path to the inactive packages directory.
preparePackageStateConfiguration ( string $packageKey, string $packagePath, array $composerManifest, string $state = self::PACKAGE_STATE_ACTIVE ) : array
recoverStateFromConfiguration ( array $packageStatesConfiguration ) : array Recover previous package state from given packageStatesConfiguration to be used after rescanning packages.
registerPackageFromStateConfiguration ( string $composerName, array $packageStateConfiguration ) : void Registers a package under the given composer name with the configuration.
registerPackagesFromConfiguration ( array $packageStatesConfiguration ) Requires and registers all packages which were defined in packageStatesConfiguration
savePackageStates ( array $orderedPackageStates ) Save the given (ordered) array of package states data
scanAvailablePackages ( array $previousPackageStatesConfiguration ) : array Scans all directories in the packages directories for available packages.
sortAndSavePackageStates ( array $packageStates ) : array Takes the given packageStatesConfiguration, sorts it by dependencies, saves it and returns the ordered list
sortAvailablePackagesByDependencies ( array $packageStates ) : array Orders all packages by comparing their dependencies. By this, the packages and package configurations arrays holds all packages in the correct initialization order.
unregisterPackage ( Neos\Flow\Package\PackageInterface $package ) : void Unregisters a package from the list of available packages

Описание методов

__construct() публичный Метод

public __construct ( string $packageStatesPathAndFilename = '' )
$packageStatesPathAndFilename string

activatePackage() публичный Метод

Activates a package
public activatePackage ( string $packageKey ) : void
$packageKey string The package to activate
Результат void

buildActivePackageRelativePath() защищенный Метод

Build the relative path to store an active package from the given inactive path
protected buildActivePackageRelativePath ( string $inactivePackagePath ) : string
$inactivePackagePath string
Результат string

buildInactivePackageRelativePath() защищенный Метод

Build the relative path to store a deactivated package based on the package.
protected buildInactivePackageRelativePath ( string $packagePath ) : string
$packagePath string absolute path to the package
Результат string

collectPackageManifestData() защищенный Метод

Collects the manifest data for all packages in the given package states array
protected collectPackageManifestData ( array $packageStates ) : array
$packageStates array
Результат array

createPackage() публичный Метод

Create a package, given the package key
public createPackage ( string $packageKey, array $manifest = [], string $packagesPath = null ) : Neos\Flow\Package\PackageInterface
$packageKey string The package key of the new package
$manifest array A composer manifest as associative array. This is a preparation for the signature change in Flow 4.0. If you use this argument, then $packageMetaData and $packageType will be ignored.
$packagesPath string If specified, the package will be created in this path, otherwise the default "Application" directory is used
Результат Neos\Flow\Package\PackageInterface The newly created package

deactivatePackage() публичный Метод

Deactivates a package
public deactivatePackage ( string $packageKey ) : void
$packageKey string The package to deactivate
Результат void

deletePackage() публичный Метод

Removes a package from registry and deletes it from filesystem
public deletePackage ( string $packageKey ) : void
$packageKey string package to remove
Результат void

derivePackageKey() защищенный Метод

The order of importance is: - package install path - first found autoload namespace - composer name
protected derivePackageKey ( string $composerName, string $packageType = null, string $packagePath = null, string $autoloadNamespace = null ) : string
$composerName string
$packageType string
$packagePath string
$autoloadNamespace string
Результат string

emitPackageStatesUpdated() защищенный Метод

The advice is not proxyable, so the signal is dispatched manually here.
protected emitPackageStatesUpdated ( ) : void
Результат void

filterPackagesByPath() защищенный Метод

Returns an array of PackageInterface objects in the given array of packages that are in the specified Package Path
protected filterPackagesByPath ( array &$packages, string $filterPath ) : array
$packages array Array of PackageInterface to be filtered
$filterPath string Filter out anything that's not in this path
Результат array

filterPackagesByType() защищенный Метод

Returns an array of PackageInterface objects in the given array of packages that are of the specified package type.
protected filterPackagesByType ( array &$packages, string $packageType ) : array
$packages array Array of PackageInterface objects to be filtered
$packageType string Filter out anything that's not of this packageType
Результат array

findComposerPackagesInPath() защищенный Метод

In case a "is-merged-repository" is found the traversal continues inside.
protected findComposerPackagesInPath ( string $startingDirectory ) : Generator
$startingDirectory string
Результат Generator

freezePackage() публичный Метод

Freezes a package
public freezePackage ( string $packageKey ) : void
$packageKey string The package to freeze
Результат void

getActivePackages() публичный Метод

A package is active, if it is available and has been activated in the package manager settings.
public getActivePackages ( ) : array
Результат array

getAvailablePackages() публичный Метод

A package is available, if the package directory contains valid meta information.
public getAvailablePackages ( ) : array
Результат array

getCaseSensitivePackageKey() публичный Метод

Returns the correctly cased version of the given package key or FALSE if no such package is available.
public getCaseSensitivePackageKey ( string $unknownCasedPackageKey ) : mixed
$unknownCasedPackageKey string The package key to convert
Результат mixed The upper camel cased package key or FALSE if no such package exists

getCurrentPackageStates() защищенный Метод

Loads the states of available packages from the PackageStates.php file and initialises a package scan if the file was not found or the configuration format was not current.
protected getCurrentPackageStates ( ) : array
Результат array

getFilteredPackages() публичный Метод

Returns an array of PackageInterface objects of all packages that match the given package state, path, and type filters. All three filters must match, if given.
public getFilteredPackages ( string $packageState = 'available', string $packagePath = null, string $packageType = null ) : array
$packageState string defaults to available
$packagePath string
$packageType string
Результат array

getFrozenPackages() публичный Метод

A frozen package is not considered by file monitoring and provides some precompiled reflection data in order to improve performance.
public getFrozenPackages ( ) : array
Результат array

getPackage() публичный Метод

Returns a PackageInterface object for the specified package.
public getPackage ( string $packageKey ) : Neos\Flow\Package\PackageInterface
$packageKey string
Результат Neos\Flow\Package\PackageInterface The requested package object

getPackageKeyFromComposerName() публичный Метод

Resolves a Flow package key from a composer package name.
public getPackageKeyFromComposerName ( string $composerName ) : string
$composerName string
Результат string

getPackageKeyFromManifest() защищенный Метод

If it is a Flow package the name of the containing directory will be used. Else if the composer name of the package matches the first part of the lowercased namespace of the package, the mixed case version of the composer name / namespace will be used, with backslashes replaced by dots. Else the composer name will be used with the slash replaced by a dot
protected getPackageKeyFromManifest ( array $manifest, string $packagePath ) : string
$manifest array
$packagePath string
Результат string

getPackageVersion() публичный статический Метод

Get the package version of the given package Return normalized package version.
См. также: https://getcomposer.org/doc/04-schema.md#version
public static getPackageVersion ( string $composerName ) : string
$composerName string
Результат string

getPackagesBasePath() публичный Метод

Returns the base path for packages
public getPackagesBasePath ( ) : string
Результат string

initialize() публичный Метод

Initializes the package manager
public initialize ( Bootstrap $bootstrap ) : void
$bootstrap Neos\Flow\Core\Bootstrap The current bootstrap
Результат void

injectSettings() публичный Метод

public injectSettings ( array $settings ) : void
$settings array
Результат void

isPackageActive() публичный Метод

Returns TRUE if a package is activated or FALSE if it's not.
public isPackageActive ( string $packageKey ) : boolean
$packageKey string The key of the package to check
Результат boolean TRUE if package is active, otherwise FALSE

isPackageAvailable() публичный Метод

Returns TRUE if a package is available (the package's files exist in the packages directory) or FALSE if it's not. If a package is available it doesn't mean necessarily that it's active!
public isPackageAvailable ( string $packageKey ) : boolean
$packageKey string The key of the package to check
Результат boolean TRUE if the package is available, otherwise FALSE

isPackageFrozen() публичный Метод

Tells if a package is frozen
public isPackageFrozen ( string $packageKey ) : boolean
$packageKey string The package to check
Результат boolean

isPackageKeyValid() публичный Метод

Check the conformance of the given package key
public isPackageKeyValid ( string $packageKey ) : boolean
$packageKey string The package key to validate
Результат boolean If the package key is valid, returns TRUE otherwise FALSE

loadPackageStates() защищенный Метод

Load the current package states
protected loadPackageStates ( ) : array
Результат array

movePackage() защищенный Метод

Moves a package from one path to another.
protected movePackage ( string $fromAbsolutePath, string $toAbsolutePath ) : void
$fromAbsolutePath string
$toAbsolutePath string
Результат void

movePackageToActivatedPackages() защищенный Метод

Moves a package from the given inactive package path to the active package path.
protected movePackageToActivatedPackages ( string $inactivePackagePath ) : void
$inactivePackagePath string
Результат void

movePackageToDeactivatedPackages() защищенный Метод

Moves a package from the regular package path to the inactive packages directory.
protected movePackageToDeactivatedPackages ( string $packagePath ) : void
$packagePath string absolute path to the package
Результат void

preparePackageStateConfiguration() защищенный Метод

protected preparePackageStateConfiguration ( string $packageKey, string $packagePath, array $composerManifest, string $state = self::PACKAGE_STATE_ACTIVE ) : array
$packageKey string
$packagePath string
$composerManifest array
$state string
Результат array

recoverStateFromConfiguration() защищенный Метод

Recover previous package state from given packageStatesConfiguration to be used after rescanning packages.
protected recoverStateFromConfiguration ( array $packageStatesConfiguration ) : array
$packageStatesConfiguration array
Результат array

refreezePackage() публичный Метод

Refreezes a package
public refreezePackage ( string $packageKey ) : void
$packageKey string The package to refreeze
Результат void

registerPackageFromStateConfiguration() защищенный Метод

This uses the PackageFactory to create the Package instance and sets it to all relevant data arrays.
protected registerPackageFromStateConfiguration ( string $composerName, array $packageStateConfiguration ) : void
$composerName string
$packageStateConfiguration array
Результат void

registerPackagesFromConfiguration() защищенный Метод

Requires and registers all packages which were defined in packageStatesConfiguration
protected registerPackagesFromConfiguration ( array $packageStatesConfiguration )
$packageStatesConfiguration array

rescanPackages() публичный Метод

Rescans available packages, order and write a new PackageStates file.
public rescanPackages ( boolean $reloadPackageStates = true ) : array
$reloadPackageStates boolean Should the package states be loaded before scanning or use the current configuration
Результат array The found and sorted package states.

savePackageStates() защищенный Метод

Save the given (ordered) array of package states data
protected savePackageStates ( array $orderedPackageStates )
$orderedPackageStates array

scanAvailablePackages() защищенный Метод

For each package a Package object is created and stored in $this->packages.
protected scanAvailablePackages ( array $previousPackageStatesConfiguration ) : array
$previousPackageStatesConfiguration array Existing package state configuration
Результат array

sortAndSavePackageStates() защищенный Метод

Takes the given packageStatesConfiguration, sorts it by dependencies, saves it and returns the ordered list
protected sortAndSavePackageStates ( array $packageStates ) : array
$packageStates array
Результат array

sortAvailablePackagesByDependencies() защищенный Метод

Orders all packages by comparing their dependencies. By this, the packages and package configurations arrays holds all packages in the correct initialization order.
protected sortAvailablePackagesByDependencies ( array $packageStates ) : array
$packageStates array The unordered package states
Результат array ordered package states.

unfreezePackage() публичный Метод

Unfreezes a package
public unfreezePackage ( string $packageKey ) : void
$packageKey string The package to unfreeze
Результат void

unregisterPackage() защищенный Метод

Unregisters a package from the list of available packages
protected unregisterPackage ( Neos\Flow\Package\PackageInterface $package ) : void
$package Neos\Flow\Package\PackageInterface The package to be unregistered
Результат void

Описание свойств

$activePackages защищенное свойство

List of active packages as package key => package object
protected array $activePackages
Результат array

$bootstrap защищенное свойство

protected Bootstrap,Neos\Flow\Core $bootstrap
Результат Neos\Flow\Core\Bootstrap

$composerNameToPackageKeyMap защищенное свойство

A map between ComposerName and PackageKey, only available when scanAvailablePackages is run
protected array $composerNameToPackageKeyMap
Результат array

$dispatcher защищенное свойство

protected Dispatcher,Neos\Flow\SignalSlot $dispatcher
Результат Neos\Flow\SignalSlot\Dispatcher

$packageFactory защищенное свойство

protected PackageFactory,Neos\Flow\Package $packageFactory
Результат PackageFactory

$packageKeys защищенное свойство

A translation table between lower cased and upper camel cased package keys
protected array $packageKeys
Результат array

$packageStatesConfiguration защищенное свойство

Package states configuration as stored in the PackageStates.php file
protected array $packageStatesConfiguration
Результат array

$packageStatesPathAndFilename защищенное свойство

protected string $packageStatesPathAndFilename
Результат string

$packages защищенное свойство

Array of available packages, indexed by package key (case sensitive)
protected array $packages
Результат array

$packagesBasePath защищенное свойство

Absolute path leading to the various package directories
protected string $packagesBasePath
Результат string

$settings защищенное свойство

protected array $settings
Результат array