You are here

function yandex_metrics_reports_update_7300 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_7300()

Upgrade from 7.x-2.x to 7.x-3.x.

Migration to Yandex.Metrics Popular Content (yandex_metrics_popular_content).

File

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

Code

function yandex_metrics_reports_update_7300() {

  // If old table exists.
  if (db_table_exists('yandex_metrics_reports_popular_content')) {

    // Drop redundant table yandex_metrics_reports module.
    db_drop_table('yandex_metrics_reports_popular_content');
  }
  variable_set('yandex_metrics_popular_content_date_period', variable_get('yandex_metrics_reports_date_period', 'week'));
  variable_del('yandex_metrics_reports_date_period');

  // Remove redundant variables. Now we have only one variable for all report metadata.
  db_delete('variable')
    ->condition('name', 'yandex_metrics_reports_%_visible', 'LIKE')
    ->execute();
  cache_clear_all('variables', 'cache_bootstrap');
}