media_flickr.install in Media: Flickr 7.2
Same filename and directory in other branches
Install, update and uninstall functions for the Media: Flickr module.
File
media_flickr.installView source
<?php
/**
 * @file
 * Install, update and uninstall functions for the Media: Flickr module.
 */
/**
 * Implements hook_uninstall().
 */
function media_flickr_uninstall() {
  // Remove variables.
  variable_del('media_flickr_width');
  variable_del('media_flickr_height');
  variable_del('media_flickr_autoplay');
  variable_del('media_flickr_preview_uri');
  variable_del('media_flickr_api_key');
  variable_del('media_flickr_api_secret');
}
/**
 * Rebuild the registry to locate class files in new location.
 */
function media_flickr_update_7001() {
  registry_rebuild();
}
/**
 * We now namespace variables with a prefix, so fix old variables.
 */
function media_flickr_update_7002() {
  drupal_load('module', 'media_flickr');
  foreach (media_flickr_variable_default() as $variable => $value) {
    if (($test = variable_get('media_flickr_' . $variable, TRUE)) == variable_get('media_flickr_' . $variable, FALSE)) {
      media_flickr_variable_set($variable, $test);
      variable_del('media_flickr_' . $variable);
    }
  }
}
/**
 * Register new theme functions.
 */
function media_flickr_update_7004() {
}
/**
 * Register new style presets for photosets.
 */
function media_flickr_update_7005() {
}
/**
 * Register new style presets for photosets based on Image styles.
 */
function media_flickr_update_7006() {
}
/**
 * Register new permissions.
 */
function media_flickr_update_7007() {
}
/**
 * Rename variables, removing variable namespace.
 */
function media_flickr_update_7008() {
  // Create an array of variables sans 'media_flickr' prefix.
  $variables = array(
    'width',
    'height',
    'autoplay',
    'preview_uri',
    'api_key',
    'api_secret',
  );
  foreach ($variables as $variable) {
    // Find the value of the old variable.
    $value = variable_get('media_flickr__' . $variable);
    // Port the value of the variable if it was set.
    if (!is_null($value)) {
      variable_set('media_flickr_' . $variable, $value);
    }
    // Remove the old variable.
    variable_del('media_flickr__' . $variable);
  }
}Functions
| 
            Name | 
                  Description | 
|---|---|
| media_flickr_uninstall | Implements hook_uninstall(). | 
| media_flickr_update_7001 | Rebuild the registry to locate class files in new location. | 
| media_flickr_update_7002 | We now namespace variables with a prefix, so fix old variables. | 
| media_flickr_update_7004 | Register new theme functions. | 
| media_flickr_update_7005 | Register new style presets for photosets. | 
| media_flickr_update_7006 | Register new style presets for photosets based on Image styles. | 
| media_flickr_update_7007 | Register new permissions. | 
| media_flickr_update_7008 | Rename variables, removing variable namespace. |