mongodb_block.install in MongoDB 7
Install, update and uninstall functions for the MongoDB block module.
File
mongodb_block/mongodb_block.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the MongoDB block module.
*/
/**
* Implements hook_requirements().
*/
function mongodb_block_requirements($phase) {
$requirements = [];
if ($phase == 'install') {
$t = get_t();
if (module_exists('block')) {
$requirements['block'] = [
'title' => $t('MongoDB Block'),
'description' => $t('Block module has to be disabled first.'),
'severity' => REQUIREMENT_ERROR,
'value' => $t('Block module'),
];
}
}
return $requirements;
}
/**
* Ensure indexes to block collections for enabled themes.
*/
function _mongodb_block_ensure_all_indexes() {
$themes = list_themes();
$enabled_theme_list = array();
foreach ($themes as $theme) {
if ($theme->status == 1) {
$enabled_theme_list[] = $theme->name;
}
}
_mongodb_block_ensure_indexes($enabled_theme_list);
}
/**
* Implements hook_enable().
*/
function mongodb_block_enable() {
_mongodb_block_ensure_all_indexes();
}
/**
* Add indexes to block collections for enabled themes.
*/
function mongodb_block_update_7100() {
_mongodb_block_ensure_all_indexes();
}
Functions
Name | Description |
---|---|
mongodb_block_enable | Implements hook_enable(). |
mongodb_block_requirements | Implements hook_requirements(). |
mongodb_block_update_7100 | Add indexes to block collections for enabled themes. |
_mongodb_block_ensure_all_indexes | Ensure indexes to block collections for enabled themes. |