| 1 |
<?php |
<?php |
|
|
|
| 2 |
// $Id$ |
// $Id$ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 6 |
* install file |
* Epublish installation file. |
| 7 |
*/ |
*/ |
| 8 |
/* |
|
| 9 |
* Implementation of hook_install() |
/** |
| 10 |
* |
* Implementation of hook_install(). |
| 11 |
*/ |
*/ |
| 12 |
function epublish_install() { |
function epublish_install() { |
|
// Create tables. |
|
| 13 |
drupal_install_schema('epublish'); |
drupal_install_schema('epublish'); |
| 14 |
} |
} |
| 15 |
|
|
| 16 |
function epublish_schema() { |
/** |
| 17 |
|
* Implementation of hook_uninstall(). |
| 18 |
|
*/ |
| 19 |
|
function epublish_uninstall() { |
| 20 |
|
drupal_uninstall_schema('epublish'); |
| 21 |
|
} |
| 22 |
|
|
| 23 |
|
/** |
| 24 |
|
* Implementation of hook_schema(). |
| 25 |
|
*/ |
| 26 |
|
function epublish_schema() { |
| 27 |
$schema['epublish_publication'] = array( |
$schema['epublish_publication'] = array( |
| 28 |
'fields' => array( |
'fields' => array( |
| 29 |
'pid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'length' => 10), |
'pid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'length' => 10), |
| 122 |
), |
), |
| 123 |
); |
); |
| 124 |
|
|
| 125 |
// When upgrading from v5.x, these tables may already exist! |
return $schema; |
|
if (!db_table_exists('epublish_publication') || |
|
|
!db_table_exists('epublish_abstract') || |
|
|
!db_table_exists('epublish_edition') || |
|
|
!db_table_exists('epublish_edition_node') || |
|
|
!db_table_exists('epublish_section') || |
|
|
!db_table_exists('epublish_topic') || |
|
|
!db_table_exists('epublish_volume') ) { |
|
|
return $schema; |
|
|
} |
|
|
|
|
|
return array(); |
|
| 126 |
} |
} |
| 127 |
|
|
| 128 |
|
|
|
|
|
|
|
|
|
/** |
|
|
* Legacy update from Drupal 5.x version |
|
|
* |
|
|
*/ |
|
| 129 |
function epublish_update_1() { |
function epublish_update_1() { |
| 130 |
return _system_update_utf8(array('epublish_abstract', 'epublish_edition', 'epublish_edition_node', 'epublish_publication', 'epublish_section', 'epublish_topic', 'epublish_volume')); |
return _system_update_utf8(array('epublish_abstract', 'epublish_edition', 'epublish_edition_node', 'epublish_publication', 'epublish_section', 'epublish_topic', 'epublish_volume')); |
| 131 |
} |
} |
| 132 |
|
|
|
|
|
|
/** |
|
|
* Update for those coming from Drupal 5.x |
|
|
*/ |
|
|
|
|
|
function epublish_update_6000() { |
|
|
$ret = array(); |
|
|
db_drop_primary_key($ret, 'epublish_edition'); |
|
|
db_drop_index($ret, 'epublish_edition', 'pid'); |
|
|
db_change_field($ret, 'epublish_edition', 'eid', 'eid', array('type' => 'serial', 'not null' => TRUE), array('primary key' => array('eid'), 'indexes' => array('pid' => array('pid')))); |
|
|
|
|
|
db_drop_primary_key($ret, 'epublish_publication'); |
|
|
db_change_field($ret, 'epublish_publication', 'pid', 'pid', array('type' => 'serial', 'not null' => TRUE), array('primary key' => array('pid'))); |
|
|
|
|
|
db_drop_primary_key($ret, 'epublish_section'); |
|
|
db_change_field($ret, 'epublish_section', 'sid', 'sid', array('type' => 'serial', 'not null' => TRUE), array('primary key' => array('sid'))); |
|
|
|
|
|
return $ret; |
|
|
} |
|
|
|
|
|
|
|