Mercurial > hg > isophonics-drupal-site
annotate core/modules/comment/comment.post_update.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | af1871eacc83 |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 /** |
Chris@0 | 4 * @file |
Chris@0 | 5 * Post update functions for the comment module. |
Chris@0 | 6 */ |
Chris@0 | 7 |
Chris@0 | 8 use Drupal\Core\Config\FileStorage; |
Chris@0 | 9 use Drupal\Core\Config\InstallStorage; |
Chris@0 | 10 |
Chris@0 | 11 /** |
Chris@0 | 12 * Enable the comment admin view. |
Chris@0 | 13 */ |
Chris@0 | 14 function comment_post_update_enable_comment_admin_view() { |
Chris@0 | 15 $module_handler = \Drupal::moduleHandler(); |
Chris@0 | 16 $entity_type_manager = \Drupal::entityTypeManager(); |
Chris@0 | 17 |
Chris@0 | 18 // Save the comment delete action to config. |
Chris@0 | 19 $config_install_path = $module_handler->getModule('comment')->getPath() . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY; |
Chris@0 | 20 $storage = new FileStorage($config_install_path); |
Chris@0 | 21 $entity_type_manager |
Chris@0 | 22 ->getStorage('action') |
Chris@0 | 23 ->create($storage->read('system.action.comment_delete_action')) |
Chris@0 | 24 ->save(); |
Chris@0 | 25 |
Chris@0 | 26 // Only create if the views module is enabled. |
Chris@0 | 27 if (!$module_handler->moduleExists('views')) { |
Chris@0 | 28 return; |
Chris@0 | 29 } |
Chris@0 | 30 |
Chris@0 | 31 // Save the comment admin view to config. |
Chris@0 | 32 $optional_install_path = $module_handler->getModule('comment')->getPath() . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY; |
Chris@0 | 33 $storage = new FileStorage($optional_install_path); |
Chris@0 | 34 $entity_type_manager |
Chris@0 | 35 ->getStorage('view') |
Chris@0 | 36 ->create($storage->read('views.view.comment')) |
Chris@0 | 37 ->save(); |
Chris@0 | 38 } |
Chris@18 | 39 |
Chris@18 | 40 /** |
Chris@18 | 41 * Add comment settings. |
Chris@18 | 42 */ |
Chris@18 | 43 function comment_post_update_add_ip_address_setting() { |
Chris@18 | 44 $config_factory = \Drupal::configFactory(); |
Chris@18 | 45 $settings = $config_factory->getEditable('comment.settings'); |
Chris@18 | 46 $settings->set('log_ip_addresses', TRUE) |
Chris@18 | 47 ->save(TRUE); |
Chris@18 | 48 } |