You are here

function opigno_learning_path_update_8031 in Opigno Learning path 8

Creates create cronjobs.

File

./opigno_learning_path.install, line 858
Install, update and uninstall functions for the module.

Code

function opigno_learning_path_update_8031() {

  // Enable ultimate_cron.
  if (!\Drupal::moduleHandler()
    ->moduleExists('ultimate_cron')) {
    \Drupal::service('module_installer')
      ->install([
      'ultimate_cron',
    ]);
  }

  // Enable new module opigno_cron.
  if (!\Drupal::moduleHandler()
    ->moduleExists('opigno_cron')) {
    \Drupal::service('module_installer')
      ->install([
      'opigno_cron',
    ]);
  }

  // Add new cron configuretions.
  $config_path = drupal_get_path('module', 'opigno_learning_path') . '/config/install';
  $storage = new FileStorage($config_path);
  $config_storage = \Drupal::service('config.storage');
  $data = $storage
    ->read('ultimate_cron.job.opigno_learning_path_cron');
  $config_storage
    ->write('ultimate_cron.job.opigno_learning_path_cron', $data);
}