imageinfo_cache.install in Imageinfo Cache 6.2
Same filename and directory in other branches
Handles Imageinfo Cache installation and upgrade tasks.
File
imageinfo_cache.installView source
<?php
/**
* @file
* Handles Imageinfo Cache installation and upgrade tasks.
*/
/**
* Implementation of hook_install().
*/
function imageinfo_cache_install() {
drupal_install_schema('imageinfo_cache');
variable_set('imageinfo_cache_url_key', mt_rand());
}
/**
* Implementation of hook_schema().
*/
function imageinfo_cache_schema() {
$schema['cache_imageinfo'] = drupal_get_schema_unprocessed('system', 'cache');
$schema['cache_imageinfo']['description'] = t('Cache table for Imageinfo Cache module.');
return $schema;
}
/**
* Implementation of hook_uninstall().
*/
function imageinfo_cache_uninstall() {
drupal_uninstall_schema('imageinfo_cache');
variable_del('imageinfo_cache_lifetime');
variable_del('imageinfo_cache_theme_imagecache_callback');
variable_del('imageinfo_cache_theme_imagefield_image_callback');
variable_del('imageinfo_cache_theme_callback');
variable_del('imageinfo_cache_theme_imagecache');
variable_del('imageinfo_cache_theme_imagefield_image');
variable_del('imageinfo_cache_imagecache_pregenerate');
variable_del('imageinfo_cache_async_max');
variable_del('imageinfo_cache_httprl_mode');
variable_del('imageinfo_cache_url_key');
variable_del('imageinfo_cache_server_addr');
// Remove all the widget settings.
db_query("DELETE FROM {variable} WHERE name LIKE 'imageinfo_cache_cck_widget_%'");
}
/**
* Implementation of hook_requirements().
*/
function imageinfo_cache_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time
$t = get_t();
if ($phase == 'runtime' || $phase == 'install') {
// Check that the function exists.
if (!function_exists('imagecache_generate_image')) {
$requirements['imageinfo_cache_version'] = array(
'title' => $t('Imageinfo Cache'),
'value' => $phase == 'install' ? FALSE : 'imagecache_generate_image',
'severity' => REQUIREMENT_ERROR,
'description' => $t('The verson of <a href="http://drupal.org/project/imagecache">ImageCache</a> installed is old. Please update to at least 6.x-2.0-beta12'),
);
}
}
if (empty($requirements)) {
$requirements['imageinfo_cache'] = array(
'title' => $t('Imageinfo Cache'),
'severity' => REQUIREMENT_OK,
'value' => $phase == 'install' ? TRUE : $t('The version of ImageCache is 6.x-2.0-beta12 or greater.'),
);
}
return $requirements;
}
/**
* Update 6200 - Flush the menu cache.
*/
function imageinfo_cache_update_6200() {
$ret = array();
// Flush menu cache.
if (menu_rebuild()) {
$ret[] = array(
'success' => TRUE,
'query' => 'Menu cache rebuilt.',
);
}
return $ret;
}
Functions
Name![]() |
Description |
---|---|
imageinfo_cache_install | Implementation of hook_install(). |
imageinfo_cache_requirements | Implementation of hook_requirements(). |
imageinfo_cache_schema | Implementation of hook_schema(). |
imageinfo_cache_uninstall | Implementation of hook_uninstall(). |
imageinfo_cache_update_6200 | Update 6200 - Flush the menu cache. |