diff --git a/core/core.services.yml b/core/core.services.yml index 744fadc..f42cd8a 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -227,6 +227,12 @@ services: path.crud: class: Drupal\Core\Path\Path arguments: ['@database', '@path.alias_manager'] +# The argument to the hashing service defined in services.yml, to the +# constructor of PhpassHashedPassword is the log2 number of iterations for +# password stretching. This should increase by 1 every Drupal version in order +# to counteract increases in the speed and power of computers available to +# crack the hashes. The current password hashing method was introduced in +# Drupal 7 with a log2 count of 15. password: class: Drupal\Core\Password\PhpassHashedPassword arguments: [16] diff --git a/core/lib/Drupal/Core/Config/FileStorageFactory.php b/core/lib/Drupal/Core/Config/FileStorageFactory.php index 047b183..1768df4 100644 --- a/core/lib/Drupal/Core/Config/FileStorageFactory.php +++ b/core/lib/Drupal/Core/Config/FileStorageFactory.php @@ -6,6 +6,9 @@ namespace Drupal\Core\Config; +/** + * Provides a factory for creating config file storage objects. + */ class FileStorageFactory { /** diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php index 781a267..8734772 100644 --- a/core/lib/Drupal/Core/CoreBundle.php +++ b/core/lib/Drupal/Core/CoreBundle.php @@ -27,9 +27,12 @@ /** * Bundle class for mandatory core services. * - * This is where Drupal core registers all of its services to the Dependency - * Injection Container. Modules wishing to register services to the container - * should extend Symfony's Bundle class directly, not this class. + * This is where Drupal core registers all of its compiler passes. + * The service definitions themselves are in core/core.services.yml with a + * few, documented exceptions (typically, install requirements). + * + * Modules wishing to register services to the container should use + * modulename.services.yml in their respective directories. */ class CoreBundle extends Bundle { @@ -44,14 +47,6 @@ public function build(ContainerBuilder $container) { $this->registerTwig($container); $this->registerModuleHandler($container); - // The argument to the hashing service defined in services.yml, to the - // constructor of PhpassHashedPassword is the log2 number of iterations - // for password stretching. This should increase by 1 every Drupal version - // in order to counteract increases in the speed and power of computers - // available to crack the hashes. The current password hashing method was - // introduced in Drupal 7 with a log2 count of 15. - - $container->addCompilerPass(new RegisterMatchersPass()); $container->addCompilerPass(new RegisterRouteFiltersPass()); // Add a compiler pass for registering event subscribers. @@ -71,6 +66,8 @@ public function build(ContainerBuilder $container) { /** * Registers the module handler. + * + * As this is different during install, it needs to stay in PHP. */ protected function registerModuleHandler(ContainerBuilder $container) { // The ModuleHandler manages enabled modules and provides the ability to @@ -90,6 +87,8 @@ protected function registerModuleHandler(ContainerBuilder $container) { /** * Registers Twig services. + * + * This is used during install so it needs to stay in PHP (and static too). */ public static function registerTwig(ContainerBuilder $container) { $container->register('twig.loader.filesystem', 'Twig_Loader_Filesystem') diff --git a/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php b/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php index df65a35..bd69f0f 100644 --- a/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php +++ b/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php @@ -13,13 +13,12 @@ use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\Yaml\Parser; -use Symfony\Component\Yaml\Yaml; /** * YamlFileLoader loads YAML files service definitions. * * Drupal does not use Symfony's Config component, so this is a partial copy - * of \Symfony\Component\DependencyInjection\Loader\YamlFileLoade class not + * of \Symfony\Component\DependencyInjection\Loader\YamlFileLoader class not * depending on the Config component. */ class YamlFileLoader { @@ -33,6 +32,12 @@ public function __construct(ContainerBuilder $container) { $this->container = $container; } + /** + * Load a YAML file containing service definitions and kernel parameters. + * + * string $filename + * The name of the file to load. + */ public function load($filename) { $content = $this->loadFile($filename); $content += array('parameters' => array(), 'services' => array()); @@ -52,8 +57,12 @@ public function load($filename) { * Copied from \Symfony\Component\DependencyInjection\Loader\YamlFileLoader::parseDefinition(). * * @param string $id - * @param array $service + * The id of the service. + * @param string|array $service + * Either a string starting with a @ meaning this service is an alias or + * the array defining the service. * @param string $filename + * The name of the file, only used in error messages. * * @throws \InvalidArgumentException When tags are invalid */ @@ -163,9 +172,10 @@ protected function parseDefinition($id, $service, $filename) { /** * Loads a YAML file. * - * @param string ,$filename + * @param string $filename * - * @return array The file content + * @return array + * The file content. */ protected function loadFile($filename) { $parser = new Parser(); @@ -175,10 +185,13 @@ protected function loadFile($filename) { /** * Validates a YAML file. * - * @param mixed $content + * @param mixed $content + * The parsed YAML file. * @param string $filename + * The name of the file, only used for error messages. * * @return array + * The $content unchanged returned to allow for chaining this method. * * @throws \InvalidArgumentException When service file is not valid */ @@ -203,9 +216,13 @@ protected function validate($content, $filename) { * * Copied from \Symfony\Component\DependencyInjection\Loader\YamlFileLoader::parseDefinition(). * - * @param string $value + * @param mixed $value + * If a string, then it is either a plain string (for example a class + * name) or a reference to a service. If it's an array then it's a list of + * such strings. * - * @return Reference + * @return string|\Symfony\Component\DependencyInjection\Reference + * Either the string unchanged or the Reference object. */ protected function resolveServices($value) { if (is_array($value)) { diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 61de56c..884c99f 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -203,6 +203,10 @@ public function registerBundles() { $this->bundleClasses[] = $class; } } + // Add site specific or test YAMLs. + if (!empty($GLOBALS['conf']['container_yamls'])) { + $this->serviceYamls = array_merge($this->serviceYamls, $GLOBALS['conf']['container_yamls']); + } return $bundles; }