function user_revision_install in User Revision 8
Same name and namespace in other branches
- 7.2 user_revision.install \user_revision_install()
- 7 user_revision.install \user_revision_install()
Implements hook_install().
File
- ./
user_revision.install, line 30 - Install, update and uninstall functions for the user revision module.
Code
function user_revision_install() {
/* @var $user_storage \Drupal\Core\Entity\Sql\SqlContentEntityStorage */
$entity_type_manager = \Drupal::service('entity_type.manager');
$user_storage = $entity_type_manager
->getStorage('user');
$entity_type_manager
->onEntityTypeCreate($user_storage
->getEntityType());
$all_users =& drupal_static('user_revision_all_users', array());
foreach ($all_users as $id => $user) {
$user_entity = User::create($user);
$user_entity
->set('revision_uid', $id);
$user_entity
->save();
}
drupal_static_reset('user_revision_all_users');
}