1 system.install system_install()

Implements hook_install().

File

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

Code

function system_install() {
  // Create tables.
  backdrop_install_schema('system');
  $versions = backdrop_get_schema_versions('system');
  $version = $versions ? max($versions) : SCHEMA_INSTALLED;
  backdrop_set_installed_schema_version('system', $version);

  // Set the public files path to the directory with the settings.php file.
  config_set('system.core', 'file_public_path', str_replace('./', '', conf_path() . '/files'));

  // Sets the path of system-appropriate temporary directory.
  config_set('system.core', 'file_temporary_path', file_directory_temp());

  // Clear out module list and hook implementation statics before calling
  // system_rebuild_theme_data().
  module_list(TRUE);
  module_implements_reset();

  // Ensure the schema versions are not based on a previous module list.
  backdrop_static_reset('drupal_get_schema_versions');

  // Load system theme data appropriately.
  system_rebuild_theme_data();

  // Enable the default theme.
  db_update('system')
    ->fields(array('status' => 1))
    ->condition('type', 'theme')
    ->condition('name', 'stark')
    ->execute();

  // Populate the cron key variable.
  $cron_key = backdrop_random_key();
  state_set('cron_key', $cron_key);

  // Set the site_mail to a sensible default. Note that installs via the
  // command line will not have a SERVER_NAME, and so the site mail must be
  // specified manually via the install.sh script --site-mail option.
  $site_mail = 'noreply@' . backdrop_get_bare_domain($_SERVER['SERVER_NAME']);
  if (valid_email_address($site_mail)) {
    config_set('system.core', 'site_mail', $site_mail);
  }
}