Mercurial > defr > drupal > ad
comparison ad.install @ 1:948362c2a207 ad
update advertisement
author | pierre |
---|---|
date | Thu, 02 Apr 2009 15:28:21 +0000 |
parents | d8a3998dac8e |
children | e5584a19768b |
comparison
equal
deleted
inserted
replaced
0:d8a3998dac8e | 1:948362c2a207 |
---|---|
1 <?php | 1 <?php |
2 // $Id: ad.install,v 1.2.2.4.2.27.2.7 2009/02/17 18:56:25 jeremy Exp $ | 2 // $Id: ad.install,v 1.2.2.4.2.27.2.7.2.3 2009/03/27 20:11:13 jeremy Exp $ |
3 | 3 |
4 /** | 4 /** |
5 * @file | 5 * @file |
6 * Advertisement module database schema. | 6 * Advertisement module database schema. |
7 * | 7 * |
282 'hostid' => array('hostid'), | 282 'hostid' => array('hostid'), |
283 'url' => array('url'), | 283 'url' => array('url'), |
284 ), | 284 ), |
285 ); | 285 ); |
286 | 286 |
287 /** | |
288 * The ad_hosts table is used to configure users that can display ads | |
289 * remotely. | |
290 */ | |
291 $schema['ad_hosts'] = array( | |
292 'description' => 'The ad_hosts table is used to configure users that can display ads remotely. ', | |
293 'fields' => array( | |
294 'uid' => array( | |
295 'type' => 'int', | |
296 'not null' => TRUE, | |
297 'unsigned' => TRUE, | |
298 'default' => 0, | |
299 'description' => '', | |
300 ), | |
301 'hostid' => array( | |
302 'type' => 'varchar', | |
303 'length' => 32, | |
304 'not null' => TRUE, | |
305 'default' => '', | |
306 'description' => 'Host from which acion was made.', | |
307 ), | |
308 'status' => array( | |
309 'type' => 'int', | |
310 'size' => 'tiny', | |
311 'not null' => TRUE, | |
312 'unsigned' => TRUE, | |
313 'default' => 0, | |
314 'description' => '', | |
315 ), | |
316 'description' => array( | |
317 'type' => 'text', | |
318 'not null' => FALSE, | |
319 'description' => 'Host from which acion was made.', | |
320 ), | |
321 ), | |
322 'primary key' => array('uid'), | |
323 'indexes' => array( | |
324 'status' => array('status'), | |
325 'hostid' => array('hostid'), | |
326 ), | |
327 ); | |
328 | |
329 return $schema; | 287 return $schema; |
330 } | 288 } |
331 | 289 |
332 /** | 290 /** |
333 * Ad module installation. | 291 * Ad module installation. |
339 | 297 |
340 /** | 298 /** |
341 * Allow complete uninstallation of the ad module. | 299 * Allow complete uninstallation of the ad module. |
342 */ | 300 */ |
343 function ad_uninstall() { | 301 function ad_uninstall() { |
344 // Remove tables. | |
345 drupal_uninstall_schema('ad'); | |
346 | |
347 // Delete all ad content. | 302 // Delete all ad content. |
348 $result = db_query("SELECT nid FROM {node} WHERE type = 'ad'"); | 303 $result = db_query("SELECT nid FROM {node} WHERE type = 'ad'"); |
349 while ($node = db_fetch_object($result)) { | 304 while ($node = db_fetch_object($result)) { |
350 node_delete($node->nid); | 305 node_delete($node->nid); |
351 variable_del("ad_autoactivate_warning_$node->nid"); | 306 variable_del("ad_autoactivate_warning_$node->nid"); |
355 $variables = array('ad_cron_timestamp', 'ad_link_target', 'ad_cache', 'ad_cache_file', 'adserve', 'ad_group_vid', 'ad_groups', 'ad_validate_url', 'ad_display'); | 310 $variables = array('ad_cron_timestamp', 'ad_link_target', 'ad_cache', 'ad_cache_file', 'adserve', 'ad_group_vid', 'ad_groups', 'ad_validate_url', 'ad_display'); |
356 foreach ($variables as $variable) { | 311 foreach ($variables as $variable) { |
357 variable_del($variable); | 312 variable_del($variable); |
358 } | 313 } |
359 db_query("DELETE FROM {variable} WHERE name LIKE 'ad_block_quantity_%'"); | 314 db_query("DELETE FROM {variable} WHERE name LIKE 'ad_block_quantity_%'"); |
315 | |
316 // Remove tables. | |
317 drupal_uninstall_schema('ad'); | |
360 } | 318 } |
361 | 319 |
362 /** | 320 /** |
363 * Convert some things from absolete dev. schema to new schema API | 321 * Convert some things from absolete dev. schema to new schema API |
364 */ | 322 */ |
441 */ | 399 */ |
442 function ad_update_6003() { | 400 function ad_update_6003() { |
443 drupal_flush_all_caches(); | 401 drupal_flush_all_caches(); |
444 return array(); | 402 return array(); |
445 } | 403 } |
404 | |
405 /** | |
406 * Introduce "extra" field for ad statistics and clicks, optionally allowing | |
407 * add-on modules to provide additional granularity. | |
408 */ | |
409 function ad_update_6004() { | |
410 $ret = array(); | |
411 db_add_field($ret, 'ad_statistics', 'extra', | |
412 array( | |
413 'type' => 'varchar', | |
414 'length' => 255, | |
415 'not null' => TRUE, | |
416 'default' => '', | |
417 'description' => 'Alow add-on modules to provide additional statistics granularity.', | |
418 ), | |
419 array('indexes' => array( | |
420 'extra' => array('extra')) | |
421 )); | |
422 db_add_field($ret, 'ad_clicks', 'extra', | |
423 array( | |
424 'type' => 'varchar', | |
425 'length' => 255, | |
426 'not null' => TRUE, | |
427 'default' => '', | |
428 'description' => 'Alow add-on modules to provide additional statistics granularity.', | |
429 ), | |
430 array('indexes' => array( | |
431 'extra' => array('extra')) | |
432 )); | |
433 return $ret; | |
434 } | |
435 | |
436 /** | |
437 * Flush all caches for AHAH ad type switcher to work. | |
438 */ | |
439 function ad_update_6005() { | |
440 drupal_flush_all_caches(); | |
441 return array(); | |
442 } | |
443 |