Merge branch '1400748-namespaces' into dbtngtng

8.0.x
Larry Garfield 2012-01-22 22:10:37 -06:00
commit 3f0cb723a0
49 changed files with 34 additions and 11 deletions

View File

@ -2294,7 +2294,7 @@ function _drupal_bootstrap_configuration() {
// Register explicit vendor namespaces.
$loader->registerNamespaces(array(
// All Symfony-borrowed code lives in /core/includes/Symfony.
'Symfony' => DRUPAL_ROOT . '/core/includes',
'Symfony' => DRUPAL_ROOT . '/core/vendor',
));
// Register the Drupal namespace for classes in core as a fallback.
// This allows to register additional namespaces within the Drupal namespace
@ -2304,7 +2304,7 @@ function _drupal_bootstrap_configuration() {
// register/overload namespaces in Drupal core.
$loader->registerNamespaceFallbacks(array(
// All Drupal-namespaced code in core lives in /core/includes/Drupal.
'Drupal' => DRUPAL_ROOT . '/core/includes',
'Drupal' => DRUPAL_ROOT . '/core/lib',
));
}
@ -3022,7 +3022,7 @@ function drupal_get_complete_schema($rebuild = FALSE) {
*/
function drupal_classloader() {
// Include the Symfony ClassLoader for loading PSR-0-compatible classes.
require_once DRUPAL_ROOT . '/core/includes/Symfony/Component/ClassLoader/UniversalClassLoader.php';
require_once DRUPAL_ROOT . '/core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php';
// By default, use the UniversalClassLoader which is best for development,
// as it does not break when code is moved on the file system. However, as it
@ -3034,7 +3034,7 @@ function drupal_classloader() {
switch (variable_get('autoloader_mode', 'default')) {
case 'apc':
if (function_exists('apc_store')) {
require_once DRUPAL_ROOT . '/core/includes/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php';
require_once DRUPAL_ROOT . '/core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php';
$loader = new ApcUniversalClassLoader('drupal.' . $GLOBALS['drupal_hash_salt']);
break;
}

View File

@ -18,10 +18,10 @@
* The cache bin for which the cache object should be returned, defaults to
* 'cache'.
*
* @return Drupal\Cache\CacheBackendInterface
* @return Drupal\Core\Cache\CacheBackendInterface
* The cache object associated with the specified bin.
*
* @see Drupal\Cache\CacheBackendInterface
* @see Drupal\Core\Cache\CacheBackendInterface
*/
function cache($bin = 'cache') {
// Temporary backwards compatibiltiy layer, allow old style prefixed cache
@ -34,7 +34,7 @@ function cache($bin = 'cache') {
if (!isset($cache_objects[$bin])) {
$class = variable_get('cache_class_' . $bin);
if (!isset($class)) {
$class = variable_get('cache_default_class', 'Drupal\Cache\DatabaseBackend');
$class = variable_get('cache_default_class', 'Drupal\Core\Cache\DatabaseBackend');
}
$cache_objects[$bin] = new $class($bin);
}

View File

@ -0,0 +1,8 @@
Drupal Components are independent libraries that do not depend on the rest of
Drupal in order to function. Components MAY depend on other Components, but
that is discouraged. Components MAY NOT depend on any code that is not part of
PHP itself or another Drupal component.
Each Component should be in its own namespace, and should be as self-contained
as possible. It should be possible to split a Component off to its own
repository and use as a stand-alone library, independently of Drupal.

View File

@ -5,7 +5,7 @@
* Definition of CacheBackendInterface.
*/
namespace Drupal\Cache;
namespace Drupal\Core\Cache;
/**
* Defines an interface for cache implementations.

View File

@ -5,7 +5,7 @@
* Definition of DatabaseBackend.
*/
namespace Drupal\Cache;
namespace Drupal\Core\Cache;
use Exception;

View File

@ -5,7 +5,7 @@
* Definition of InstallBackend.
*/
namespace Drupal\Cache;
namespace Drupal\Core\Cache;
use Exception;

View File

@ -5,7 +5,7 @@
* Definition of NullBackend.
*/
namespace Drupal\Cache;
namespace Drupal\Core\Cache;
/**
* Defines a stub cache implementation.

View File

@ -0,0 +1,6 @@
Code in the Core namespace represents Drupal subsystems provided by the base
system. These subsystems MAY depend on Drupal Components and other Subsystems,
but MAY NOT depend on any code in a module.
Each Component should be in its own namespace, and should be as self-contained
as possible.

3
core/tests/README.txt Normal file
View File

@ -0,0 +1,3 @@
This directory contains test case code for Drupal core Components and Subsystems.
Test classes should mirror the namespace of the code being tested. Supporting
code for test classes is allowed.

6
core/vendor/README.txt vendored Normal file
View File

@ -0,0 +1,6 @@
3rd party libraries provided by Drupal core should be placed in this directory.
They should not be modified from their original form at any time. They should
be changed only to keep up to date with upstream projects.
Code in this directory MAY be licensed under a GPL-compatible non-GPL license. If
so, it must be properly documented in COPYRIGHT.txt.