Commit 3241695d authored by catch's avatar catch

Issue #1814086 by samhassell, fgm: Convert autoloader_mode in...

Issue #1814086 by samhassell, fgm: Convert autoloader_mode in drupal_classloader() to its own global.
parent 189132a2
......@@ -719,7 +719,7 @@ function drupal_settings_initialize() {
global $base_url, $base_path, $base_root, $script_path;
// Export these settings.php variables to the global namespace.
global $databases, $cookie_domain, $conf, $installed_profile, $update_free_access, $db_url, $db_prefix, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url, $config_directories;
global $databases, $cookie_domain, $conf, $installed_profile, $update_free_access, $class_loader, $db_url, $db_prefix, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url, $config_directories;
$conf = array();
// Make conf_path() available as local variable in settings.php.
......@@ -2999,9 +2999,8 @@ function ip_address() {
* Initializes and returns the class loader.
*
* The class loader is responsible for lazy-loading all PSR-0 compatible
* classes, interfaces, and traits (PHP 5.4 and later). Its only dependencies
* are DRUPAL_ROOT and variable_get(). Otherwise it may be called as early as
* possible.
* classes, interfaces, and traits (PHP 5.4 and later). It's only dependency
* is DRUPAL_ROOT. Otherwise it may be called as early as possible.
*
* @return Symfony\Component\ClassLoader\UniversalClassLoader
* A UniversalClassLoader class instance (or extension thereof).
......@@ -3013,11 +3012,12 @@ function drupal_classloader() {
static $loader;
if (!isset($loader)) {
global $class_loader;
// Include the Symfony ClassLoader for loading PSR-0-compatible classes.
require_once DRUPAL_ROOT . '/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php';
// @todo Use a cleaner way than variable_get() to switch autoloaders.
switch (variable_get('autoloader_mode', 'default')) {
switch ($class_loader) {
case 'apc':
if (function_exists('apc_store')) {
require_once DRUPAL_ROOT . '/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php';
......
......@@ -246,6 +246,20 @@
*/
$drupal_hash_salt = '';
/**
* Class Loader.
*
* By default, Drupal uses the Symfony UniversalClassLoader which is best for
* development, as it does not break when code is moved on the file system.
* The APC classloader provides better performance and is recommended for
* production sites.
*
* Examples:
* $class_loader = 'apc'
* $class_loader = 'default'
*/
# $class_loader = 'apc';
/**
* Location of the site configuration files.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment