class MongodbConfigStorageBootstrap in MongoDB 8
Hierarchy
- class \Drupal\mongodb\MongodbConfigStorage implements StorageInterface
- class \Drupal\mongodb\MongodbConfigStorageBootstrap
Expanded class hierarchy of MongodbConfigStorageBootstrap
1 file declares its use of MongodbConfigStorageBootstrap
- settings.php in drivers/
lib/ Drupal/ Driver/ Database/ mongodb/ Install/ settings.php
File
- src/
MongodbConfigStorageBootstrap.php, line 14 - Definition of Drupal\mongodb\Config\ConfigStorageBootstrap.
Namespace
Drupal\mongodbView source
class MongodbConfigStorageBootstrap extends MongodbConfigStorage {
/**
* TRUE if the storage was already read.
*
* The test runner causes the system to not read the module list, this
* variable keeps track of that.
*
* @var bool
*/
protected $read;
/**
* @var \Composer\Autoload\ClassLoader
*/
protected $classLoader;
public function __construct(MongoCollectionFactory $mongo, ClassLoader $class_loader) {
parent::__construct($mongo);
$this->classLoader = $class_loader;
}
/**
* {@inheritdoc}
*/
public function read($name) {
if (!$this->read && $name != 'core.extension' && isset($GLOBALS['config']['core.extension']['module']['mongodb'])) {
$debug = debug_backtrace();
do {
$current = array_pop($debug);
if (isset($current['class']) && $current['class'] == 'Drupal\\Core\\Test\\TestRunnerKernel') {
/** @var \Drupal\Core\Test\TestRunnerKernel $kernel */
$kernel = $current['object'];
$mongodb_path = substr(dirname(__DIR__), strlen($kernel
->getAppRoot()) + 1);
$r = new \ReflectionObject($kernel);
$service_providers = $r
->getProperty('serviceProviders');
$service_providers
->setAccessible(TRUE);
$value = $service_providers
->getValue($kernel);
$value['app'][] = new MongodbServiceProvider();
$service_providers
->setValue($kernel, $value);
$services = $r
->getProperty('serviceYamls');
$services
->setAccessible(TRUE);
$value = $services
->getValue($kernel);
$services_file = $mongodb_path . '/mongodb.services.yml';
if (empty($value['app']) || !in_array($services_file, $value['app'])) {
$value['app'][] = $services_file;
foreach (array_keys($GLOBALS['config']['core.extension']['module']) as $module_name) {
if (substr($module_name, 0, 8) == 'mongodb_') {
$module_path = "{$mongodb_path}/{$module_name}";
$filename = "{$module_path}/{$module_name}.services.yml";
if (file_exists($filename)) {
$value['app'][] = $filename;
$this->classLoader
->addPsr4('Drupal\\' . $module_name . '\\', DRUPAL_ROOT . "/{$module_path}/src");
}
}
}
$services
->setValue($kernel, $value);
}
break;
}
} while ($debug);
}
$this->read = TRUE;
$result = parent::read($name);
if ($name == 'core.extension' && isset($GLOBALS['config'][$name]['module'])) {
if (!$result) {
$result = array(
'module' => array(),
);
}
$read_module = $result['module'];
$result['module'] += $GLOBALS['config'][$name]['module'];
if (count($read_module) != count($result['module'])) {
parent::write($name, $result);
}
}
return $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MongodbConfigStorage:: |
protected | property | The object wrapping the MongoDB database object. | |
MongodbConfigStorage:: |
protected | property | The mongo collection name. | |
MongodbConfigStorage:: |
protected | property | The prefix, typically 'config' or 'config.staging'. | |
MongodbConfigStorage:: |
public | function |
Creates a collection on the storage. Overrides StorageInterface:: |
|
MongodbConfigStorage:: |
public | function |
Decodes configuration data from the storage-specific format. Overrides StorageInterface:: |
|
MongodbConfigStorage:: |
public | function |
Deletes a configuration object from the storage. Overrides StorageInterface:: |
|
MongodbConfigStorage:: |
public | function |
Deletes configuration objects whose names start with a given prefix. Overrides StorageInterface:: |
|
MongodbConfigStorage:: |
public | function |
Encodes configuration data into the storage-specific format. Overrides StorageInterface:: |
|
MongodbConfigStorage:: |
public | function |
Returns whether a configuration object exists. Overrides StorageInterface:: |
|
MongodbConfigStorage:: |
public | function |
Gets the existing collections. Overrides StorageInterface:: |
|
MongodbConfigStorage:: |
public | function |
Gets the name of the current collection the storage is using. Overrides StorageInterface:: |
|
MongodbConfigStorage:: |
public | function |
Gets configuration object names starting with a given prefix. Overrides StorageInterface:: |
|
MongodbConfigStorage:: |
protected | function | ||
MongodbConfigStorage:: |
public | function |
Reads configuration data from the storage. Overrides StorageInterface:: |
|
MongodbConfigStorage:: |
public | function |
Renames a configuration object in the storage. Overrides StorageInterface:: |
|
MongodbConfigStorage:: |
public | function |
Writes configuration data to the storage. Overrides StorageInterface:: |
|
MongodbConfigStorageBootstrap:: |
protected | property | ||
MongodbConfigStorageBootstrap:: |
protected | property | TRUE if the storage was already read. | |
MongodbConfigStorageBootstrap:: |
public | function |
Reads configuration data from the storage. Overrides MongodbConfigStorage:: |
|
MongodbConfigStorageBootstrap:: |
public | function |
Constructs a new ConfigStorage controller. Overrides MongodbConfigStorage:: |
|
StorageInterface:: |
constant | The default collection name. |