| 1 |
<?php
|
| 2 |
// $Id: rsvp_dateconnector.install,v 1.1.2.3 2008/12/29 21:09:35 ulf1 Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function rsvp_dateconnector_install() {
|
| 8 |
|
| 9 |
// check the rsvp module weight:
|
| 10 |
$rsvp_weight = db_result(db_query("SELECT weight FROM {system} WHERE name = 'rsvp'"));
|
| 11 |
// make rsvp_dateconnector execute after rsvp:
|
| 12 |
db_query("UPDATE {system} SET weight = %d+1 WHERE name = 'rsvp_dateconnector'", $rsvp_weight);
|
| 13 |
|
| 14 |
}
|
| 15 |
|
| 16 |
/**
|
| 17 |
* Implementation of hook_uninstall().
|
| 18 |
*/
|
| 19 |
function rsvp_dateconnector_uninstall() {
|
| 20 |
|
| 21 |
if (drupal_get_schema('rsvp') != false)
|
| 22 |
db_query('DELETE FROM {rsvp}');
|
| 23 |
|
| 24 |
if (drupal_get_schema('rsvp_invite') != false)
|
| 25 |
db_query('DELETE FROM {rsvp_invite}');
|
| 26 |
|
| 27 |
variable_del('rsvp_content_types');
|
| 28 |
|
| 29 |
$connector = variable_get('rsvp_connector', NULL);
|
| 30 |
//This disable func is being called preventive even if other modules are being modified.
|
| 31 |
//Delete variable only if we set it.
|
| 32 |
if (isset($connector) && $connector == 'date' ) {
|
| 33 |
variable_del('rsvp_connector');
|
| 34 |
}
|
| 35 |
|
| 36 |
}
|
| 37 |
|
| 38 |
/**
|
| 39 |
* Implementation of hook_enable().
|
| 40 |
*/
|
| 41 |
function rsvp_dateconnector_enable() {
|
| 42 |
|
| 43 |
$connector = variable_get('rsvp_connector', NULL);
|
| 44 |
if (isset($connector) && $connector != 'date' ) {
|
| 45 |
drupal_set_message(t('RSVP date connector: It is not permitted to enable multiple RSVP connectors. RSVP connector %conn already enabled. Disable and uninstall other connector first. Then enable this connector again.', array('%conn' => $connector)), 'error');
|
| 46 |
}
|
| 47 |
else {
|
| 48 |
variable_set('rsvp_connector', 'date');
|
| 49 |
}
|
| 50 |
}
|
| 51 |
|
| 52 |
/**
|
| 53 |
* Implementation of hook_disable().
|
| 54 |
*/
|
| 55 |
function rsvp_dateconnector_disable() {
|
| 56 |
$connector = variable_get('rsvp_connector', NULL);
|
| 57 |
//This disable func is being called preventive even if other modules are being modified.
|
| 58 |
//Delete variable only if we set it.
|
| 59 |
if (isset($connector) && $connector == 'date' ) {
|
| 60 |
variable_del('rsvp_connector');
|
| 61 |
}
|
| 62 |
}
|