Commit 95fe74d5 authored by catch's avatar catch

Issue #2406681 by tstoeckler, hussainweb, alexpott, ParisLiakos, almaudoh,...

Issue #2406681 by tstoeckler, hussainweb, alexpott, ParisLiakos, almaudoh, tadityar: Add an autoload.php in the repo root to control the autoloader of front controllers
parent 78d22bc7
......@@ -138,7 +138,8 @@ DirectoryIndex index.php index.html index.htm
# custom modules or to run another PHP application in the same directory.
RewriteCond %{REQUEST_URI} !/core/modules/statistics/statistics.php$
# Deny access to any other PHP files that do not match the rules above.
RewriteRule "^.+/.*\.php$" - [F]
# Specifically, disallow autoload.php from being served directly.
RewriteRule "^(.+/.*|autoload)\.php$" - [F]
# Rules to correctly serve gzip compressed CSS and JS files.
# Requires both mod_rewrite and mod_headers to be enabled.
......
<?php
/**
* @file
* Includes the autoloader created by Composer.
*
* This file can be edited to change the autoloader if you are managing a
* project's dependencies using Composer. If Drupal code requires the
* autoloader, it should always be loaded using this file so that projects
* using Composer continue to work.
*
* @see composer.json
* @see index.php
* @see core/install.php
* @see core/rebuild.php
* @see core/modules/statistics/statistics.php
*/
return require_once __DIR__ . '/core/vendor/autoload.php';
......@@ -12,5 +12,11 @@
"config": {
"preferred-install": "dist",
"autoloader-suffix": "Drupal8"
},
"extra": {
"_readme": [
"By default Drupal loads the autoloader from ./core/vendor/autoload.php.",
"To change the autoloader you can edit ./autoload.php."
]
}
}
......@@ -30,7 +30,7 @@
// Change the directory to the Drupal root.
chdir('..');
$autoloader = require_once __DIR__ . '/vendor/autoload.php';
$autoloader = require_once 'autoload.php';
/**
* Global flag to identify update.php and authorize.php runs.
......
......@@ -27,6 +27,6 @@
}
// Start the installer.
$class_loader = require_once __DIR__ . '/vendor/autoload.php';
$class_loader = require_once 'autoload.php';
require_once __DIR__ . '/includes/install.core.inc';
install_drupal($class_loader);
......@@ -10,7 +10,7 @@
chdir('../../..');
$autoloader = require_once dirname(dirname(__DIR__)) . '/vendor/autoload.php';
$autoloader = require_once 'autoload.php';
$kernel = DrupalKernel::createFromRequest(Request::createFromGlobals(), $autoloader, 'prod');
$kernel->boot();
......
......@@ -10,7 +10,7 @@
chdir('../../../..');
$autoloader = require_once './core/vendor/autoload.php';
$autoloader = require_once 'autoload.php';
// Set a global variable to indicate a mock HTTP request.
$is_http_mock = !empty($_SERVER['HTTPS']);
......
......@@ -13,7 +13,7 @@
chdir('../../../..');
$autoloader = require_once './core/vendor/autoload.php';
$autoloader = require_once 'autoload.php';
// Set a global variable to indicate a mock HTTPS request.
$is_https_mock = empty($_SERVER['HTTPS']);
......
......@@ -20,7 +20,7 @@
// Change the directory to the Drupal root.
chdir('..');
$autoloader = require_once __DIR__ . '/vendor/autoload.php';
$autoloader = require_once 'autoload.php';
require_once __DIR__ . '/includes/utility.inc';
$request = Request::createFromGlobals();
......
......@@ -15,7 +15,7 @@
use Drupal\simpletest\Form\SimpletestResultsForm;
use Symfony\Component\HttpFoundation\Request;
$autoloader = require_once __DIR__ . '/../vendor/autoload.php';
$autoloader = require_once __DIR__ . '/../../autoload.php';
const SIMPLETEST_SCRIPT_COLOR_PASS = 32; // Green.
const SIMPLETEST_SCRIPT_COLOR_FAIL = 31; // Red.
......
......@@ -14,7 +14,7 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$autoloader = require_once __DIR__ . '/core/vendor/autoload.php';
$autoloader = require_once 'autoload.php';
try {
......
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