StorageComparerInterface.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. namespace Drupal\Core\Config;
  3. /**
  4. * Defines an interface for comparison of configuration storage objects.
  5. */
  6. interface StorageComparerInterface {
  7. /**
  8. * Gets the configuration source storage.
  9. *
  10. * @param string $collection
  11. * (optional) The storage collection to use. Defaults to the
  12. * default collection.
  13. *
  14. * @return \Drupal\Core\Config\StorageInterface
  15. * Storage object used to read configuration.
  16. */
  17. public function getSourceStorage($collection = StorageInterface::DEFAULT_COLLECTION);
  18. /**
  19. * Gets the configuration target storage.
  20. *
  21. * @param string $collection
  22. * (optional) The storage collection to use. Defaults to the
  23. * default collection.
  24. *
  25. * @return \Drupal\Core\Config\StorageInterface
  26. * Storage object used to write configuration.
  27. */
  28. public function getTargetStorage($collection = StorageInterface::DEFAULT_COLLECTION);
  29. /**
  30. * Gets an empty changelist.
  31. *
  32. * @return array
  33. * An empty changelist array.
  34. */
  35. public function getEmptyChangelist();
  36. /**
  37. * Gets the list of differences to import.
  38. *
  39. * @param string $op
  40. * (optional) A change operation. Either delete, create or update. If
  41. * supplied the returned list will be limited to this operation.
  42. * @param string $collection
  43. * (optional) The collection to get the changelist for. Defaults to the
  44. * default collection.
  45. *
  46. * @return array
  47. * An array of config changes that are yet to be imported.
  48. */
  49. public function getChangelist($op = NULL, $collection = StorageInterface::DEFAULT_COLLECTION);
  50. /**
  51. * Recalculates the differences.
  52. *
  53. * @return \Drupal\Core\Config\StorageComparerInterface
  54. * An object which implements the StorageComparerInterface.
  55. */
  56. public function reset();
  57. /**
  58. * Checks if there are any operations with changes to process.
  59. *
  60. * Until the changelist has been calculated this will always be FALSE.
  61. *
  62. * @return bool
  63. * TRUE if there are changes to process and FALSE if not.
  64. *
  65. * @see \Drupal\Core\Config\StorageComparerInterface::createChangelist()
  66. */
  67. public function hasChanges();
  68. /**
  69. * Validates that the system.site::uuid in the source and target match.
  70. *
  71. * @return bool
  72. * TRUE if identical, FALSE if not.
  73. */
  74. public function validateSiteUuid();
  75. /**
  76. * Moves a rename operation to an update.
  77. *
  78. * @param string $rename
  79. * The rename name, as provided by ConfigImporter::createRenameName().
  80. * @param string $collection
  81. * (optional) The collection where the configuration is stored. Defaults to
  82. * the default collection.
  83. *
  84. * @see \Drupal\Core\Config\ConfigImporter::createRenameName()
  85. */
  86. public function moveRenameToUpdate($rename, $collection = StorageInterface::DEFAULT_COLLECTION);
  87. /**
  88. * Extracts old and new configuration names from a configuration change name.
  89. *
  90. * @param string $name
  91. * The configuration change name, as provided by
  92. * ConfigImporter::createRenameName().
  93. *
  94. * @return array
  95. * An associative array of configuration names. The array keys are
  96. * 'old_name' and 'new_name' representing the old and new configuration
  97. * object names during a rename operation.
  98. *
  99. * @see \Drupal\Core\Config\StorageComparer::createRenameNames()
  100. */
  101. public function extractRenameNames($name);
  102. /**
  103. * Gets the existing collections from both the target and source storage.
  104. *
  105. * @param bool $include_default
  106. * (optional) Include the default collection. Defaults to TRUE.
  107. *
  108. * @return array
  109. * An array of existing collection names.
  110. */
  111. public function getAllCollectionNames($include_default = TRUE);
  112. }