| 1 |
<?php
|
| 2 |
/**
|
| 3 |
* $Id:$
|
| 4 |
* @package CCK_Taxonomy_SSU
|
| 5 |
* @category NeighborForge
|
| 6 |
*/
|
| 7 |
|
| 8 |
/**
|
| 9 |
* Don't know if I need this or not
|
| 10 |
*/
|
| 11 |
function cck_taxonomy_ssu_install() {
|
| 12 |
|
| 13 |
}
|
| 14 |
|
| 15 |
/**
|
| 16 |
* This is for modifying existing installs' cck-managed tables since cck can't seem to
|
| 17 |
* update tables from changes within the hook_field_settings()::database_columns.
|
| 18 |
*/
|
| 19 |
function cck_taxonomy_ssu_update_1() {
|
| 20 |
$ret = array();
|
| 21 |
include_once('./'. drupal_get_path('module', 'content') .'/content.module');
|
| 22 |
include_once('./'. drupal_get_path('module', 'content') .'/content_admin.inc');
|
| 23 |
|
| 24 |
content_clear_type_cache();
|
| 25 |
$fields = content_fields();
|
| 26 |
|
| 27 |
foreach ($fields as $field) {
|
| 28 |
switch ($field['type']) {
|
| 29 |
case 'cck_taxonomy_ssu':
|
| 30 |
$db_info = content_database_info($field);
|
| 31 |
$column = $db_info['table']. '_choice';
|
| 32 |
$pos = strpos($column, '_');
|
| 33 |
$column = substr($column, $pos+1);
|
| 34 |
$length = 40;
|
| 35 |
$type = 'varchar(' .$length. ')';
|
| 36 |
$not_null = FALSE;
|
| 37 |
$sortable = TRUE;
|
| 38 |
content_db_add_column($db_info['table'], $column, $type, array($not_null, $sortable));
|
| 39 |
$ret[] = array(
|
| 40 |
'query' => strtr('The field %field_name has been updated in several respects.', array('%field_name' => $field['field_name'])),
|
| 41 |
'success' => TRUE
|
| 42 |
);
|
| 43 |
break;
|
| 44 |
}
|
| 45 |
}
|
| 46 |
return $ret;
|
| 47 |
}
|