View source
<?php
function language_hierarchy_schema_alter(&$schema) {
$schema['languages']['fields']['parent'] = array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => 'Code of parent language.',
);
}
function language_hierarchy_install() {
db_add_field('languages', 'parent', array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => 'Code of parent language.',
));
drupal_static_reset('language_list');
db_query("UPDATE {system} SET weight = -901 WHERE name = 'language_hierarchy' AND type = 'module'");
}
function language_hierarchy_uninstall() {
db_drop_field('languages', 'parent');
drupal_static_reset('language_list');
}
function language_hierarchy_update_7001() {
db_query("UPDATE {system} SET weight = -901 WHERE name = 'language_hierarchy' AND type = 'module'");
}
function language_hierarchy_update_7100() {
db_update('languages')
->fields(array(
'parent' => '',
))
->condition('parent', NULL)
->execute();
db_update('languages')
->fields(array(
'parent' => '',
))
->condition('parent', 0)
->execute();
$spec = array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => 'Code of parent language.',
);
db_change_field('languages', 'parent', 'parent', $spec);
}