Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023

This commit is contained in:
Pantheon Automation 2015-09-04 13:20:09 -07:00 committed by Greg Anderson
parent 2720a9ec4b
commit f3791f1da3
1898 changed files with 54300 additions and 11481 deletions

View file

@ -158,6 +158,7 @@ class ConfigInstaller implements ConfigInstallerInterface {
*/
public function installOptionalConfig(StorageInterface $storage = NULL, $dependency = []) {
$profile = $this->drupalGetProfile();
$optional_profile_config = [];
if (!$storage) {
// Search the install profile's optional configuration too.
$storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, TRUE);
@ -168,6 +169,7 @@ class ConfigInstaller implements ConfigInstallerInterface {
// Creates a profile storage to search for overrides.
$profile_install_path = $this->drupalGetPath('module', $profile) . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY;
$profile_storage = new FileStorage($profile_install_path, StorageInterface::DEFAULT_COLLECTION);
$optional_profile_config = $profile_storage->listAll();
}
else {
// Profile has not been set yet. For example during the first steps of the
@ -178,7 +180,8 @@ class ConfigInstaller implements ConfigInstallerInterface {
$enabled_extensions = $this->getEnabledExtensions();
$existing_config = $this->getActiveStorages()->listAll();
$list = array_filter($storage->listAll(), function($config_name) use ($existing_config) {
$list = array_unique(array_merge($storage->listAll(), $optional_profile_config));
$list = array_filter($list, function($config_name) use ($existing_config) {
// Only list configuration that:
// - does not already exist
// - is a configuration entity (this also excludes config that has an
@ -188,7 +191,8 @@ class ConfigInstaller implements ConfigInstallerInterface {
$all_config = array_merge($existing_config, $list);
$config_to_create = $storage->readMultiple($list);
// Check to see if the corresponding override storage has any overrides.
// Check to see if the corresponding override storage has any overrides or
// new configuration that can be installed.
if ($profile_storage) {
$config_to_create = $profile_storage->readMultiple($list) + $config_to_create;
}

View file

@ -193,19 +193,23 @@ class FileStorage implements StorageInterface {
* Implements Drupal\Core\Config\StorageInterface::listAll().
*/
public function listAll($prefix = '') {
// glob() silently ignores the error of a non-existing search directory,
// even with the GLOB_ERR flag.
$dir = $this->getCollectionDirectory();
if (!file_exists($dir)) {
if (!is_dir($dir)) {
return array();
}
$extension = '.' . static::getFileExtension();
// \GlobIterator on Windows requires an absolute path.
$files = new \GlobIterator(realpath($dir) . '/' . $prefix . '*' . $extension);
// glob() directly calls into libc glob(), which is not aware of PHP stream
// wrappers. Same for \GlobIterator (which additionally requires an absolute
// realpath() on Windows).
// @see https://github.com/mikey179/vfsStream/issues/2
$files = scandir($dir);
$names = array();
foreach ($files as $file) {
$names[] = $file->getBasename($extension);
if ($file[0] !== '.' && fnmatch($prefix . '*' . $extension, $file)) {
$names[] = basename($file, $extension);
}
}
return $names;
@ -299,13 +303,15 @@ class FileStorage implements StorageInterface {
$collections[] = $collection . '.' . $sub_collection;
}
}
// Check that the collection is valid by searching if for configuration
// Check that the collection is valid by searching it for configuration
// objects. A directory without any configuration objects is not a valid
// collection.
// \GlobIterator on Windows requires an absolute path.
$files = new \GlobIterator(realpath($directory . '/' . $collection) . '/*.' . $this->getFileExtension());
if (count($files)) {
$collections[] = $collection;
// @see \Drupal\Core\Config\FileStorage::listAll()
foreach (scandir($directory . '/' . $collection) as $file) {
if ($file[0] !== '.' && fnmatch('*.' . $this->getFileExtension(), $file)) {
$collections[] = $collection;
break;
}
}
}
}

View file

@ -195,10 +195,17 @@ class InstallStorage extends FileStorage {
// We don't have to use ExtensionDiscovery here because our list of
// extensions was already obtained through an ExtensionDiscovery scan.
$directory = $this->getComponentFolder($extension_object);
if (file_exists($directory)) {
$files = new \GlobIterator(\Drupal::root() . '/' . $directory . '/*' . $extension);
if (is_dir($directory)) {
// glob() directly calls into libc glob(), which is not aware of PHP
// stream wrappers. Same for \GlobIterator (which additionally requires
// an absolute realpath() on Windows).
// @see https://github.com/mikey179/vfsStream/issues/2
$files = scandir($directory);
foreach ($files as $file) {
$folders[$file->getBasename($extension)] = $directory;
if ($file[0] !== '.' && fnmatch('*' . $extension, $file)) {
$folders[basename($file, $extension)] = $directory;
}
}
}
}
@ -215,10 +222,17 @@ class InstallStorage extends FileStorage {
$extension = '.' . $this->getFileExtension();
$folders = array();
$directory = $this->getCoreFolder();
if (file_exists($directory)) {
$files = new \GlobIterator(\Drupal::root() . '/' . $directory . '/*' . $extension);
if (is_dir($directory)) {
// glob() directly calls into libc glob(), which is not aware of PHP
// stream wrappers. Same for \GlobIterator (which additionally requires an
// absolute realpath() on Windows).
// @see https://github.com/mikey179/vfsStream/issues/2
$files = scandir($directory);
foreach ($files as $file) {
$folders[$file->getBasename($extension)] = $directory;
if ($file[0] !== '.' && fnmatch('*' . $extension, $file)) {
$folders[basename($file, $extension)] = $directory;
}
}
}
return $folders;

View file

@ -42,13 +42,20 @@ trait SchemaCheckTrait {
* @param string $config_name
* The configuration name.
* @param array $config_data
* The configuration data.
* The configuration data, assumed to be data for a top-level config object.
*
* @return array|bool
* FALSE if no schema found. List of errors if any found. TRUE if fully
* valid.
*/
public function checkConfigSchema(TypedConfigManagerInterface $typed_config, $config_name, $config_data) {
// We'd like to verify that the top-level type is either config_base,
// config_entity, or a derivative. The only thing we can really test though
// is that the schema supports having langcode in it. So add 'langcode' to
// the data if it doesn't already exist.
if (!isset($config_data['langcode'])) {
$config_data['langcode'] = 'en';
}
$this->configName = $config_name;
if (!$typed_config->hasConfigSchema($config_name)) {
return FALSE;

View file

@ -73,7 +73,7 @@ class ConfigSchemaChecker implements EventSubscriberInterface {
$name = $saved_config->getName();
$data = $saved_config->get();
$checksum = crc32(serialize($data));
$checksum = hash('crc32b', serialize($data));
$exceptions = array(
// Following are used to test lack of or partial schema. Where partial
// schema is provided, that is explicitly tested in specific tests.