mongodb.install in MongoDB 8
Same filename and directory in other branches
File
mongodb.installView source
<?php
use Drupal\Core\Config\ConfigManagerInterface;
use Drupal\Core\Config\FileStorage;
use Drupal\mongodb\MongodbConfigStorage;
use Drupal\mongodb\MongoCollectionFactory;
use Drupal\mongodb\MongodbServiceProvider;
/**
* Implement hook_requirements().
*/
function mongodb_requirements($phase) {
$requirements = array();
if (!extension_loaded('mongo')) {
$requirements['mongodb'] = array(
'title' => t('Mongodb'),
'value' => t('Not found'),
'description' => t('Mongodb requires the PHP MongoDB extension to be installed.'),
'severity' => REQUIREMENT_ERROR,
);
}
return $requirements;
}
/**
* Implements hook_install().
*/
function mongodb_install() {
MongodbServiceProvider::createIndexes(\Drupal::service('mongo'), \Drupal::service('settings')
->get('mongo'));
}
Functions
Name | Description |
---|---|
mongodb_install | Implements hook_install(). |
mongodb_requirements | Implement hook_requirements(). |