security update for entity_reference

This commit is contained in:
2018-04-21 00:03:39 +02:00
parent 85772b4ca7
commit 226561ffd4
18 changed files with 475 additions and 138 deletions

View File

@@ -41,6 +41,7 @@ function entityreference_field_schema($field) {
}
// Invoke the behaviors to allow them to change the schema.
module_load_include('module', 'entityreference');
foreach (entityreference_get_behavior_handlers($field) as $handler) {
$handler->schema_alter($schema, $field);
}
@@ -161,4 +162,29 @@ function entityreference_update_7002() {
'not null' => TRUE,
));
}
}
}
/**
* Implements hook_update_N().
*
* Remove duplicate rows in the taxonomy_index table.
*/
function entityreference_update_7100() {
if (db_table_exists('taxonomy_index')) {
if (db_table_exists('taxonomy_index_tmp')) {
db_drop_table('taxonomy_index_tmp');
}
$tx_schema = drupal_get_schema('taxonomy_index');
db_create_table('taxonomy_index_tmp', $tx_schema);
$select = db_select('taxonomy_index', 'tx');
$select->fields('tx', array('nid', 'tid'));
$select->groupBy('tx.nid');
$select->groupBy('tx.tid');
$select->addExpression('MAX(sticky)', 'sticky');
$select->addExpression('MAX(created)', 'created');
db_insert('taxonomy_index_tmp')->from($select)->execute();
db_drop_table('taxonomy_index');
db_rename_table('taxonomy_index_tmp', 'taxonomy_index');
}
}