View source
<?php
function entity_translation_hierarchy_update_dependencies() {
$dependencies = array();
$dependencies['entity_translation_hierarchy'][7002] = array(
'entity_translation' => 7006,
);
return $dependencies;
}
function entity_translation_hierarchy_schema_alter(&$schema) {
$schema['entity_translation']['fields']['blocking'] = array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Flag to mark the translation as blocking.',
);
$schema['entity_translation_revision']['fields']['blocking'] = array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Flag to mark the translation as blocking.',
);
}
function entity_translation_hierarchy_install() {
db_add_field('entity_translation', 'blocking', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Flag to mark the translation as blocking.',
));
db_add_field('entity_translation_revision', 'blocking', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Flag to mark the translation as blocking.',
));
db_update('system')
->fields(array(
'weight' => 12,
))
->condition('name', 'entity_translation_hierarchy')
->execute();
}
function entity_translation_hierarchy_uninstall() {
db_drop_field('entity_translation', 'blocking');
db_drop_field('entity_translation_revision', 'blocking');
}
function entity_translation_hierarchy_update_7001() {
db_add_field('entity_translation', 'blocking', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Flag to mark the translation as blocking.',
));
db_update('system')
->fields(array(
'weight' => 12,
))
->condition('name', 'entity_translation_hierarchy')
->execute();
$result = db_query("SELECT entity_id, language FROM {entity_translation_hierarchy} WHERE blocking = 1");
foreach ($result as $translation) {
db_update('entity_translation')
->fields(array(
'blocking' => 1,
))
->condition('entity_id', $translation->entity_id)
->condition('language', $translation->language)
->execute();
}
db_drop_table('entity_translation_hierarchy');
}
function entity_translation_hierarchy_update_7002() {
db_add_field('entity_translation_revision', 'blocking', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Flag to mark the translation as blocking.',
));
}