google_analytics_api.install in Google Analytics Reports 6
Same filename and directory in other branches
Installation file for Google Analytics API module.
File
google_analytics_api.installView source
<?php
/**
* @file
* Installation file for Google Analytics API module.
*/
/**
* Implements hook_enable().
*/
function google_analytics_api_enable() {
// Make sure the OAuth class is available.
module_invoke('autoload', 'flush_caches');
}
/**
* Implements hook_uninstall().
*/
function google_analytics_api_uninstall() {
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');
variable_del('google_analytics_reports_cache_length');
}
/**
* Implements hook_requirements().
*/
function google_analytics_api_requirements($phase) {
$requirements = array();
$t = get_t();
if ($phase == 'install') {
// drupal_get_path() needs the system table to be there, which if
// this module is included in an install profile is not yet created.
if (function_exists('db_table_exists') && db_table_exists('system')) {
$module_directory = drupal_get_path('module', 'autoload');
if ($module_directory) {
include_once $module_directory . '/autoload.module';
if (!function_exists('autoload_registry_rebuild')) {
$requirements['autoload_version'] = array(
'title' => $t('Autoload version'),
'description' => $t('Your version of Autoload appears to be out of date. Version 2.x is required.'),
'severity' => REQUIREMENT_ERROR,
);
}
}
}
}
return $requirements;
}
Functions
Name![]() |
Description |
---|---|
google_analytics_api_enable | Implements hook_enable(). |
google_analytics_api_requirements | Implements hook_requirements(). |
google_analytics_api_uninstall | Implements hook_uninstall(). |