Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -42,11 +42,25 @@ class BackendCompilerPass implements CompilerPassInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container) {
|
||||
$default_backend = $container->hasParameter('default_backend') ? $container->getParameter('default_backend') : NULL;
|
||||
// No default backend was configured, so continue as normal.
|
||||
if (!isset($default_backend)) {
|
||||
return;
|
||||
if ($container->hasParameter('default_backend')) {
|
||||
$default_backend = $container->getParameter('default_backend');
|
||||
// Opt out from the default backend.
|
||||
if (!$default_backend) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
$default_backend = $container->get('database')->driver();
|
||||
$container->set('database', NULL);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
// If Drupal is not installed or a test doesn't define database there
|
||||
// is nothing to override.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($container->findTaggedServiceIds('backend_overridable') as $id => $attributes) {
|
||||
// If the service is already an alias it is not the original backend, so
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\DependencyInjection\Compiler\ContextProvidersPass.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
|
||||
/**
|
||||
* Adds the context provider service IDs to the context manager.
|
||||
*/
|
||||
class ContextProvidersPass implements CompilerPassInterface {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Passes the service IDs of all context providers to the context repository.
|
||||
*/
|
||||
public function process(ContainerBuilder $container) {
|
||||
$context_providers = [];
|
||||
foreach (array_keys($container->findTaggedServiceIds('context_provider')) as $id) {
|
||||
$context_providers[] = $id;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('context.repository');
|
||||
$definition->addArgument($context_providers);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\DependencyInjection\Compiler\GuzzleMiddlewarePass.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
class GuzzleMiddlewarePass implements CompilerPassInterface {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container) {
|
||||
$middleware_ids = array_keys($container->findTaggedServiceIds('http_client_middleware'));
|
||||
$container->getDefinition('http_handler_stack_configurator')
|
||||
->addArgument($middleware_ids);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\DependencyInjection\Compiler\ProxyServicesPass.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\DependencyInjection\Compiler;
|
||||
|
||||
use Drupal\Component\ProxyBuilder\ProxyBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Replaces all services with a lazy flag.
|
||||
*/
|
||||
class ProxyServicesPass implements CompilerPassInterface {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container) {
|
||||
foreach ($container->getDefinitions() as $service_id => $definition) {
|
||||
if ($definition->isLazy()) {
|
||||
$proxy_class = ProxyBuilder::buildProxyClassName($definition->getClass());
|
||||
if (class_exists($proxy_class)) {
|
||||
// Copy the existing definition to a new entry.
|
||||
$definition->setLazy(FALSE);
|
||||
// Ensure that the service is accessible.
|
||||
$definition->setPublic(TRUE);
|
||||
$new_service_id = 'drupal.proxy_original_service.' . $service_id;
|
||||
$container->setDefinition($new_service_id, $definition);
|
||||
|
||||
$container->register($service_id, $proxy_class)
|
||||
->setArguments([new Reference('service_container'), $new_service_id]);
|
||||
}
|
||||
else {
|
||||
$class_name = $definition->getClass();
|
||||
|
||||
// Find the root namespace.
|
||||
$match = [];
|
||||
preg_match('/([a-zA-Z0-9_]+\\\\[a-zA-Z0-9_]+)\\\\(.+)/', $class_name, $match);
|
||||
$root_namespace = $match[1];
|
||||
|
||||
// Find the root namespace path.
|
||||
$root_namespace_dir = '[namespace_root_path]';
|
||||
|
||||
$namespaces = $container->getParameter('container.namespaces');
|
||||
|
||||
// Hardcode Drupal Core, because it is not registered.
|
||||
$namespaces['Drupal\Core'] = 'core/lib/Drupal/Core';
|
||||
|
||||
if (isset($namespaces[$root_namespace])) {
|
||||
$root_namespace_dir = $namespaces[$root_namespace];
|
||||
}
|
||||
|
||||
$message =<<<EOF
|
||||
|
||||
Missing proxy class '$proxy_class' for lazy service '$service_id'.
|
||||
Use the following command to generate the proxy class:
|
||||
php core/scripts/generate-proxy-class.php '$class_name' "$root_namespace_dir"
|
||||
|
||||
|
||||
EOF;
|
||||
trigger_error($message, E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue