| 1 |
<?php
|
| 2 |
// $Id: image_resize_filter.install,v 1.6 2009/09/28 07:10:37 quicksketch Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function image_resize_filter_install() {
|
| 8 |
drupal_set_message(t('The image resize filter has been installed. Before this does anything, the image resize filter needs to be added to one or more input formats. Visit the <a href="!url">input format administration</a> to set up this filter.', array('!url' => url('admin/settings/filters'))), 'warning');
|
| 9 |
}
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implementation of hook_uninstall().
|
| 13 |
*/
|
| 14 |
function image_resize_filter_uninstall() {
|
| 15 |
image_resize_filter_delete_all();
|
| 16 |
db_query("DELETE FROM {variable} WHERE name LIKE 'input_resize_filter_%'");
|
| 17 |
}
|
| 18 |
|
| 19 |
/**
|
| 20 |
* Implementation of hook_requirements().
|
| 21 |
*/
|
| 22 |
function image_resize_filter_requirements($phase) {
|
| 23 |
$requirements = array();
|
| 24 |
$t = get_t();
|
| 25 |
if ($phase == 'install' && function_exists('image_get_toolkit')) {
|
| 26 |
if (function_exists('imageapi_default_toolkit') && !imageapi_default_toolkit() || !image_get_toolkit()) {
|
| 27 |
$requirements['image_resize_filter'] = array(
|
| 28 |
'title' => $t('Image resize filter'),
|
| 29 |
'description' => $t('Image resize filter requires at least one active image toolkit on your server.'),
|
| 30 |
'severity' => REQUIREMENT_ERROR,
|
| 31 |
);
|
| 32 |
}
|
| 33 |
}
|
| 34 |
|
| 35 |
return $requirements;
|
| 36 |
}
|
| 37 |
|
| 38 |
/**
|
| 39 |
* Remove the old files sub-directory. Paths to resized images are now shorter.
|
| 40 |
*/
|
| 41 |
function image_resize_filter_update_6100() {
|
| 42 |
$ret = array();
|
| 43 |
|
| 44 |
drupal_load('module', 'image_resize_filter');
|
| 45 |
image_resize_filter_delete_all();
|
| 46 |
$ret[] = array('success' => TRUE, 'query' => t('The location of resized images has changed. The currently resized images have been flushed.'));
|
| 47 |
|
| 48 |
return $ret;
|
| 49 |
}
|
| 50 |
|
| 51 |
/**
|
| 52 |
* Remove the "Image resize difference" option.
|
| 53 |
* It was confusing and didn't actually do anything.
|
| 54 |
*/
|
| 55 |
function image_resize_filter_update_6101() {
|
| 56 |
$ret = array();
|
| 57 |
|
| 58 |
db_query("DELETE FROM {variable} WHERE name LIKE 'image_resize_filter_allowed_difference_%'");
|
| 59 |
$ret[] = array('success' => TRUE, 'query' => t('Image resize allowed difference option removed.'));
|
| 60 |
|
| 61 |
return $ret;
|
| 62 |
}
|
| 63 |
|
| 64 |
/**
|
| 65 |
* Clear out all resized images to give them proper names if they were missing.
|
| 66 |
*/
|
| 67 |
function image_resize_filter_update_6102() {
|
| 68 |
$ret = array();
|
| 69 |
|
| 70 |
drupal_load('module', 'image_resize_filter');
|
| 71 |
image_resize_filter_delete_all();
|
| 72 |
$ret[] = array('success' => TRUE, 'query' => t('Previously resized images may have been missing file names. The currently resized images have been flushed.'));
|
| 73 |
|
| 74 |
return $ret;
|
| 75 |
}
|