/[drupal]/contributions/modules/color_soc08/color.install
ViewVC logotype

Contents of /contributions/modules/color_soc08/color.install

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


Revision 1.13 - (show annotations) (download) (as text)
Fri Aug 22 10:21:56 2008 UTC (15 months ago) by skiquel
Branch: MAIN
CVS Tags: HEAD
Changes since 1.12: +6 -1 lines
File MIME type: text/x-php
head commit
1 <?php
2 // $Id: color.install,v 1.10.2.2 2008/08/18 18:59:45 skiquel Exp $
3
4 function color_requirements($phase) {
5 $requirements = array();
6
7 if ($phase == 'runtime') {
8 // Check GD library
9 if (function_exists('imagegd2')) {
10 $info = gd_info();
11 $requirements['gd'] = array(
12 'value' => $info['GD Version'],
13 );
14
15 // Check PNG support
16 if (function_exists('imagecreatefrompng')) {
17 $requirements['gd']['severity'] = REQUIREMENT_OK;
18 }
19 else {
20 $requirements['gd']['severity'] = REQUIREMENT_ERROR;
21 $requirements['gd']['description'] = t('The GD library for PHP is enabled, but was compiled without PNG support. Please check the <a href="@url">PHP image documentation</a> for information on how to correct this.', array('@url' => 'http://www.php.net/manual/en/ref.image.php'));
22 }
23 }
24 else {
25 $requirements['gd'] = array(
26 'value' => t('Not installed'),
27 'severity' => REQUIREMENT_ERROR,
28 'description' => t('The GD library for PHP is missing or outdated. Please check the <a href="@url">PHP image documentation</a> for information on how to correct this.', array('@url' => 'http://www.php.net/manual/en/ref.image.php')),
29 );
30 }
31 $requirements['gd']['title'] = t('GD library');
32 }
33
34 return $requirements;
35 }
36
37 /**
38 * Implementation of hook_install().
39 */
40 function color_install() {
41 drupal_install_schema('color', 'color_schemes', 'color_users');
42
43 module_load_include('inc', 'color', 'color.database');
44 color_check_themes();
45 }
46
47 /**
48 * Implementation of hook_install().
49 */
50 function color_uninstall() {
51 drupal_uninstall_schema('color', 'color_schemes', 'color_users');
52
53 module_load_include('inc', 'color', 'color.misc');
54 $themes = color_list_colorable_themes();
55 foreach ($themes as $theme) {
56 db_query("DELETE FROM {variable} WHERE name LIKE 'color_%s%'", $theme);
57 }
58
59 color_rm_dir(file_directory_path() .'/color');
60 }
61
62 /**
63 * Implementation of hook_schema().
64 */
65 function color_schema() {
66 $schema['color'] = array(
67 'description' => t('Stores color theme information for Color-enabled themes'),
68 'fields' => array(
69 'name' => array(
70 'description' => t('The name of content being stored.'),
71 'type' => 'varchar',
72 'length' => 128,
73 'not null' => TRUE,
74 ),
75 'theme' => array(
76 'description' => t('The name of the theme.'),
77 'type' => 'varchar',
78 'length' => 128,
79 'not null' => TRUE,
80 ),
81 'value' => array(
82 'description' => t('The value of the variable.'),
83 'type' => 'text',
84 'not null' => TRUE,
85 'size' => 'big'
86 ),
87 ),
88 'indexes' => array(
89 'themeuid' => array('theme', 'name'),
90 ),
91 );
92
93 $schema['color_schemes'] = array(
94 'description' => t('Stores the actual color schemes'),
95 'fields' => array(
96 'id' => array(
97 'description' => t('ID of the scheme'),
98 'type' => 'serial',
99 'unsigned' => TRUE,
100 'not null' => TRUE
101 ),
102 'name' => array(
103 'description' => t('The name of scheme.'),
104 'type' => 'varchar',
105 'length' => 128,
106 'not null' => TRUE
107 ),
108 'theme' => array(
109 'description' => t('Name of theme this scheme is for.'),
110 'type' => 'varchar',
111 'length' => 128,
112 'not null' => TRUE
113 ),
114 'hex' => array(
115 'description' => t('Hex info'),
116 'type' => 'text',
117 'size' => 'big',
118 'not null' => TRUE,
119 ),
120 'extra_attr' => array(
121 'description' => t('Extra scheme info, such as location of generated files, if provided.'),
122 'type' => 'text',
123 'not null' => FALSE,
124 'size' => 'big'
125 ),
126 'status' => array(
127 'description' => t('0: unseen, 1: uid only, 2: site-wide'),
128 'type' => 'int',
129 'not null' => TRUE,
130 'default' => 0
131 ),
132 ),
133 'primary key' => array('id'),
134 'indexes' => array(
135 'themename' => array('theme', 'name'),
136 ),
137 );
138
139 $schema['color_users'] = array(
140 'description' => t('Users\'s scheme selection(s).'),
141 'fields' => array(
142 'uid' => array(
143 'description' => t('The {users}.uid that owns this color set; initially, this is the user that created it.'),
144 'type' => 'int',
145 'not null' => TRUE,
146 ),
147 'scheme_id' => array(
148 'description' => t('ID of the color scheme user has selected.'),
149 'type' => 'int',
150 'not null' => TRUE,
151 ),
152 ),
153 'primary key' => array('uid'),
154 );
155
156 return $schema;
157 }

  ViewVC Help
Powered by ViewVC 1.1.2