Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3174996
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3174996
Commits
ea2d59c6
Commit
ea2d59c6
authored
12 years ago
by
Katherine Bailey
Browse files
Options
Downloads
Patches
Plain Diff
Moving stuff around
parent
48ad4e8e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/includes/bootstrap.inc
+54
-28
54 additions, 28 deletions
core/includes/bootstrap.inc
core/lib/Drupal/Core/DrupalBundle.php
+4
-67
4 additions, 67 deletions
core/lib/Drupal/Core/DrupalBundle.php
core/lib/Drupal/Core/DrupalKernel.php
+4
-0
4 additions, 0 deletions
core/lib/Drupal/Core/DrupalKernel.php
with
62 additions
and
95 deletions
core/includes/bootstrap.inc
+
54
−
28
View file @
ea2d59c6
...
...
@@ -6,6 +6,7 @@
use
Symfony\Component\ClassLoader\ApcUniversalClassLoader
;
use
Symfony\Component\DependencyInjection\Container
;
use
Symfony\Component\DependencyInjection\ContainerBuilder
;
use
Symfony\Component\DependencyInjection\Definition
;
use
Symfony\Component\DependencyInjection\Reference
;
use
Symfony\Component\HttpFoundation\Request
;
use
Drupal\Core\Language\Language
;
...
...
@@ -2460,38 +2461,63 @@ function drupal_container(Container $reset = NULL) {
$container
=
$reset
;
}
elseif
(
!
isset
(
$container
))
{
// During a normal page request, as opposed to during installation, this will only
// ever happen if an error has been thrown. We need to build a new ContainerBuilder
// with only the language_interface service.
// Return a ContainerBuilder instance with the bare essentials needed for any
// full bootstrap regardless of whether there will be a DrupalKernel involved.
// This will get merged with the full Kernel-built Container on normal page
// requests.
$container
=
new
ContainerBuilder
();
// An interface language always needs to be available for t() and other
// functions. This default is overridden by drupal_language_initialize()
// during language negotiation.
// functions.
$container
->
register
(
LANGUAGE_TYPE_INTERFACE
,
'Drupal\\Core\\Language\\Language'
);
// If we are at the beginning of the installation process, we also need the config
// services.
if
(
variable_get
(
'install_task'
,
''
)
!=
'done'
)
{
// Register configuration storage dispatcher.
$container
->
setParameter
(
'config.storage.info'
,
array
(
'Drupal\Core\Config\DatabaseStorage'
=>
array
(
'connection'
=>
'default'
,
'target'
=>
'default'
,
'read'
=>
TRUE
,
'write'
=>
TRUE
,
),
'Drupal\Core\Config\FileStorage'
=>
array
(
'directory'
=>
config_get_config_directory
(),
'read'
=>
TRUE
,
'write'
=>
FALSE
,
),
// Register configuration storage dispatcher.
$container
->
setParameter
(
'config.storage.info'
,
array
(
'Drupal\Core\Config\DatabaseStorage'
=>
array
(
'connection'
=>
'default'
,
'target'
=>
'default'
,
'read'
=>
TRUE
,
'write'
=>
TRUE
,
),
'Drupal\Core\Config\FileStorage'
=>
array
(
'directory'
=>
config_get_config_directory
(),
'read'
=>
TRUE
,
'write'
=>
FALSE
,
),
));
$container
->
register
(
'config.storage.dispatcher'
,
'Drupal\Core\Config\StorageDispatcher'
)
->
addArgument
(
'%config.storage.info%'
);
// Register configuration object factory.
$container
->
register
(
'config.factory'
,
'Drupal\Core\Config\ConfigFactory'
)
->
addArgument
(
new
Reference
(
'config.storage.dispatcher'
));
// Ensure a language object is registered for each language type, whether the
// site is multilingual or not.
$types
=
language_types_get_all
();
if
(
language_multilingual
())
{
include_once
DRUPAL_ROOT
.
'/core/includes/language.inc'
;
foreach
(
$types
as
$type
)
{
$language
=
language_types_initialize
(
$type
);
// We cannot pass an object as a parameter to a method on a service.
$info
=
get_object_vars
(
$language
);
$container
->
set
(
$type
,
NULL
);
$container
->
register
(
$type
,
'Drupal\\Core\\Language\\Language'
)
->
addMethodCall
(
'extend'
,
array
(
$info
));
}
}
else
{
$info
=
variable_get
(
'language_default'
,
array
(
'langcode'
=>
'en'
,
'name'
=>
'English'
,
'direction'
=>
0
,
'weight'
=>
0
,
'locked'
=>
0
,
));
$
container
->
register
(
'config.storage.dispatcher'
,
'Drupal\Core\Config\StorageDispatcher'
)
->
addArgument
(
'%config.storage.info%'
);
// Register configuration object factory.
$container
->
register
(
'config.factory'
,
'Drupal\Core\Config\ConfigFactory'
)
->
addArgument
(
new
Reference
(
'config.storage.dispatcher'
));
$
info
[
'default'
]
=
TRUE
;
foreach
(
$types
as
$type
)
{
$container
->
set
(
$type
,
NULL
);
$container
->
register
(
$type
,
'Drupal\\Core\\Language\\Language'
)
->
addMethodCall
(
'extend'
,
array
(
$info
));
}
}
}
return
$container
;
...
...
This diff is collapsed.
Click to expand it.
core/lib/Drupal/Core/DrupalBundle.php
+
4
−
67
View file @
ea2d59c6
...
...
@@ -13,8 +13,6 @@ class DrupalBundle extends Bundle
{
public
function
build
(
ContainerBuilder
$container
)
{
parent
::
build
(
$container
);
$definitions
=
$this
->
getDefinitions
();
foreach
(
$definitions
as
$id
=>
$info
)
{
...
...
@@ -55,11 +53,12 @@ public function build(ContainerBuilder $container)
$definition
->
addMethodCall
(
$method
,
$args
);
}
if
(
isset
(
$info
[
'container_aware'
]))
{
$definition
->
addMethodCall
(
'setContainer'
,
array
(
new
Reference
(
'service_container'
)));
}
$container
->
setDefinition
(
$id
,
$definition
);
}
$this
->
registerLanguageServices
(
$container
);
// Add a compiler pass for registering event subscribers.
$container
->
addCompilerPass
(
new
RegisterKernelListenersPass
(),
PassConfig
::
TYPE_AFTER_REMOVING
);
}
...
...
@@ -69,31 +68,6 @@ public function build(ContainerBuilder $container)
*/
function
getDefinitions
()
{
return
array
(
// Register configuration storage dispatcher.
'config.storage.dispatcher'
=>
array
(
'class'
=>
'Drupal\Core\Config\StorageDispatcher'
,
'parameters'
=>
array
(
'conifg.storage.info'
=>
array
(
'Drupal\Core\Config\DatabaseStorage'
=>
array
(
'connection'
=>
'default'
,
'target'
=>
'default'
,
'read'
=>
TRUE
,
'write'
=>
TRUE
,
),
'Drupal\Core\Config\FileStorage'
=>
array
(
'directory'
=>
config_get_config_directory
(),
'read'
=>
TRUE
,
'write'
=>
FALSE
,
),
),
),
),
'config.factory'
=>
array
(
'class'
=>
'Drupal\Core\Config\ConfigFactory'
,
'references'
=>
array
(
'config.storage.dispatcher'
)
),
'dispatcher'
=>
array
(
'class'
=>
'Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher'
,
'references'
=>
array
(
...
...
@@ -156,7 +130,7 @@ function getDefinitions() {
'exception_controller'
=>
array
(
'class'
=>
'Drupal\Core\ExceptionController'
,
'references'
=>
array
(
'content_negotiation'
),
'
methods'
=>
array
(
'setContainer'
=>
array
(
'service_container'
))
'
container_aware'
=>
TRUE
,
),
'exception_listener'
=>
array
(
'class'
=>
'Symfony\Component\HttpKernel\EventListener\ExceptionListener'
,
...
...
@@ -177,41 +151,4 @@ function getDefinitions() {
),
);
}
/**
* Registers language-related services to the container.
*/
function
registerLanguageServices
(
$container
)
{
$types
=
language_types_get_all
();
// Ensure a language object is registered for each language type, whether the
// site is multilingual or not.
if
(
language_multilingual
())
{
include_once
DRUPAL_ROOT
.
'/core/includes/language.inc'
;
foreach
(
$types
as
$type
)
{
$language
=
language_types_initialize
(
$type
);
// We cannot pass an object as a parameter to a method on a service.
$info
=
get_object_vars
(
$language
);
$container
->
set
(
$type
,
NULL
);
$container
->
register
(
$type
,
'Drupal\\Core\\Language\\Language'
)
->
addMethodCall
(
'extend'
,
array
(
$info
));
}
}
else
{
$info
=
variable_get
(
'language_default'
,
array
(
'langcode'
=>
'en'
,
'name'
=>
'English'
,
'direction'
=>
0
,
'weight'
=>
0
,
'locked'
=>
0
,
));
$info
[
'default'
]
=
TRUE
;
foreach
(
$types
as
$type
)
{
$container
->
set
(
$type
,
NULL
);
$container
->
register
(
$type
,
'Drupal\\Core\\Language\\Language'
)
->
addMethodCall
(
'extend'
,
array
(
$info
));
}
}
}
}
This diff is collapsed.
Click to expand it.
core/lib/Drupal/Core/DrupalKernel.php
+
4
−
0
View file @
ea2d59c6
...
...
@@ -62,6 +62,10 @@ protected function initializeContainer()
protected
function
buildContainer
()
{
$container
=
$this
->
getContainerBuilder
();
if
(
$bootstrap_container
=
drupal_container
())
{
$container
->
merge
(
$bootstrap_container
);
}
foreach
(
$this
->
bundles
as
$bundle
)
{
$bundle
->
build
(
$container
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment