You are here

mongodb.install in MongoDB 8

Same filename and directory in other branches
  1. 6 mongodb.install
  2. 7 mongodb.install

File

mongodb.install
View 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