1 comment.install | comment_uninstall() |
Implements hook_uninstall().
File
- core/
modules/ comment/ comment.install, line 35 - Install, update and uninstall functions for the Comment module.
Code
function comment_uninstall() {
// Delete comment_body field.
field_delete_field('comment_body');
// Remove variables.
state_del('node_cron_comments_scale');
$node_types = node_type_get_types();
foreach ($node_types as $type_name => $node_type) {
field_attach_delete_bundle('comment', 'comment_node_' . $type_name);
$comment_settings = array(
'comment',
'comment_anonymous',
'comment_mode',
'comment_order',
'comment_per_page',
'comment_form_location',
'comment_preview',
'comment_title_options',
'comment_user_picture',
'comment_close_enabled',
'comment_close_days'
);
foreach ($comment_settings as $setting) {
if (isset($node_type->settings[$setting])) {
unset($node_type->settings[$setting]);
}
}
node_type_save($node_type);
}
// Remove comment closer override.
if (db_field_exists('node', 'comment_close_override')) {
db_drop_field('node', 'comment_close_override');
}
// Flush outdated cache data.
cache('cache')->deletePrefix('schema');
backdrop_static_reset('_node_types_build');
// Remove default, un-modified view.
$config = config('views.view.comments_recent');
// Only update if view isn't overridden (VIEWS_STORAGE_OVERRIDE).
if ($config->get('storage') != 2) {
$config->delete();
}
}