flickr.install in Flickr 7
Same filename and directory in other branches
The Flickr database schema and uninstall hook.
File
flickr.installView source
<?php
/**
* @file
* The Flickr database schema and uninstall hook.
*/
/**
* Implements hook_install().
*/
function flickr_install() {
if (module_exists('colorbox')) {
variable_set('flickr_class', 'colorbox');
variable_set('flickr_rel', 'gallery-all');
variable_set('colorbox_inline', 1);
}
elseif (module_exists('lightbox2')) {
variable_set('flickr_rel', 'lightbox[gallery]');
}
}
/**
* Implements hook_uninstall().
*/
function flickr_uninstall() {
variable_del('flickr_api_key');
variable_del('flickr_api_secret');
variable_del('flickr_cache_duration');
variable_del('flickr_cc');
variable_del('flickr_class');
variable_del('flickr_css');
variable_del('flickr_curl');
variable_del('flickr_curl2');
variable_del('flickr_debug');
variable_del('flickr_default_size_album');
variable_del('flickr_default_userid');
variable_del('flickr_opening_size');
variable_del('flickr_per_page');
variable_del('flickr_photos_per_page');
variable_del('flickr_rel');
variable_del('flickr_title_suppress_on_small');
variable_del('flickr_metadata_suppress_on_small');
variable_del('flickr_info_overlay');
variable_del('flickr_license');
variable_del('flickr_restrict');
variable_del('flickr_extend');
variable_del('flickr_counter');
variable_del('flickr_maps');
variable_del('flickr_geophp');
variable_del('flickr_smart');
variable_del('flickr_date_format_image_title');
variable_del('flickr_date_format_image_caption');
variable_del('flickr_date_format_image_caption_hover');
variable_del('flickr_date_format_album_title');
variable_del('flickr_capsize');
variable_del('flickr_sswidth_value');
variable_del('flickr_sswidth_unit');
variable_del('flickr_sswidth');
variable_del('flickr_sswratio');
variable_del('flickr_sshratio');
variable_del('flickr_ssratio');
variable_del('flickr_caption_fontsize');
variable_del('flickr_preview_html');
variable_del('flickr_preview_collapsed');
}
/**
* Implements hook_schema().
*/
function flickr_schema() {
$schema['flickr_users'] = array(
'description' => 'Connects Drupal users to their Flickr accounts.',
'fields' => array(
'uid' => array(
'type' => 'int',
'not null' => TRUE,
'description' => 'Primary Key: Drupal user ID',
),
'nsid' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'description' => 'Flickr NSID',
),
'identifier' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'description' => 'Flickr identifier',
),
),
'primary key' => array(
'uid',
),
);
return $schema;
}
/**
* Implements hook_requirements().
*/
function flickr_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$t = get_t();
$requirements['flickr_requirements'] = array(
'title' => $t('Flickr'),
'value' => variable_get('flickr_api_key', NULL) ? $t('A Flickr API key has been set.') : $t("No Flickr API key has been set at !link.", array(
'!link' => l('admin/config/media/flickr', 'admin/config/media/flickr'),
)),
'severity' => variable_get('flickr_api_key', NULL) ? REQUIREMENT_OK : REQUIREMENT_ERROR,
);
}
return $requirements;
}
/**
* Create new index 'license' on the variable 'flickr_info_overlay'.
*/
function flickr_update_7001() {
$overlay = variable_get('flickr_info_overlay', array(
'title' => 'title',
'metadata' => 'metadata',
'description' => 'description',
'license' => 0,
));
if (!isset($overlay['license'])) {
variable_set('flickr_info_overlay', array(
'title' => 'title',
'metadata' => 'metadata',
'description' => 'description',
'license' => 0,
));
}
}
/**
* Removes old unused variables.
*/
function flickr_update_7101() {
variable_del("flickr_default_size");
}
/**
* Enable 'Colorbox inline' to allow playing videos inside Colorbox.
*/
function flickr_update_7102() {
if (module_exists('colorbox')) {
variable_set('flickr_class', 'colorbox');
variable_set('flickr_rel', 'gallery-all');
variable_set('colorbox_inline', 1);
}
elseif (module_exists('lightbox2')) {
variable_set('flickr_rel', 'lightbox[gallery]');
}
}
/**
* Delete unused variables.
*/
function flickr_update_7103() {
variable_del('flickr_caption_padding');
}
Functions
Name | Description |
---|---|
flickr_install | Implements hook_install(). |
flickr_requirements | Implements hook_requirements(). |
flickr_schema | Implements hook_schema(). |
flickr_uninstall | Implements hook_uninstall(). |
flickr_update_7001 | Create new index 'license' on the variable 'flickr_info_overlay'. |
flickr_update_7101 | Removes old unused variables. |
flickr_update_7102 | Enable 'Colorbox inline' to allow playing videos inside Colorbox. |
flickr_update_7103 | Delete unused variables. |