[meta] Remove global variables

Created on 29 March 2013, over 12 years ago
Updated 16 June 2025, about 1 month ago

Problem/Motivation

Since #1833516: Add a new top-level global for settings.php - move things out of $conf / http://drupal.org/node/1882698 we should be using the new Settings API for low level and environment specific configuration.

Once this is complete then we can investigate whether or not these settings should actually live in a php file at all. This causes problems for other system's determining a Drupal instances configuration see #1954898: site-install fails to install over an existing site because the format of $config_directories in settings.php has changed for example of the problems this causes... preg_match on a php file to determine config directories sucks. For a related discussion see #1934152: FormBase::config() and ConfigFormBase::config() work entirely differently, may result in unexpected side effects .

The globals to convert are:

  // Export these settings.php variables to the global namespace.
  global $databases, $cookie_domain, $conf, $installed_profile, $db_prefix, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url, $config_directories;

Remaining tasks

📌 Task
Status

Postponed: needs info

Version

11.0 🔥

Component

base system

Created by

🇬🇧United Kingdom alexpott 🇪🇺🌍

Live updates comments and jobs are added and updated live.
  • API clean-up

    Refactors an existing API or subsystem for consistency, performance, modularization, flexibility, third-party integration, etc. May imply an API change. Frequently used during the Code Slush phase of the release cycle.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • 🇫🇷France andypost

    Current globals are

    core/globals.api.php:13:global $base_insecure_url;
    core/globals.api.php:22:global $base_path;
    core/globals.api.php:29:global $base_root;
    core/globals.api.php:36:global $base_secure_url;
    core/globals.api.php:43:global $base_url;
    core/globals.api.php:55:global $conf;
    core/globals.api.php:60:global $config;
    core/globals.api.php:67:global $install_state;
    

    and there's some usage which is related to #2218651: [meta] Make Drupal compatible with persistent app servers like ReactPHP, PHP-PM, PHPFastCGI, FrankenPHP, Swoole

    $ git grep -F 'global $'|wc -l
    70
    
Production build 0.71.5 2024