1 uuid.inc protected Uuid::determinePlugin()

Determines the optimal implementation to use for generating UUIDs.

The selection is made based on the enabled PHP extensions with the most performant available option chosen.

Return value

The class name for the optimal UUID generator.:

File

core/includes/uuid.inc, line 77
Handling of universally unique identifiers.

Class

Uuid
Factory class for UUIDs.

Code

protected function determinePlugin() {
  static $plugin;
  if (!empty($plugin)) {
    return $plugin;
  }

  $plugin = 'UuidPhp';

  // 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')) {
    $plugin = 'UuidPecl';
  }
  // Try to use the COM implementation for Windows users.
  elseif (function_exists('com_create_guid')) {
    $plugin = 'UuidCom';
  }
  return $plugin;
}