| 1 |
<?php
|
| 2 |
// $Id:$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function site_network_install() {
|
| 8 |
// Create tables.
|
| 9 |
if (!db_table_exists('client') && !db_table_exists('client_system')) {
|
| 10 |
drupal_install_schema('site_network');
|
| 11 |
}
|
| 12 |
}
|
| 13 |
|
| 14 |
/**
|
| 15 |
* Implementation of hook_uninstall().
|
| 16 |
*/
|
| 17 |
function site_network_uninstall() {
|
| 18 |
// Remove tables.
|
| 19 |
drupal_uninstall_schema('site_network');
|
| 20 |
|
| 21 |
variable_del('drupal_authentication_service');
|
| 22 |
variable_del('drupal_directory');
|
| 23 |
variable_del('drupal_register');
|
| 24 |
variable_del('drupal_server');
|
| 25 |
variable_del('drupal_system');
|
| 26 |
variable_del('drupal_statistics');
|
| 27 |
variable_del('drupal_client_service');
|
| 28 |
variable_del('drupal_default_da_server');
|
| 29 |
variable_del('drupal_default_da_server_only');
|
| 30 |
}
|
| 31 |
|
| 32 |
/**
|
| 33 |
* Implementation of hook_schema().
|
| 34 |
*/
|
| 35 |
function site_network_schema() {
|
| 36 |
$schema['client'] = array(
|
| 37 |
'fields' => array(
|
| 38 |
'cid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
|
| 39 |
'link' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
|
| 40 |
'name' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
|
| 41 |
'mail' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
|
| 42 |
'slogan' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
|
| 43 |
'mission' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
|
| 44 |
'users' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
|
| 45 |
'nodes' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
|
| 46 |
'version' => array('type' => 'varchar', 'length' => 35, 'not null' => TRUE, 'default' => ''),
|
| 47 |
'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
|
| 48 |
'changed' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
|
| 49 |
),
|
| 50 |
'primary key' => array('cid'),
|
| 51 |
);
|
| 52 |
|
| 53 |
$schema['client_system'] = array(
|
| 54 |
'fields' => array(
|
| 55 |
'cid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
|
| 56 |
'name' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
|
| 57 |
'type' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '')
|
| 58 |
),
|
| 59 |
'primary key' => array('cid', 'name'),
|
| 60 |
);
|
| 61 |
|
| 62 |
return $schema;
|
| 63 |
}
|
| 64 |
|
| 65 |
function site_network_update_1() {
|
| 66 |
variable_set('site_network_authentication_service', variable_get('drupal_authentication_service', FALSE));
|
| 67 |
variable_set('site_network_directory', variable_get('drupal_directory', FALSE));
|
| 68 |
variable_set('site_network_register', variable_get('drupal_register', 0));
|
| 69 |
variable_set('site_network_server', variable_get('drupal_server', 0));
|
| 70 |
variable_set('site_network_system', variable_get('drupal_system', 0));
|
| 71 |
variable_set('site_network_statistics', variable_get('drupal_statistics', 0));
|
| 72 |
variable_set('site_network_client_service', variable_get('drupal_client_service', 0));
|
| 73 |
variable_set('site_network_default_da_server', variable_get('drupal_default_da_server', ''));
|
| 74 |
variable_set('site_network_default_da_server_only', variable_get('drupal_default_da_server_only', 0));
|
| 75 |
|
| 76 |
variable_del('drupal_authentication_service');
|
| 77 |
variable_del('drupal_directory');
|
| 78 |
variable_del('drupal_register');
|
| 79 |
variable_del('drupal_server');
|
| 80 |
variable_del('drupal_system');
|
| 81 |
variable_del('drupal_statistics');
|
| 82 |
variable_del('drupal_client_service');
|
| 83 |
variable_del('drupal_default_da_server');
|
| 84 |
variable_del('drupal_default_da_server_only');
|
| 85 |
|
| 86 |
return array(0 => array('success' => TRUE, 'query' => t('Site Network variables renamed ok.')));
|
| 87 |
}
|
| 88 |
|