interface StorageComparerInterface (View source)

Defines an interface for comparison of configuration storage objects.

Methods

getSourceStorage(string $collection = StorageInterface::DEFAULT_COLLECTION)

Gets the configuration source storage.

getTargetStorage(string $collection = StorageInterface::DEFAULT_COLLECTION)

Gets the configuration target storage.

array
getEmptyChangelist()

Gets an empty changelist.

array
getChangelist(string $op = NULL, string $collection = StorageInterface::DEFAULT_COLLECTION)

Gets the list of differences to import.

$this
reset()

Recalculates the differences.

bool
hasChanges()

Checks if there are any operations with changes to process.

bool
validateSiteUuid()

Validates that the system.site::uuid in the source and target match.

moveRenameToUpdate(string $rename, string $collection = StorageInterface::DEFAULT_COLLECTION)

Moves a rename operation to an update.

array
extractRenameNames(string $name)

Extracts old and new configuration names from a configuration change name.

array
getAllCollectionNames(bool $include_default = TRUE)

Gets the existing collections from both the target and source storage.

Details

StorageInterface getSourceStorage(string $collection = StorageInterface::DEFAULT_COLLECTION)

Gets the configuration source storage.

Parameters

string $collection

(optional) The storage collection to use. Defaults to the default collection.

Return Value

StorageInterface

Storage object used to read configuration.

StorageInterface getTargetStorage(string $collection = StorageInterface::DEFAULT_COLLECTION)

Gets the configuration target storage.

Parameters

string $collection

(optional) The storage collection to use. Defaults to the default collection.

Return Value

StorageInterface

Storage object used to write configuration.

array getEmptyChangelist()

Gets an empty changelist.

Return Value

array

An empty changelist array.

array getChangelist(string $op = NULL, string $collection = StorageInterface::DEFAULT_COLLECTION)

Gets the list of differences to import.

Parameters

string $op

(optional) A change operation. Either delete, create or update. If supplied the returned list will be limited to this operation.

string $collection

(optional) The collection to get the changelist for. Defaults to the default collection.

Return Value

array

An array of config changes that are yet to be imported.

$this reset()

Recalculates the differences.

Return Value

$this

An object which implements the StorageComparerInterface.

bool hasChanges()

Checks if there are any operations with changes to process.

Until the changelist has been calculated this will always be FALSE.

Return Value

bool

TRUE if there are changes to process and FALSE if not.

See also

\Drupal\Core\Config\StorageComparerInterface::createChangelist()

bool validateSiteUuid()

Validates that the system.site::uuid in the source and target match.

Return Value

bool

TRUE if identical, FALSE if not.

moveRenameToUpdate(string $rename, string $collection = StorageInterface::DEFAULT_COLLECTION)

Moves a rename operation to an update.

Parameters

string $rename

The rename name, as provided by ConfigImporter::createRenameName().

string $collection

(optional) The collection where the configuration is stored. Defaults to the default collection.

See also

\Drupal\Core\Config\ConfigImporter::createRenameName()

array extractRenameNames(string $name)

Extracts old and new configuration names from a configuration change name.

Parameters

string $name

The configuration change name, as provided by ConfigImporter::createRenameName().

Return Value

array

An associative array of configuration names. The array keys are 'old_name' and 'new_name' representing the old and new configuration object names during a rename operation.

See also

\Drupal\Core\Config\StorageComparer::createRenameNames()

array getAllCollectionNames(bool $include_default = TRUE)

Gets the existing collections from both the target and source storage.

Parameters

bool $include_default

(optional) Include the default collection. Defaults to TRUE.

Return Value

array

An array of existing collection names.