You are here

function yandex_metrics_reports_update_7201 in Yandex.Metrics 8.3

Same name and namespace in other branches
  1. 7.3 yandex_metrics_reports/yandex_metrics_reports.install \yandex_metrics_reports_update_7201()
  2. 7.2 yandex_metrics_reports/yandex_metrics_reports.install \yandex_metrics_reports_update_7201()

Use Yandex Services Authorization API (yandex_services_auth).

File

yandex_metrics_reports/yandex_metrics_reports.install, line 100
Install, uninstall and update the module.

Code

function yandex_metrics_reports_update_7201() {

  // Enable yandex_services_auth module.
  if (!module_enable(array(
    'yandex_services_auth',
  ))) {
    throw new Exception('The Yandex.Metrics Reports requires Yandex Services Authorization API (https://drupal.org/project/yandex_services_auth) module.');
  }
  if (!yandex_services_auth_info('token')) {
    variable_set('yandex_services_auth_token', variable_get('yandex_metrics_reports_auth_token', ''));
    variable_set('yandex_services_auth_client_id', variable_get('yandex_metrics_reports_client_id', ''));
    variable_set('yandex_services_auth_client_secret', variable_get('yandex_metrics_reports_client_secret', ''));
  }
  variable_del('yandex_metrics_reports_client_id');
  variable_del('yandex_metrics_reports_client_secret');
  variable_del('yandex_metrics_reports_auth_token');
}