1 system.module system_init()

Implements hook_init().


core/modules/system/system.module, line 2419
Configuration system that lets administrators modify the workings of the site.


function system_init() {
  $path = backdrop_get_path('module', 'system');
  // Add the CSS for this module. These aren't in system.info, because they
  // need to be in the CSS_SYSTEM group rather than the CSS_DEFAULT group.
  backdrop_add_css('core/misc/normalize.css', array('group' => CSS_SYSTEM, 'every_page' => TRUE, 'weight' => -1000));
  backdrop_add_css($path . '/css/system.css', array('group' => CSS_SYSTEM, 'every_page' => TRUE));
  if (path_is_admin(current_path())) {
    backdrop_add_css($path . '/css/system.admin.css', array('group' => CSS_SYSTEM));
  backdrop_add_css($path . '/css/system.theme.css', array('group' => CSS_SYSTEM, 'every_page' => TRUE));
  backdrop_add_css($path . '/css/messages.theme.css', array('group' => CSS_SYSTEM, 'every_page' => TRUE));

  // Ignore replica database servers for this request.
  // In Backdrop's distributed database structure, new data is written to the
  // primary and then propagated to the replica servers. This means there is a
  // lag between when data is written to the primary and when it is available on
  // the replica. At these times, we will want to avoid using a replica server
  // temporarily. For example, if a user posts a new node then we want to
  // disable the replica server for that user temporarily to allow the replica
  // server to catch up. That way, that user will see their changes immediately
  // while for other users we still get the benefits of having a replica server,
  // just with slightly stale data. Code that wants to disable the replica
  // server should use the db_ignore_replica() function to set
  // $_SESSION['ignore_replica_server'] to the timestamp after which the replica
  // can be re-enabled.

  // @todo remove this backwards-compatible session variable wrapper in 2.0.
  // cspell:disable
  if (isset($_SESSION['ignore_slave_server'])) {
    $_SESSION['ignore_replica_server'] = $_SESSION['ignore_slave_server'];
    // cspell:enable

  if (isset($_SESSION['ignore_replica_server'])) {
    if ($_SESSION['ignore_replica_server'] >= REQUEST_TIME) {
      Database::ignoreTarget('default', 'replica');
    else {

  // Add CSS/JS files from module .info files.

  // Sanitizes file names during upload.
  if (!empty($_FILES['files']) && config_get('system.core', 'file_transliterate_uploads')) {
    // Figure out language, which is available in $_POST['langcode'] for node
    // forms.
    $langcode = NULL;
    if (!empty($_POST['langcode'])) {
      $languages = language_list();
      if (isset($languages[$_POST['langcode']])) {
        $langcode = $_POST['langcode'];
    foreach ($_FILES['files']['name'] as $field => $filename) {
      include_once BACKDROP_ROOT . '/core/includes/transliteration.inc';
      // Keep a copy of the unaltered file name.
      $_FILES['files']['orig_name'][$field] = $filename;
      $_FILES['files']['name'][$field] = transliteration_clean_filename($filename, $langcode);