You are here

function social_group_update_8005 in Open Social 8.2

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_group/social_group.install \social_group_update_8005()
  2. 8 modules/social_features/social_group/social_group.install \social_group_update_8005()
  3. 8.3 modules/social_features/social_group/social_group.install \social_group_update_8005()
  4. 8.4 modules/social_features/social_group/social_group.install \social_group_update_8005()
  5. 8.5 modules/social_features/social_group/social_group.install \social_group_update_8005()
  6. 8.6 modules/social_features/social_group/social_group.install \social_group_update_8005()
  7. 8.7 modules/social_features/social_group/social_group.install \social_group_update_8005()
  8. 8.8 modules/social_features/social_group/social_group.install \social_group_update_8005()
  9. 10.3.x modules/social_features/social_group/social_group.install \social_group_update_8005()
  10. 10.0.x modules/social_features/social_group/social_group.install \social_group_update_8005()
  11. 10.1.x modules/social_features/social_group/social_group.install \social_group_update_8005()
  12. 10.2.x modules/social_features/social_group/social_group.install \social_group_update_8005()

Uninstall geocoder and geolocation modules. Remove group geolocation field.

File

modules/social_features/social_group/social_group.install, line 262
Install, update and uninstall functions for the social_group module.

Code

function social_group_update_8005() {
  $modules = [
    'geolocation',
    'geocoder',
  ];
  $config_factory = \Drupal::service('config.factory');
  foreach ($modules as $module) {

    // Remove config.
    $config_factory
      ->getEditable("{$module}.settings")
      ->delete();

    // Remove cache tables.
    if (db_table_exists("cache_{$module}")) {
      db_drop_table("cache_{$module}");
    }

    // Remove data from system.schema.
    $query = \Drupal::database()
      ->delete('key_value');
    $query
      ->condition('name', $module);
    $query
      ->execute();
  }

  // Remove group geolocation field.
  $config_factory
    ->getEditable('field.field.group.closed_group.field_group_geolocation')
    ->delete();
  $config_factory
    ->getEditable('field.field.group.open_group.field_group_geolocation')
    ->delete();
  $config_factory
    ->getEditable('field.storage.group.field_group_geolocation')
    ->delete();

  // Uninstall geocoder and geolocation modules.
  \Drupal::service('module_installer')
    ->uninstall($modules);
}