You are here

function system_install in Drupal 8

Same name and namespace in other branches
  1. 5 modules/system/system.install \system_install()
  2. 6 modules/system/system.install \system_install()
  3. 7 modules/system/system.install \system_install()
  4. 9 core/modules/system/system.install \system_install()
  5. 10 core/modules/system/system.install \system_install()

Implements hook_install().

File

core/modules/system/system.install, line 1390
Install, update and uninstall functions for the system module.

Code

function system_install() {

  // Populate the cron key state variable.
  $cron_key = Crypt::randomBytesBase64(55);
  \Drupal::state()
    ->set('system.cron_key', $cron_key);

  // Populate the site UUID and default name (if not set).
  $site = \Drupal::configFactory()
    ->getEditable('system.site');
  $site
    ->set('uuid', \Drupal::service('uuid')
    ->generate());
  if (!$site
    ->get('name')) {
    $site
      ->set('name', 'Drupal');
  }
  $site
    ->save(TRUE);
}