| 1 |
<?php
|
| 2 |
// $Id: pingback.install,v 1.0.0.1 2007/07/26 23:17:13 dww Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Install, update, and uninstall functions for Pingback.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_schema().
|
| 11 |
*/
|
| 12 |
function pingback_schema() {
|
| 13 |
$schema['pingback_sent'] = array(
|
| 14 |
'description' => t('Table for pingbacks that have been sent.'),
|
| 15 |
'fields' => array(
|
| 16 |
'nid' => array(
|
| 17 |
'description' => t('NID pingback was sent from.'),
|
| 18 |
'type' => 'int',
|
| 19 |
'unsigned' => TRUE,
|
| 20 |
'not null' => TRUE,
|
| 21 |
'default' => 0,
|
| 22 |
),
|
| 23 |
'url' => array(
|
| 24 |
'description' => t('URL pingback was sent to.'),
|
| 25 |
'type' => 'varchar',
|
| 26 |
'length' => 255,
|
| 27 |
'not null' => TRUE,
|
| 28 |
'default' => '',
|
| 29 |
),
|
| 30 |
'timestamp' => array(
|
| 31 |
'description' => t('Time when pingback was sent.'),
|
| 32 |
'type' => 'int',
|
| 33 |
'unsigned' => FALSE,
|
| 34 |
'not null' => TRUE,
|
| 35 |
'default' => 0,
|
| 36 |
),
|
| 37 |
),
|
| 38 |
'primary key' => array('nid', 'url'),
|
| 39 |
);
|
| 40 |
return $schema;
|
| 41 |
}
|
| 42 |
|
| 43 |
/**
|
| 44 |
* Implementation of hook_install().
|
| 45 |
*/
|
| 46 |
function pingback_install() {
|
| 47 |
drupal_install_schema('pingback');
|
| 48 |
|
| 49 |
// if scheduler is installed, set pingback to run after it in cron runs
|
| 50 |
$weight = (int)db_result(db_query("SELECT weight FROM {system} WHERE name = 'scheduler'"));
|
| 51 |
db_query("UPDATE {system} SET weight = %d WHERE name = 'pingback'", $weight + 10);
|
| 52 |
}
|
| 53 |
|
| 54 |
/**
|
| 55 |
* Implementation of hook_uninstall().
|
| 56 |
*/
|
| 57 |
function pingback_uninstall() {
|
| 58 |
drupal_uninstall_schema('pingback');
|
| 59 |
|
| 60 |
// Clear any variables that might be in use
|
| 61 |
$variables = array(
|
| 62 |
'pingback_input_format',
|
| 63 |
'pingback_hide_format_for_anon',
|
| 64 |
'pingback_receive',
|
| 65 |
'pingback_mode',
|
| 66 |
'pingback_check_per_cron',
|
| 67 |
'pingback_notify_successful_pings',
|
| 68 |
);
|
| 69 |
foreach ($variables as $variable) {
|
| 70 |
variable_del($variable);
|
| 71 |
}
|
| 72 |
}
|