Mercurial > hg > isophonics-drupal-site
comparison core/modules/node/node.install @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 7a779792577d |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
3 /** | 3 /** |
4 * @file | 4 * @file |
5 * Install, update and uninstall functions for the node module. | 5 * Install, update and uninstall functions for the node module. |
6 */ | 6 */ |
7 | 7 |
8 use Drupal\Core\Url; | |
8 use Drupal\Core\Database\Database; | 9 use Drupal\Core\Database\Database; |
9 use Drupal\Core\Field\BaseFieldDefinition; | 10 use Drupal\Core\Field\BaseFieldDefinition; |
10 use Drupal\user\RoleInterface; | 11 use Drupal\user\RoleInterface; |
11 | 12 |
12 /** | 13 /** |
28 | 29 |
29 $requirements['node_access'] = [ | 30 $requirements['node_access'] = [ |
30 'title' => t('Node Access Permissions'), | 31 'title' => t('Node Access Permissions'), |
31 'value' => $value, | 32 'value' => $value, |
32 'description' => t('If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Rebuilding will remove all privileges to content and replace them with permissions based on the current modules and settings. Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed, content will automatically use the new permissions. <a href=":rebuild">Rebuild permissions</a>', [ | 33 'description' => t('If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Rebuilding will remove all privileges to content and replace them with permissions based on the current modules and settings. Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed, content will automatically use the new permissions. <a href=":rebuild">Rebuild permissions</a>', [ |
33 ':rebuild' => \Drupal::url('node.configure_rebuild_confirm'), | 34 ':rebuild' => Url::fromRoute('node.configure_rebuild_confirm')->toString(), |
34 ]), | 35 ]), |
35 ]; | 36 ]; |
36 } | 37 } |
37 return $requirements; | 38 return $requirements; |
38 } | 39 } |
132 user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access content']); | 133 user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access content']); |
133 user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['access content']); | 134 user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['access content']); |
134 } | 135 } |
135 | 136 |
136 // Populate the node access table. | 137 // Populate the node access table. |
137 db_insert('node_access') | 138 Database::getConnection()->insert('node_access') |
138 ->fields([ | 139 ->fields([ |
139 'nid' => 0, | 140 'nid' => 0, |
140 'gid' => 0, | 141 'gid' => 0, |
141 'realm' => 'all', | 142 'realm' => 'all', |
142 'grant_view' => 1, | 143 'grant_view' => 1, |
265 // If multilingual usage, then rebuild node access. | 266 // If multilingual usage, then rebuild node access. |
266 if (count($modules) > 0 && \Drupal::languageManager()->isMultilingual()) { | 267 if (count($modules) > 0 && \Drupal::languageManager()->isMultilingual()) { |
267 node_access_needs_rebuild(TRUE); | 268 node_access_needs_rebuild(TRUE); |
268 } | 269 } |
269 } | 270 } |
271 | |
272 /** | |
273 * Set the 'owner' entity key and update the field. | |
274 */ | |
275 function node_update_8700() { | |
276 $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); | |
277 $entity_type = $definition_update_manager->getEntityType('node'); | |
278 $keys = $entity_type->getKeys(); | |
279 $keys['owner'] = 'uid'; | |
280 $entity_type->set('entity_keys', $keys); | |
281 $definition_update_manager->updateEntityType($entity_type); | |
282 $definition_update_manager->updateFieldStorageDefinition($definition_update_manager->getFieldStorageDefinition('uid', 'node')); | |
283 } |