You are here

function google_analytics_counter_update_8012 in Google Analytics Counter 8.3

Issue #3036157: Date Range.

File

./google_analytics_counter.install, line 459
Update, and uninstall functions for the Google Analytics Counter module.

Code

function google_analytics_counter_update_8012() {
  $config_factory = \Drupal::configFactory();

  // Get the existing start date.
  $start_date = $config_factory
    ->getEditable('google_analytics_counter.settings')
    ->get('general_settings.start_date');
  switch ($start_date) {
    case '2005-01-01':
      $config_factory
        ->getEditable('google_analytics_counter.settings')
        ->set('general_settings.start_date', '14 November 2005')
        ->save();
      $config_factory
        ->getEditable('google_analytics_counter.settings')
        ->set('general_settings.end_date', 'yesterday')
        ->save();
      break;
    default:
      break;
  }
}