media_soundcloud.install in Media: SoundCloud 7
Same filename and directory in other branches
Install, update and uninstall functions for the Media: SoundCloud module.
File
media_soundcloud.installView source
<?php
/**
 * @file
 * Install, update and uninstall functions for the Media: SoundCloud module.
 */
/**
 * Implement hook_install().
 */
function media_soundcloud_install() {
  return array();
}
/**
 * Implement hook_uninstall().
 */
function media_soundcloud_uninstall() {
  // Include the variables inc file, else the uninstall fails.
  module_load_include('inc', 'media_soundcloud', 'includes/media_soundcloud.variables');
  // Delete all Soundcloud variables.
  foreach (media_soundcloud_variable_default() as $variable => $value) {
    media_soundcloud_variable_del($variable);
  }
  return array(
    array(
      'success' => TRUE,
      'query' => "Deleted all variables in the Media: SoundCloud namespace.",
    ),
  );
}
/**
 * Update Media Soundcloud files to the new audio file_entity type.
 */
function media_soundcloud_update_7200() {
  // Removed previously added update because we don't want to update all undefined to be audio.
  // They could be documents etc too.
  // But leaving stub as some users maybe already have run this update...
  //// update mimetype
  //module_load_include('inc', 'file_entity', 'file_api');
  //$audio_type = file_type_load('audio');
  //$audio_type->mimetypes[] = 'audio/soundcloud';
  //file_type_save($audio_type);
  //
  //// Update existing files
  //db_query("UPDATE {file_managed} SET type = 'audio' WHERE type = 'undefined' AND filemime = 'audio/soundcloud'");
}Functions
| 
            Name | 
                  Description | 
|---|---|
| media_soundcloud_install | Implement hook_install(). | 
| media_soundcloud_uninstall | Implement hook_uninstall(). | 
| media_soundcloud_update_7200 | Update Media Soundcloud files to the new audio file_entity type. |