Mercurial > defr > drupal > ad
comparison notify/ad_notify.install @ 1:948362c2a207 ad
update advertisement
author | pierre |
---|---|
date | Thu, 02 Apr 2009 15:28:21 +0000 |
parents | d8a3998dac8e |
children |
comparison
equal
deleted
inserted
replaced
0:d8a3998dac8e | 1:948362c2a207 |
---|---|
1 <?php | 1 <?php |
2 // $Id: ad_notify.install,v 1.1.2.2.2.6.2.3 2009/02/16 17:06:49 jeremy Exp $ | 2 // $Id: ad_notify.install,v 1.1.2.2.2.6.2.3.2.3 2009/03/29 20:17:21 jeremy Exp $ |
3 | 3 |
4 /** | 4 /** |
5 * @file | 5 * @file |
6 * Ad_notify module database schema. | 6 * Ad_notify module database schema. |
7 * | 7 * |
95 ), | 95 ), |
96 'body' => array( | 96 'body' => array( |
97 'type' => 'text', | 97 'type' => 'text', |
98 'not null' => FALSE, | 98 'not null' => FALSE, |
99 ), | 99 ), |
100 'roles' => array( | |
101 'type' => 'varchar', | |
102 'length' => '255', | |
103 'not null' => TRUE, | |
104 'default' => '', | |
105 ), | |
106 'template' => array( | |
107 'type' => 'int', | |
108 'unsigned' => TRUE, | |
109 'not null' => TRUE, | |
110 'default' => 0, | |
111 ), | |
100 ), | 112 ), |
101 'primary key' => array('notid'), | 113 'primary key' => array('notid'), |
102 'unique keys' => array( | 114 'unique keys' => array( |
103 'oid' => array('oid', 'event', 'delay'), | 115 'oid' => array('oid', 'event', 'delay'), |
104 ), | 116 ), |
120 */ | 132 */ |
121 function ad_notify_install() { | 133 function ad_notify_install() { |
122 drupal_install_schema('ad_notify'); | 134 drupal_install_schema('ad_notify'); |
123 } | 135 } |
124 | 136 |
125 | |
126 /** | 137 /** |
127 * Allow complete uninstallation of the ad_notify module. | 138 * Allow complete uninstallation of the ad_notify module. |
128 */ | 139 */ |
129 function ad_notify_uninstall() { | 140 function ad_notify_uninstall() { |
130 // Remove tables. | 141 // Remove tables. |
131 drupal_uninstall_schema('ad_notify'); | 142 drupal_uninstall_schema('ad_notify'); |
132 } | 143 } |
144 | |
145 /** | |
146 * Introduce new roles field to allow per-role notifications. | |
147 * Replace nonstandard %sitename with standard %site-name. | |
148 * Replace nonstandard %siteurl with standard %site-url. | |
149 */ | |
150 function ad_notify_update_6001() { | |
151 $ret = array(); | |
152 db_add_field($ret, 'ad_notify', 'roles', array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '')); | |
153 | |
154 $ret[] = update_sql('UPDATE {ad_notify} SET subject = REPLACE(subject, "%sitename", "%site-name")'); | |
155 $ret[] = update_sql('UPDATE {ad_notify} SET body = REPLACE(body, "%siteurl", "%site-url")'); | |
156 | |
157 } | |
158 | |
159 /** | |
160 * Introduce new template field. | |
161 */ | |
162 function ad_notify_update_6002() { | |
163 $ret = array(); | |
164 db_add_field($ret, 'ad_notify', 'template', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); | |
165 return $ret; | |
166 } | |
167 | |
168 /** | |
169 * Replace nonstandard %sitename with standard %site-name. | |
170 * Replace nonstandard %siteurl with standard %site-url. | |
171 * (Repeating update_6001 as there were more instances of these old variables | |
172 * in the code.) | |
173 */ | |
174 function ad_notify_update_6003() { | |
175 $ret = array(); | |
176 $ret[] = update_sql('UPDATE {ad_notify} SET subject = REPLACE(subject, "%%sitename", "%%site-name")'); | |
177 $ret[] = update_sql('UPDATE {ad_notify} SET body = REPLACE(body, "%%sitename", "%%site-name")'); | |
178 $ret[] = update_sql('UPDATE {ad_notify} SET body = REPLACE(body, "%%max_views", "%%max_impressions")'); | |
179 $ret[] = update_sql('UPDATE {ad_notify} SET body = REPLACE(body, "%%global_views", "%%global_impressions")'); | |
180 $ret[] = update_sql('UPDATE {ad_notify} SET body = REPLACE(body, "%%last_year_views", "%%last_year_impressions")'); | |
181 $ret[] = update_sql('UPDATE {ad_notify} SET body = REPLACE(body, "%%this_year_views", "%%this_year_impressions")'); | |
182 $ret[] = update_sql('UPDATE {ad_notify} SET body = REPLACE(body, "%%last_month_views", "%%last_month_impressions")'); | |
183 $ret[] = update_sql('UPDATE {ad_notify} SET body = REPLACE(body, "%%this_month_views", "%%this_month_impressions")'); | |
184 $ret[] = update_sql('UPDATE {ad_notify} SET body = REPLACE(body, "%%yesterday_views", "%%yesterday_impressions")'); | |
185 $ret[] = update_sql('UPDATE {ad_notify} SET body = REPLACE(body, "%%today_views", "%%today_impressions")'); | |
186 $ret[] = update_sql('UPDATE {ad_notify} SET body = REPLACE(body, "%%last_hour_views", "%%last_hour_impressions")'); | |
187 $ret[] = update_sql('UPDATE {ad_notify} SET body = REPLACE(body, "%%this_hour_views", "%%this_hour_impressions")'); | |
188 return $ret; | |
189 } | |
190 |