Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
autoload: Create a Drupal-specific core/autoload.php, and use it inst…
…ead of the core/vendor/autoload.php generated by Composer.

For the start, this will simply include Composer's autoload.php.
  • Loading branch information
donquixote committed Sep 17, 2013
1 parent baf8449 commit ace538d
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/authorize.php
Expand Up @@ -25,7 +25,7 @@
// Change the directory to the Drupal root.
chdir('..');

require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/autoload.php';

/**
* Global flag to identify update.php and authorize.php runs.
Expand Down
12 changes: 12 additions & 0 deletions core/autoload.php
@@ -0,0 +1,12 @@
<?php

/**
* @file
* Drupal-specific autoload.php to be used instead of the one generated by
* Composer.
* Having a Drupal-specific autoload.php makes it easier to use a ClassLoader
* implementation different from the one provided by Composer.
*/

// Use the autoload.php generated by Composer.
return require __DIR__ . '/vendor/autoload.php';
2 changes: 1 addition & 1 deletion core/includes/bootstrap.inc
Expand Up @@ -2731,7 +2731,7 @@ function drupal_classloader($class_loader = NULL) {
if (!isset($loader)) {

// Retrieve the Composer ClassLoader for loading classes.
$loader = include __DIR__ . '/../vendor/autoload.php';
$loader = include __DIR__ . '/../autoload.php';

// Register the class loader.
// When configured to use APC, the ApcClassLoader is registered instead.
Expand Down
2 changes: 1 addition & 1 deletion core/install.php
Expand Up @@ -8,7 +8,7 @@
// Change the directory to the Drupal root.
chdir('..');

require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/autoload.php';

/**
* Global flag to indicate the site is in installation mode.
Expand Down
2 changes: 1 addition & 1 deletion core/modules/statistics/statistics.php
Expand Up @@ -9,7 +9,7 @@
chdir('../../..');

// Load the Drupal bootstrap.
require_once dirname(dirname(__DIR__)) . '/vendor/autoload.php';
require_once dirname(dirname(__DIR__)) . '/autoload.php';
require_once dirname(dirname(__DIR__)) . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES);

Expand Down
2 changes: 1 addition & 1 deletion core/modules/system/tests/http.php
Expand Up @@ -18,6 +18,6 @@

// Change current directory to the Drupal root.
chdir('../../../..');
require_once dirname(dirname(dirname(__DIR__))) . '/vendor/autoload.php';
require_once dirname(dirname(dirname(__DIR__))) . '/autoload.php';
require_once dirname(dirname(dirname(__DIR__))) . '/includes/bootstrap.inc';
drupal_handle_request(TRUE);
2 changes: 1 addition & 1 deletion core/modules/system/tests/https.php
Expand Up @@ -20,6 +20,6 @@

// Change current directory to the Drupal root.
chdir('../../../..');
require_once dirname(dirname(dirname(__DIR__))) . '/vendor/autoload.php';
require_once dirname(dirname(dirname(__DIR__))) . '/autoload.php';
require_once dirname(dirname(dirname(__DIR__))) . '/includes/bootstrap.inc';
drupal_handle_request(TRUE);
2 changes: 1 addition & 1 deletion core/scripts/run-tests.sh
Expand Up @@ -4,7 +4,7 @@
* This script runs Drupal tests from command line.
*/

require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../autoload.php';

use Drupal\Core\StreamWrapper\PublicStream;

Expand Down
2 changes: 1 addition & 1 deletion core/tests/bootstrap.php
@@ -1,7 +1,7 @@
<?php

// Register the namespaces we'll need to autoload from.
$loader = require __DIR__ . "/../vendor/autoload.php";
$loader = require __DIR__ . "/../autoload.php";
$loader->add('Drupal\\Tests', __DIR__);

foreach (scandir(__DIR__ . "/../modules") as $module) {
Expand Down
2 changes: 1 addition & 1 deletion core/update.php
Expand Up @@ -22,7 +22,7 @@
// Change the directory to the Drupal root.
chdir('..');

require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/autoload.php';

// Exit early if an incompatible PHP version would cause fatal errors.
// The minimum version is specified explicitly, as DRUPAL_MINIMUM_PHP is not
Expand Down
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -8,7 +8,7 @@
* See COPYRIGHT.txt and LICENSE.txt files in the "core" directory.
*/

require_once __DIR__ . '/core/vendor/autoload.php';
require_once __DIR__ . '/core/autoload.php';
require_once __DIR__ . '/core/includes/bootstrap.inc';

try {
Expand Down

0 comments on commit ace538d

Please sign in to comment.