Per this is a valid function. The patch is in #1948588: Google Analytics 8 upgrade

Fatal error: Call to undefined function update_variables_to_config() in modules\google_analytics\google_analytics.install on line 13

 * Implements hook_install().
function google_analytics_install() {
  // Migrate settings from previous Google Analytics version.
  update_variables_to_config('google_analytics.settings', array(
    'googleanalytics_account' => 'account',
    'googleanalytics_cache' => 'cache',
    'googleanalytics_codesnippet_before' => 'codesnippet.before',
    'googleanalytics_codesnippet_after' => 'codesnippet.after',
    'googleanalytics_cross_domains' => 'cross_domains',
    //'googleanalytics_custom_var' => 'custom_var',
    'googleanalytics_domain_mode' => 'domain_mode',
    'googleanalytics_js_scope' => 'js_scope',
    'googleanalytics_last_cache' => 'last_cache',
    'googleanalytics_pages' => 'visibility.pages',
    'googleanalytics_roles' => 'visibility.roles',
    'googleanalytics_site_search' => 'track.site_search',
    'googleanalytics_trackadsense' => 'track.adsense',
    'googleanalytics_trackdoubleclick' => 'track.doubleclick',
    'googleanalytics_tracker_anonymizeip' => 'privacy.anonymizeip',
    'googleanalytics_trackfiles' => 'track.files',
    'googleanalytics_trackfiles_extensions' => 'track.files_extensions',
    'googleanalytics_trackmailto' => 'track.mailto',
    'googleanalytics_trackoutbound' => 'track.outbound',
    'googleanalytics_translation_set' => 'translation_set',
    'googleanalytics_visibility_pages' => 'visibility.pages_enabled',
    'googleanalytics_visibility_roles' => 'visibility.roles_enabled',
    'googleanalytics_privacy_donottrack' => 'privacy.donottrack',

  // Remove the 'googleanalytics' directory and cached files.

  // Remove backup variables if exist. No migration required.


swentel’s picture

Status: Active » Closed (works as designed)

You're calling it in hook_install(), you need to run this in hook_update_n.

hass’s picture

Status: Closed (works as designed) » Active

I must run it in hook_install(). This cannot run in hook_update_x().

Module name has been changed.

swentel’s picture

Issue tags: +Configuration system

Ah, rename ... is not loaded during hook_install() ... you can load it in the meantime for testing, which is not ideal of course.
Tagging to get more eyes on this.

catch’s picture

Priority: Major » Normal

require_once() seems plenty if the module is renamed.

hass’s picture

Added require_once for now. Thanks guys.

At the very minimum this needs to be documented in the API documentation if this is not something that hook_install() should support.

mtift’s picture

Status: Active » Closed (works as designed)

Running this in hook_install() rather than hook_update_n() because of a module name change seems like an edge case to me. I'd say it works as designed.

mtift’s picture

Issue summary: View changes