function google_analytics_reports_api_install in Google Analytics Reports 7.3
Implements hook_install().
File
- google_analytics_reports_api/
google_analytics_reports_api.install, line 11 - Installation file for Google Analytics Reports API module.
Code
function google_analytics_reports_api_install() {
// Move variables from old Google Analytics API module to
// the new Google Analytics Reports API module.
if (variable_get('google_analytics_reports_oauth_token', FALSE)) {
variable_set('google_analytics_reports_api_cache_length', variable_get('google_analytics_reports_cache_length', 259200));
variable_set('google_analytics_reports_api_default_page', variable_get('google_analytics_reports_default_page', '/index.html'));
variable_set('google_analytics_reports_api_hd', variable_get('google_analytics_reports_hd', 'default'));
variable_set('google_analytics_reports_api_oauth_token', variable_get('google_analytics_reports_oauth_token', FALSE));
variable_set('google_analytics_reports_api_oauth_token_secret', variable_get('google_analytics_reports_oauth_token_secret', NULL));
variable_set('google_analytics_reports_api_profile_id', variable_get('google_analytics_reports_profile_id', 0));
variable_del('google_analytics_reports_cache_length');
variable_del('google_analytics_reports_default_page');
variable_del('google_analytics_reports_hd');
variable_del('google_analytics_reports_oauth_token');
variable_del('google_analytics_reports_oauth_token_secret');
variable_del('google_analytics_reports_profile_id');
// Remove information of old modules from the database.
// module_disable() and drupal_uninstall_modules won't work since
// the modules files doesn't exists.
db_delete('system')
->condition(db_or()
->condition('name', 'google_analytics_api')
->condition('name', 'google_analytics_views'))
->execute();
}
}