| 1 |
<?php
|
| 2 |
|
| 3 |
/**
|
| 4 |
* Implementation of hook_install().
|
| 5 |
* @todo postgresql support
|
| 6 |
* @todo add unique key on fid & presetid?
|
| 7 |
*/
|
| 8 |
function imagecrop_install() {
|
| 9 |
switch ($GLOBALS['db_type']) {
|
| 10 |
case 'mysql':
|
| 11 |
case 'mysqli':
|
| 12 |
$ret1 = db_query("CREATE TABLE {imagecrop} (
|
| 13 |
fid INT UNSIGNED NOT NULL DEFAULT 0,
|
| 14 |
presetid INT UNSIGNED NOT NULL DEFAULT 0,
|
| 15 |
xoffset INT UNSIGNED NOT NULL DEFAULT 0,
|
| 16 |
yoffset INT UNSIGNED NOT NULL DEFAULT 0,
|
| 17 |
width INT UNSIGNED NOT NULL DEFAULT 0,
|
| 18 |
height INT UNSIGNED NOT NULL DEFAULT 0)
|
| 19 |
/*!40100 DEFAULT CHARACTER SET utf8 */
|
| 20 |
");
|
| 21 |
break;
|
| 22 |
case'pgsql':
|
| 23 |
|
| 24 |
break;
|
| 25 |
}
|
| 26 |
if ($ret1) {
|
| 27 |
drupal_set_message(t('Imagecrop module installed succesfully.'));
|
| 28 |
} else {
|
| 29 |
drupal_set_message(t('Imagecrop module installation was unsuccessfull. Necessary database tables should be created by hand.', 'error'));
|
| 30 |
}
|
| 31 |
return $ret1;
|
| 32 |
}
|
| 33 |
|
| 34 |
/**
|
| 35 |
* Implementation of hook_uninstall()
|
| 36 |
*/
|
| 37 |
function imagecrop_uninstall() {
|
| 38 |
db_query("DROP TABLE {imagecrop}");
|
| 39 |
db_query("DELETE FROM {system} where name = 'imagecrop'");
|
| 40 |
variable_del('imagecrop_modules');
|
| 41 |
variable_del('imagecrop_fields');
|
| 42 |
}
|