Commit d1e52e00 authored by katbailey's avatar katbailey
Browse files

Various cleanups

parent f8e189ed
......@@ -6,7 +6,6 @@
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;
......
......@@ -275,7 +275,7 @@ function install_begin_request(&$install_state) {
include_once DRUPAL_ROOT . '/core/includes/session.inc';
// Set up $language, so t() caller functions will still work.
//drupal_language_initialize();
drupal_language_initialize();
require_once DRUPAL_ROOT . '/core/includes/ajax.inc';
// Override the module list with a minimal set of modules.
......
......@@ -247,23 +247,16 @@ function update_prepare_d8_language() {
// Update the 'language_default' system variable, if configured.
$language_default = variable_get('language_default');
if (!empty($language_default) && isset($language_default->language)) {
$language_default->langcode = $language_default->language;
if (!empty($language_default) && (isset($language_default->langcode) || isset($language_default->language))) {
if (!isset($language_default->langcode)) {
$language_default->langcode = $language_default->language;
}
unset($language_default->language);
// In D8, the 'language_default' is not anymore an object, but an array,
// so make sure that the new value that is saved into this variable is an
// array.
variable_set('language_default', (array) $language_default);
}
else {
variable_set('language_default', array(
'langcode' => 'en',
'name' => 'English',
'direction' => 0,
'weight' => 0,
'locked' => 0,
));
}
// Adds the locked column and saves the special languages.
if (!db_field_exists('language', 'locked')) {
......
......@@ -19,6 +19,7 @@ class CoreBundle extends Bundle
{
public function build(ContainerBuilder $container) {
// Add a 'request' scope for services that depend on the Request object.
$container->addScope(new Scope('request'));
$container->register('dispatcher', 'Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher')
......
......@@ -30,10 +30,6 @@ public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig:
public function compile() {
$this->compiler->compile($this);
$this->parameterBag->resolve();
// TODO: The line below is commented out because there is code that calls
// the set() method on the container after it has been built - that method
// throws an exception if the container's parameters have been frozen.
//$this->parameterBag = new FrozenParameterBag($this->parameterBag->all());
}
}
......@@ -28,7 +28,8 @@ public function registerBundles() {
$modules = array_keys(system_list('module_enabled'));
foreach ($modules as $module) {
$class = "\Drupal\\{$module}\\{$module}Bundle";
$camelized = ContainerBuilder::camelize($module);
$class = "\Drupal\\{$module}\\{$camelized}Bundle";
if (class_exists($class)) {
$bundles[] = new $class();
}
......@@ -41,6 +42,9 @@ public function registerBundles() {
* Initializes the service container.
*/
protected function initializeContainer() {
// @todo We should be compiling the container and dumping to php so we don't
// have to recompile every time. There is a separate issue for this, see
// http://drupal.org/node/1668892.
$this->container = $this->buildContainer();
$this->container->set('kernel', $this);
drupal_container($this->container);
......@@ -73,10 +77,14 @@ protected function getContainerBuilder() {
return new ContainerBuilder(new ParameterBag($this->getKernelParameters()));
}
/**
* This method is part of the KernelInterface interface, but takes an object
* implementing LoaderInterface as its only parameter. This is part of the
* Config compoment from Symfony, which is not provided by Drupal core.
*
* Modules wishing to provide an extension to this class which uses this
* method are responsible for ensuring the Config component exists.
*/
public function registerContainerConfiguration(LoaderInterface $loader) {
// We have to define this method because it's not defined in the base class
// but is part of the KernelInterface interface. However, the LoaderInterface
// class is part of the config component, which we are not using, so this
// is badness :-/
}
}
......@@ -17,9 +17,6 @@
/**
* This HttpKernel is used to manage scope changes of the DI container.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class HttpKernel extends BaseHttpKernel
{
......
......@@ -14,7 +14,7 @@
*/
class LanguageManager {
private $container;
private $request;
public function __construct(Request $request = NULL) {
$this->request = $request;
......
......@@ -47,6 +47,9 @@ function testUninstallProcess() {
);
language_save($language);
// Make sure the language interface object gets freshly initialized.
drupal_static_reset('language_manager');
// Check the UI language.
drupal_language_initialize();
$this->assertEqual(language_manager(LANGUAGE_TYPE_INTERFACE)->langcode, $this->langcode, t('Current language: %lang', array('%lang' => language_manager(LANGUAGE_TYPE_INTERFACE)->langcode)));
......
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