/[drupal]/contributions/modules/upload_preview/upload_preview.install
ViewVC logotype

Contents of /contributions/modules/upload_preview/upload_preview.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Mon Dec 29 03:27:08 2008 UTC (10 months, 4 weeks ago) by rmiddle
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, DRUPAL-6--1-1, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.2: +8 -3 lines
File MIME type: text/x-php
Initial port of Drupal 6.
1 <?php
2 // $Id: theme.inc,v 1.202 2004/07/08 16:08:21 dries Exp $
3
4 /**
5 * @file
6 * The install file that controls to setup of the module.
7 */
8
9 /**
10 * Implementation of hook_install().
11 */
12 function upload_preview_install() {
13 $preview = file_create_path(variable_get('upload_preview_path', 'preview'));
14
15 // Make sure that the file preview directory exists
16 if (!file_check_directory($preview, FILE_CREATE_DIRECTORY)) {
17 drupal_set_message(t('Attachment previews are disabled. The preview directory %directory has not been properly configured.', array('%directory' => $preview)), 'error');
18 }
19
20 // Also ensure, that we have a image toolkit available.
21 if (!image_get_toolkit()) {
22 drupal_set_message(t('Make sure you have a working image toolkit installed and enabled. Further information can be found on the <a href="@url">Image toolkit settings page</a>.', array('@url' => url('admin/settings/image-toolkit'))), 'error');
23 }
24 }
25
26 /**
27 * Implementation of hook_disable().
28 */
29 function upload_preview_disable() {
30 // Remove all preview files as they aren't necessary if the module is disabled
31 $previews = variable_get('upload_preview_files', array());
32
33 // Delete all preview files.
34 foreach ($previews as $file => $timestamp) {
35 file_delete($file);
36 }
37
38 variable_del('upload_preview_files');
39 }
40
41 /**
42 * Implementation of hook_uninstall().
43 */
44 function upload_preview_uninstall() {
45 // Remove the file preview directory
46 $directory = file_create_path(variable_get('upload_preview_path', 'preview'));
47 if (is_dir($directory)) {
48 rmdir($directory);
49 }
50
51 // Remove all variables
52 variable_del('upload_preview_size');
53 variable_del('upload_preview_path');
54 variable_del('upload_preview_lifetime');
55 }

  ViewVC Help
Powered by ViewVC 1.1.2