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..5daf026 --- /dev/null +++ b/core/modules/node/lib/Drupal/node/NodeStorage.php @@ -0,0 +1,97 @@ + '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..2f12787 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,7 +50,12 @@ function node_install() { user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content')); user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content')); } +} +/** + * Implements hook_entity_schema_installed(). + */ +function node_entity_schema_installed(array $storages) { // Populate the node access table. db_insert('node_access') ->fields(array( diff --git a/core/modules/tracker/tracker.install b/core/modules/tracker/tracker.install index 5f3e5a0..3d16d60 100644 --- a/core/modules/tracker/tracker.install +++ b/core/modules/tracker/tracker.install @@ -16,9 +16,12 @@ 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); + $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(