| 1 |
<?php
|
| 2 |
// $Id: wlw_blogapi.install,v 1.4 2008/10/16 19:11:16 jrglasgow Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
*
|
| 7 |
* install and uninstall functions for wlw_blogapi function
|
| 8 |
*/
|
| 9 |
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implementation of hook_install().
|
| 13 |
*/
|
| 14 |
function wlw_blogapi_install() {
|
| 15 |
// check to see if the blogapi module is installed,
|
| 16 |
// if so diasable it.
|
| 17 |
if (module_exists('blogapi')) {
|
| 18 |
module_disable(array('blogapi'));
|
| 19 |
drupal_set_message(t('WLW Blog API is not compatable with Blog API module. Blog API module has been disabled.'));
|
| 20 |
watchdog('wlw_blogapi', 'WLW Blog API is not compatable with Blog API module. Blog API module has been disabled.', array(), WATCHDOG_NOTICE);
|
| 21 |
}
|
| 22 |
drupal_install_schema('wlw_blogapi');
|
| 23 |
}
|
| 24 |
|
| 25 |
/**
|
| 26 |
* Implementation of hook_schema().
|
| 27 |
*/
|
| 28 |
function wlw_blogapi_schema() {
|
| 29 |
$schema = array();
|
| 30 |
$schema['wlw_blogapi_files'] = array(
|
| 31 |
'fields' => array(
|
| 32 |
'fid' => array('type' => 'serial', 'not null' => TRUE, 'disp-width' => '11'),
|
| 33 |
'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
|
| 34 |
'filepath' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''),
|
| 35 |
'filesize' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10')),
|
| 36 |
'primary key' => array('fid'),
|
| 37 |
'indexes' => array(
|
| 38 |
'uid' => array('uid')
|
| 39 |
),
|
| 40 |
);
|
| 41 |
return $schema;
|
| 42 |
}
|
| 43 |
|
| 44 |
/**
|
| 45 |
* Implementation of hook_uninstall().
|
| 46 |
*/
|
| 47 |
function wlw_blogapi_uninstall() {
|
| 48 |
// Remove table.
|
| 49 |
drupal_uninstall_schema('wlw_blogapi');
|
| 50 |
}
|
| 51 |
function wlw_blogapi_update_6002() {
|
| 52 |
$ret = array();
|
| 53 |
// copy the settings from the old menu setting to the new setting
|
| 54 |
$menu_setting = variable_get('wlw_blogapi_menu', 'none');
|
| 55 |
$node_types = array_map('check_plain', node_get_types('names'));
|
| 56 |
foreach ($node_types as $key => $value) {
|
| 57 |
variable_set('wlw_blogapi_menu_'. $key, $menu_setting);
|
| 58 |
}
|
| 59 |
// remove old menu setting
|
| 60 |
variable_del('wlw_blogapi_menu');
|
| 61 |
return $ret;
|
| 62 |
}
|