diff --git a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php index ba453d3..257f86f 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php @@ -343,80 +343,74 @@ public function getTableMapping() { if (!isset($this->tableMapping)) { $table_mapping = array(); - // @todo Remove this. This is currently needed because some entity types - // declare a schema that does not match their field definitions. - // Therefore we use the legacy schema if it's still declared. This - // allows to iteratively enable the automatic schema generation for all - // entity types. - if (drupal_get_schema($this->baseTable)) { - $tables = array_filter(array($this->baseTable, $this->revisionTable, $this->dataTable, $this->revisionDataTable)); - foreach ($tables as $table) { - foreach (array_keys(drupal_get_schema($table)['fields']) as $column_name) { - $field_name = strstr($column_name, '__', TRUE) ?: $column_name; - $table_mapping[$table][$field_name][] = $column_name; - } - } - } - else { - $key_fields = array_filter(array($this->idKey, $this->revisionKey, $this->bundleKey, $this->uuidKey, $this->langcodeKey)); - - // Storable fields are single-value base fields that are not defined as - // computed and that do not specify a custom format. - // @todo Add support for multiple-value base fields. - $storable_definitions = array_filter($this->fieldDefinitions, function (FieldDefinitionInterface $field_definition) { - return !$field_definition->isComputed() && !$field_definition->hasCustomStorage() && !$field_definition->isMultiple(); - }); - $storable_fields = array_keys($storable_definitions); - - // @todo Provide automatic definitions for revision metadata fields. - // Rename 'log' to 'revision_log'. - $revision_metadata_fields = array_intersect(array('revision_timestamp', 'revision_uid', 'log'), $storable_fields); - $revisionable_filter_callback = function (FieldDefinitionInterface $definition) { return $definition->isRevisionable(); }; - - switch ($this->getLayoutType()) { - // The base layout stores all the base field values in the base table. - case static::LAYOUT_BASE: - $table_mapping[$this->baseTable] = $this->processFields(array_merge($key_fields, array_diff($storable_fields, $key_fields))); - break; - - // The base layout stores all the base field values in the base table. - // Revisionable fields are also stored in the revision table. - case static::LAYOUT_REVISION: - $table_mapping[$this->baseTable] = $this->processFields(array_merge($key_fields, array_diff($storable_fields, $key_fields, $revision_metadata_fields))); - $revision_key_fields = array($this->idKey, $this->revisionKey); - $revisionable_fields = array_keys(array_filter($storable_definitions, $revisionable_filter_callback)); - $table_mapping[$this->revisionTable] = $this->processFields(array_merge($revision_key_fields, $revisionable_fields)); - break; - - // Multilingual layouts store key field values in the base table. The - // other base field values are stored in the data table, no matter - // whether they are translatable or not. The data table holds also a - // denormalized copy of the bundle field value to allow for more - // performant queries. - case static::LAYOUT_MULTILINGUAL: - $table_mapping[$this->baseTable] = $this->processFields($key_fields); - $data_key_fields = array_diff($key_fields, array($this->uuidKey)); - $data_fields = array_diff($storable_fields, $key_fields); - $table_mapping[$this->dataTable] = $this->processFields(array_merge($data_key_fields, $data_fields)); - break; - - // The revisionable multilingual layout stores key field values in the - // base table, except for language, which is stored in the revision - // table along with revision metadata. The revision data table holds - // data field values for all the available revisions without - // denormalizations. - case static::LAYOUT_MULTILINGUAL_REVISION: - $table_mapping[$this->baseTable] = $this->processFields(array_diff($key_fields, array($this->langcodeKey))); - $data_key_fields = array_diff($key_fields, array($this->uuidKey)); - $data_fields = array_diff($storable_fields, $key_fields, $revision_metadata_fields); - $table_mapping[$this->dataTable] = $this->processFields(array_merge($data_key_fields, $data_fields)); - $table_mapping[$this->revisionTable] = $this->processFields(array_merge(array($this->idKey, $this->revisionKey, $this->langcodeKey), $revision_metadata_fields)); - $revision_data_key_fields = array_diff($key_fields, array($this->bundleKey, $this->uuidKey)); - $revisionable_fields = array_keys(array_filter($storable_definitions, $revisionable_filter_callback)); - $revision_data_fields = array_diff($revisionable_fields, $revision_metadata_fields, $revision_data_key_fields); - $table_mapping[$this->revisionDataTable] = $this->processFields(array_merge($revision_data_key_fields, $revision_data_fields)); - break; - } + $key_fields = array_filter(array($this->idKey, $this->revisionKey, $this->bundleKey, $this->uuidKey, $this->langcodeKey)); + + // Storable fields are single-value base fields that are not defined as + // computed and that do not specify a custom format. + // @todo Add support for multiple-value base fields. + $storable_definitions = array_filter($this->fieldDefinitions, function (FieldDefinitionInterface $field_definition) { + return !$field_definition->isComputed() && !$field_definition->hasCustomStorage() && !$field_definition->isMultiple(); + }); + $storable_fields = array_keys($storable_definitions); + + // @todo Provide automatic definitions for revision metadata fields. + // Rename 'log' to 'revision_log'. + $revision_metadata_fields = array_intersect(array('revision_timestamp', 'revision_uid', 'log'), $storable_fields); + $revisionable_filter_callback = function (FieldDefinitionInterface $definition) { return $definition->isRevisionable(); }; + + switch ($this->getLayoutType()) { + // The base layout stores all the base field values in the base table. + case static::LAYOUT_BASE: + $table_mapping[$this->baseTable] = $this->processFields(array_merge($key_fields, array_diff($storable_fields, $key_fields))); + break; + + // The base layout stores all the base field values in the base table. + // Revisionable fields are also stored in the revision table. + case static::LAYOUT_REVISION: + $table_mapping[$this->baseTable] = $this->processFields(array_merge($key_fields, array_diff($storable_fields, $key_fields, $revision_metadata_fields))); + $revision_key_fields = array($this->idKey, $this->revisionKey); + $revisionable_fields = array_keys(array_filter($storable_definitions, $revisionable_filter_callback)); + $table_mapping[$this->revisionTable] = $this->processFields(array_merge($revision_key_fields, $revisionable_fields)); + break; + + // Multilingual layouts store key field values in the base table. The + // other base field values are stored in the data table, no matter + // whether they are translatable or not. The data table holds also a + // denormalized copy of the bundle field value to allow for more + // performant queries. + case static::LAYOUT_MULTILINGUAL: + $table_mapping[$this->baseTable] = $this->processFields($key_fields); + $data_key_fields = array_diff($key_fields, array($this->uuidKey)); + $data_fields = array_diff($storable_fields, $key_fields); + $table_mapping[$this->dataTable] = $this->processFields(array_merge($data_key_fields, $data_fields)); + // Add the denormalized 'default_langcode' field to the mapping. As it + // does not correspond to a field definition we add it with an empty + // key. + $table_mapping[$this->dataTable][''] = array('default_langcode'); + break; + + // The revisionable multilingual layout stores key field values in the + // base table, except for language, which is stored in the revision + // table along with revision metadata. The revision data table holds + // data field values for all the available revisions without + // denormalizations. + case static::LAYOUT_MULTILINGUAL_REVISION: + $table_mapping[$this->baseTable] = $this->processFields(array_diff($key_fields, array($this->langcodeKey))); + $data_key_fields = array_diff($key_fields, array($this->uuidKey)); + $data_fields = array_diff($storable_fields, $key_fields, $revision_metadata_fields); + $table_mapping[$this->dataTable] = $this->processFields(array_merge($data_key_fields, $data_fields)); + // Add the denormalized 'default_langcode' field to the mapping. As it + // does not correspond to a field definition we add it with an empty + // key. + $table_mapping[$this->dataTable][''] = array('default_langcode'); + $table_mapping[$this->revisionTable] = $this->processFields(array_merge(array($this->idKey, $this->revisionKey, $this->langcodeKey), $revision_metadata_fields)); + $revision_data_key_fields = array_diff($key_fields, array($this->bundleKey, $this->uuidKey)); + $revisionable_fields = array_keys(array_filter($storable_definitions, $revisionable_filter_callback)); + $revision_data_fields = array_diff($revisionable_fields, $revision_metadata_fields, $revision_data_key_fields); + $table_mapping[$this->revisionDataTable] = $this->processFields(array_merge($revision_data_key_fields, $revision_data_fields)); + // See above. + $table_mapping[$this->revisionDataTable][''] = array('default_langcode'); + break; } $this->tableMapping = $table_mapping; diff --git a/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php b/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php index 90e533a..2c19d07 100644 --- a/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php +++ b/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php @@ -72,49 +72,47 @@ public function getSchema() { } if (!isset($this->schema[$this->entityType->id()])) { - // @todo Remove this. This is currently needed because some entity types - // declare a schema that does not match their field definitions. - // Therefore we use the legacy schema if it's still declared. This - // allows to iteratively enable the automatic schema generation for all - // entity types. - if ($base_schema = drupal_get_schema($tables['base_table'])) { - $schema[$tables['base_table']] = $base_schema; - unset($tables['base_table']); - foreach ($tables as $table) { - $schema[$table] = drupal_get_schema($table); - } + // Initialize the table schema. + $schema[$tables['base_table']] = $this->initializeBaseTable(); + if (isset($tables['revision_table'])) { + $schema[$tables['revision_table']] = $this->initializeRevisionTable(); + } + if (isset($tables['data_table'])) { + $schema[$tables['data_table']] = $this->initializeDataTable(); + } + if (isset($tables['revision_data_table'])) { + $schema[$tables['revision_data_table']] = $this->initializeRevisionDataTable(); } - else { - // Initialize the table schema. - $schema[$tables['base_table']] = $this->initializeBaseTable(); - if (isset($tables['revision_table'])) { - $schema[$tables['revision_table']] = $this->initializeRevisionTable(); - } - if (isset($tables['data_table'])) { - $schema[$tables['data_table']] = $this->initializeDataTable(); - } - if (isset($tables['revision_data_table'])) { - $schema[$tables['revision_data_table']] = $this->initializeRevisionDataTable(); - } - // Add the schema from field definitions. - foreach ($this->storage->getTableMapping() as $table => $field_names) { - foreach ($field_names as $field_name => $column_names) { + // Add the schema from field definitions. + foreach ($this->storage->getTableMapping() as $table => $field_names) { + foreach ($field_names as $field_name => $column_names) { + // If there are table fields which do not correspond to entity field + // definitions, those are stored with the '' key. + if ($field_name !== '') { $this->addFieldSchema($schema[$table], $field_name, $column_names); } + else { + foreach ($column_names as $column_name) { + // Support hardcoded non-entity-field table fields. + if ($column_name == 'default_langcode') { + $this->addDefaultLangcodeSchema($schema[$table]); + } + } + } } + } - // Process tables after having gathered field information. - $this->processBaseTable($schema[$tables['base_table']]); - if (isset($tables['revision_table'])) { - $this->processRevisionTable($schema[$tables['revision_table']]); - } - if (isset($tables['data_table'])) { - $this->processDataTable($schema[$tables['data_table']]); - } - if (isset($tables['revision_data_table'])) { - $this->processRevisionDataTable($schema[$tables['revision_data_table']]); - } + // Process tables after having gathered field information. + $this->processBaseTable($schema[$tables['base_table']]); + if (isset($tables['revision_table'])) { + $this->processRevisionTable($schema[$tables['revision_table']]); + } + if (isset($tables['data_table'])) { + $this->processDataTable($schema[$tables['data_table']]); + } + if (isset($tables['revision_data_table'])) { + $this->processRevisionDataTable($schema[$tables['revision_data_table']]); } $this->schema[$this->entityType->id()] = $schema; @@ -262,11 +260,14 @@ public function getFieldColumnName(FieldDefinitionInterface $definition, $column /** * Returns the schema for the 'default_langcode' metadata field. * + * @param array $schema + * The table schema to add the field schema to, passed by reference. + * * @return array * A schema field array for the 'default_langcode' metadata field. */ - protected function getDefaultLangcodeSchema() { - return array( + protected function addDefaultLangcodeSchema(&$schema) { + $schema['fields']['default_langcode'] = array( 'description' => 'Boolean indicating whether field values are in the default entity language.', 'type' => 'int', 'not null' => TRUE, @@ -281,14 +282,15 @@ protected function getDefaultLangcodeSchema() { * A partial schema array for the base table. */ protected function initializeBaseTable() { - $key = $this->entityType->getKey('uuid') ?: 'uuid'; $schema = array( 'description' => "The base table for {$this->entityType->id()} entities.", 'primary key' => array($this->entityType->getKey('id')), - 'unique keys' => array( - $this->getEntityIndexName($key) => array($key), - ), ); + if ($key = $this->entityType->getKey('uuid')) { + $schema['unique keys'] = array( + $this->getEntityIndexName($key) => array($key), + ); + } if ($this->storage->getLayoutType() & ContentEntityDatabaseStorage::LAYOUT_REVISION) { $key = $this->entityType->getKey('revision'); @@ -306,9 +308,11 @@ protected function initializeBaseTable() { */ protected function initializeRevisionTable() { $id_key = $this->entityType->getKey('id'); + $revision_key = $this->entityType->getKey('revision'); + $schema = array( 'description' => "The revision table for {$this->entityType->id()} entities.", - 'primary key' => array($this->entityType->getKey('revision')), + 'primary key' => array($revision_key), 'foreign keys' => array( $id_key => array( 'table' => $this->entityType->getBaseTable(), @@ -317,15 +321,12 @@ protected function initializeRevisionTable() { ), ); - $key = $this->entityType->getKey('id'); - $schema['indexes'][$this->getEntityIndexName($key)] = array($key); + $schema['indexes'][$this->getEntityIndexName($id_key)] = array($id_key); - $key = $this->entityType->getKey('revision'); - $schema['indexes'][$this->getEntityIndexName($key)] = array($key); + $schema['indexes'][$this->getEntityIndexName($revision_key)] = array($revision_key); if (isset($this->fieldDefinitions['revision_uid'])) { - $key = 'revision_uid'; - $schema['indexes'][$this->getEntityIndexName($key)] = array($key); + $schema['indexes'][$this->getEntityIndexName('revision_uid')] = array('revision_uid'); } return $schema; @@ -369,6 +370,7 @@ protected function initializeDataTable() { protected function initializeRevisionDataTable() { $id_key = $this->entityType->getKey('id'); $revision_key = $this->entityType->getKey('revision'); + $schema = array( 'description' => "The revision data table for {$this->entityType->id()} entities.", // @todo Use the language entity key when https://drupal.org/node/2143729 @@ -386,8 +388,7 @@ protected function initializeRevisionDataTable() { ), ); - $key = $this->entityType->getKey('id'); - $schema['indexes'][$this->getEntityIndexName($key)] = array($key); + $schema['indexes'][$this->getEntityIndexName($id_key)] = array($id_key); return $schema; } @@ -428,7 +429,6 @@ protected function processRevisionTable(array &$schema) { * A partial schema array for the base table. */ protected function processDataTable(array &$schema) { - $schema['fields']['default_langcode'] = $this->getDefaultLangcodeSchema(); } /** @@ -441,7 +441,6 @@ protected function processDataTable(array &$schema) { * A partial schema array for the base table. */ protected function processRevisionDataTable(array &$schema) { - $schema['fields']['default_langcode'] = $this->getDefaultLangcodeSchema(); } /** diff --git a/core/modules/forum/forum.install b/core/modules/forum/forum.install index b5f0e0a..8dbaff3 100644 --- a/core/modules/forum/forum.install +++ b/core/modules/forum/forum.install @@ -34,16 +34,6 @@ function forum_install() { ), ))->save(); - // Create a default forum so forum posts can be created. - $term = entity_create('taxonomy_term', array( - 'name' => t('General discussion'), - 'description' => '', - 'parent' => array(0), - 'vid' => 'forums', - 'forum_container' => 0, - )); - $term->save(); - // Create the instance on the bundle. entity_create('field_instance_config', array( 'field_name' => 'taxonomy_forums', @@ -86,6 +76,22 @@ function forum_install() { } /** + * Implements hook_entity_schema_installed(). + */ +function forum_entity_schema_installed(array $storages) { + if (isset($installed['taxonomy_term'])) { + // Create a default forum so forum posts can be created. + $storages['taxonomy_term']->create(array( + 'name' => t('General discussion'), + 'description' => '', + 'parent' => array(0), + 'vid' => 'forums', + 'forum_container' => 0, + ))->save(); + } +} + +/** * Implements hook_uninstall(). */ function forum_uninstall() { diff --git a/core/modules/node/lib/Drupal/node/Entity/Node.php b/core/modules/node/lib/Drupal/node/Entity/Node.php index 0e1d20f..94bfc7e 100644 --- a/core/modules/node/lib/Drupal/node/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Entity/Node.php @@ -24,6 +24,7 @@ * label = @Translation("Content"), * bundle_label = @Translation("Content type"), * controllers = { + * "storage" = "Drupal\node\NodeStorage", * "view_builder" = "Drupal\node\NodeViewBuilder", * "access" = "Drupal\node\NodeAccessController", * "form" = { diff --git a/core/modules/node/lib/Drupal/node/NodeStorage.php b/core/modules/node/lib/Drupal/node/NodeStorage.php new file mode 100644 index 0000000..7f52a36 --- /dev/null +++ b/core/modules/node/lib/Drupal/node/NodeStorage.php @@ -0,0 +1,100 @@ + 'Identifies which realm/grant pairs a user must possess in order to view, update, or delete specific nodes.', + 'fields' => array( + 'nid' => array( + 'description' => 'The {node}.nid this record affects.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'langcode' => array( + 'description' => 'The {language}.langcode of this node.', + 'type' => 'varchar', + 'length' => 12, + 'not null' => TRUE, + 'default' => '', + ), + 'fallback' => array( + 'description' => 'Boolean indicating whether this record should be used as a fallback if a language condition is not provided.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 1, + ), + 'gid' => array( + 'description' => "The grant ID a user must possess in the specified realm to gain this row's privileges on the node.", + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'realm' => array( + 'description' => 'The realm in which the user must possess the grant ID. Each node access node can define one or more realms.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'grant_view' => array( + 'description' => 'Boolean indicating whether a user with the realm/grant pair can view this node.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'grant_update' => array( + 'description' => 'Boolean indicating whether a user with the realm/grant pair can edit this node.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'grant_delete' => array( + 'description' => 'Boolean indicating whether a user with the realm/grant pair can delete this node.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + ), + 'primary key' => array('nid', 'gid', 'realm', 'langcode'), + 'foreign keys' => array( + 'affected_node' => array( + 'table' => 'node', + 'columns' => array('nid' => 'nid'), + ), + ), + ); + + return $schema; + } + +} diff --git a/core/modules/node/node.install b/core/modules/node/node.install index 2634bb2..83e48ba 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -36,86 +36,6 @@ function node_requirements($phase) { } /** - * Implements hook_schema(). - */ -function node_schema() { - - $schema['node_access'] = array( - 'description' => 'Identifies which realm/grant pairs a user must possess in order to view, update, or delete specific nodes.', - 'fields' => array( - 'nid' => array( - 'description' => 'The {node}.nid this record affects.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - ), - 'langcode' => array( - 'description' => 'The {language}.langcode of this node.', - 'type' => 'varchar', - 'length' => 12, - 'not null' => TRUE, - 'default' => '', - ), - 'fallback' => array( - 'description' => 'Boolean indicating whether this record should be used as a fallback if a language condition is not provided.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 1, - ), - 'gid' => array( - 'description' => "The grant ID a user must possess in the specified realm to gain this row's privileges on the node.", - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - ), - 'realm' => array( - 'description' => 'The realm in which the user must possess the grant ID. Each node access node can define one or more realms.', - 'type' => 'varchar', - 'length' => 255, - 'not null' => TRUE, - 'default' => '', - ), - 'grant_view' => array( - 'description' => 'Boolean indicating whether a user with the realm/grant pair can view this node.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - 'size' => 'tiny', - ), - 'grant_update' => array( - 'description' => 'Boolean indicating whether a user with the realm/grant pair can edit this node.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - 'size' => 'tiny', - ), - 'grant_delete' => array( - 'description' => 'Boolean indicating whether a user with the realm/grant pair can delete this node.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - 'size' => 'tiny', - ), - ), - 'primary key' => array('nid', 'gid', 'realm', 'langcode'), - 'foreign keys' => array( - 'affected_node' => array( - 'table' => 'node', - 'columns' => array('nid' => 'nid'), - ), - ), - ); - - return $schema; -} - -/** * Implements hook_install(). */ function node_install() { @@ -130,18 +50,25 @@ function node_install() { user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content')); user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content')); } +} - // Populate the node access table. - db_insert('node_access') - ->fields(array( - 'nid' => 0, - 'gid' => 0, - 'realm' => 'all', - 'grant_view' => 1, - 'grant_update' => 0, - 'grant_delete' => 0, - )) - ->execute(); +/** + * Implements hook_entity_schema_installed(). + */ +function node_entity_schema_installed(array $storages) { + if (isset($storages['node'])) { + // Populate the node access table. + db_insert('node_access') + ->fields(array( + 'nid' => 0, + 'gid' => 0, + 'realm' => 'all', + 'grant_view' => 1, + 'grant_update' => 0, + 'grant_delete' => 0, + )) + ->execute(); + } } /** diff --git a/core/modules/tracker/tracker.install b/core/modules/tracker/tracker.install index 5f3e5a0..2a72272 100644 --- a/core/modules/tracker/tracker.install +++ b/core/modules/tracker/tracker.install @@ -16,12 +16,18 @@ function tracker_uninstall() { * Implements hook_install(). */ function tracker_install() { - $max_nid = db_query('SELECT MAX(nid) FROM {node}')->fetchField(); - if ($max_nid != 0) { - \Drupal::state()->set('tracker.index_nid', $max_nid); - // To avoid timing out while attempting to do a complete indexing, we - // simply call our cron job to remove stale records and begin the process. - tracker_cron(); + // @todo Is there some way to avoid this check? + if (\Drupal::database()->schema()->tableExists('node')) { + $nids = \Drupal::entityQuery('node') + ->sort('nid', 'DESC') + ->range(0, 1) + ->execute(); + if (!empty($nids)) { + \Drupal::state()->set('tracker.index_nid', reset($nids)); + // To avoid timing out while attempting to do a complete indexing, we + // simply call our cron job to remove stale records and begin the process. + tracker_cron(); + } } } diff --git a/core/modules/user/user.install b/core/modules/user/user.install index 143cfb2..e5b9161 100644 --- a/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -10,8 +10,8 @@ /** * Implements hook_entity_schema_installed(). */ -function user_entity_schema_installed($installed) { - if (isset($installed['user']) && $installed['user'] instanceof ContentEntityDatabaseStorage) { +function user_entity_schema_installed(array $storages) { + if (isset($storages['user'])) { // Insert a row for the anonymous user. db_insert('users') ->fields(array(