CoreServiceProvider::alter

public CoreServiceProvider::alter(ContainerBuilder $container)

Alters the UUID service to use the most efficient method available.

Parameters

\Drupal\Core\DependencyInjection\ContainerBuilder $container: The container builder.

Overrides ServiceModifierInterface::alter

File

core/lib/Drupal/Core/CoreServiceProvider.php, line 111

Class

CoreServiceProvider
ServiceProvider class for mandatory core services.

Namespace

Drupal\Core

Code

public function alter(ContainerBuilder $container) {
  $uuid_service = $container->getDefinition('uuid');
  // Debian/Ubuntu uses the (broken) OSSP extension as their UUID
  // implementation. The OSSP implementation is not compatible with the
  // PECL functions.
  if (function_exists('uuid_create') && !function_exists('uuid_make')) {
    $uuid_service->setClass('Drupal\Component\Uuid\Pecl');
  }
  // Try to use the COM implementation for Windows users.
  elseif (function_exists('com_create_guid')) {
    $uuid_service->setClass('Drupal\Component\Uuid\Com');
  }
}
doc_Drupal
2016-10-29 08:59:02
Comments
Leave a Comment

Please login to continue.