You are here

function monitoring_update_8101 in Monitoring 8

Creates the used temporary files sensor config.

File

./monitoring.install, line 81
Monitoring base install file.

Code

function monitoring_update_8101() {

  // Only create if the sensor config does not exist yet.
  if (!SensorConfig::load('temporary_files_usages')) {
    $config_path = drupal_get_path('module', 'monitoring') . '/config/install/monitoring.sensor_config.temporary_files_usages.yml';
    $data = Yaml::decode(file_get_contents($config_path));
    \Drupal::service('monitoring.sensor_manager')
      ->clearCachedDefinitions();
    SensorConfig::create($data)
      ->trustData()
      ->save();
    return 'Created new sensor to monitor used temporary files';
  }
}