updated core to 7.80
This commit is contained in:
@@ -6,7 +6,7 @@ files[] = field_test.entity.inc
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2019-05-08
|
||||
version = "7.67"
|
||||
; Information added by Drupal.org packaging script on 2021-04-21
|
||||
version = "7.80"
|
||||
project = "drupal"
|
||||
datestamp = "1557336079"
|
||||
datestamp = "1619021862"
|
||||
|
@@ -240,111 +240,6 @@ function field_test_field_storage_delete_revision($entity_type, $entity, $fields
|
||||
_field_test_storage_data($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_field_storage_query().
|
||||
*/
|
||||
function field_test_field_storage_query($field_id, $conditions, $count, &$cursor = NULL, $age) {
|
||||
$data = _field_test_storage_data();
|
||||
|
||||
$load_current = $age == FIELD_LOAD_CURRENT;
|
||||
|
||||
$field = field_info_field_by_id($field_id);
|
||||
$field_columns = array_keys($field['columns']);
|
||||
|
||||
$field_data = $data[$field['id']];
|
||||
$sub_table = $load_current ? 'current' : 'revisions';
|
||||
// We need to sort records by entity type and entity id.
|
||||
usort($field_data[$sub_table], '_field_test_field_storage_query_sort_helper');
|
||||
|
||||
// Initialize results array.
|
||||
$return = array();
|
||||
$entity_count = 0;
|
||||
$rows_count = 0;
|
||||
$rows_total = count($field_data[$sub_table]);
|
||||
$skip = $cursor;
|
||||
$skipped = 0;
|
||||
|
||||
foreach ($field_data[$sub_table] as $row) {
|
||||
if ($count != FIELD_QUERY_NO_LIMIT && $entity_count >= $count) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($row->field_id == $field['id']) {
|
||||
$match = TRUE;
|
||||
$condition_deleted = FALSE;
|
||||
// Add conditions.
|
||||
foreach ($conditions as $condition) {
|
||||
@list($column, $value, $operator) = $condition;
|
||||
if (empty($operator)) {
|
||||
$operator = is_array($value) ? 'IN' : '=';
|
||||
}
|
||||
switch ($operator) {
|
||||
case '=':
|
||||
$match = $match && $row->{$column} == $value;
|
||||
break;
|
||||
case '<>':
|
||||
case '<':
|
||||
case '<=':
|
||||
case '>':
|
||||
case '>=':
|
||||
eval('$match = $match && ' . $row->{$column} . ' ' . $operator . ' '. $value);
|
||||
break;
|
||||
case 'IN':
|
||||
$match = $match && in_array($row->{$column}, $value);
|
||||
break;
|
||||
case 'NOT IN':
|
||||
$match = $match && !in_array($row->{$column}, $value);
|
||||
break;
|
||||
case 'BETWEEN':
|
||||
$match = $match && $row->{$column} >= $value[0] && $row->{$column} <= $value[1];
|
||||
break;
|
||||
case 'STARTS_WITH':
|
||||
case 'ENDS_WITH':
|
||||
case 'CONTAINS':
|
||||
// Not supported.
|
||||
$match = FALSE;
|
||||
break;
|
||||
}
|
||||
// Track condition on 'deleted'.
|
||||
if ($column == 'deleted') {
|
||||
$condition_deleted = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Exclude deleted data unless we have a condition on it.
|
||||
if (!$condition_deleted && $row->deleted) {
|
||||
$match = FALSE;
|
||||
}
|
||||
|
||||
if ($match) {
|
||||
if (!isset($skip) || $skipped >= $skip) {
|
||||
$cursor++;
|
||||
// If querying all revisions and the entity type has revisions, we need
|
||||
// to key the results by revision_ids.
|
||||
$entity_type = entity_get_info($row->type);
|
||||
$id = ($load_current || empty($entity_type['entity keys']['revision'])) ? $row->entity_id : $row->revision_id;
|
||||
|
||||
if (!isset($return[$row->type][$id])) {
|
||||
$return[$row->type][$id] = entity_create_stub_entity($row->type, array($row->entity_id, $row->revision_id, $row->bundle));
|
||||
$entity_count++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$skipped++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$rows_count++;
|
||||
|
||||
// The query is complete if we walked the whole array.
|
||||
if ($count != FIELD_QUERY_NO_LIMIT && $rows_count >= $rows_total) {
|
||||
$cursor = FIELD_QUERY_COMPLETE;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort helper for field_test_field_storage_query().
|
||||
*
|
||||
@@ -455,13 +350,13 @@ function field_test_field_attach_rename_bundle($bundle_old, $bundle_new) {
|
||||
function field_test_field_attach_delete_bundle($entity_type, $bundle, $instances) {
|
||||
$data = _field_test_storage_data();
|
||||
|
||||
foreach ($instances as $field_name => $instance) {
|
||||
$field = field_info_field($field_name);
|
||||
foreach ($instances as $instance) {
|
||||
$field = field_info_field_by_id($instance['field_id']);
|
||||
if ($field['storage']['type'] == 'field_test_storage') {
|
||||
$field_data = &$data[$field['id']];
|
||||
foreach (array('current', 'revisions') as $sub_table) {
|
||||
foreach ($field_data[$sub_table] as &$row) {
|
||||
if ($row->bundle == $bundle_old) {
|
||||
if ($row->bundle == $bundle) {
|
||||
$row->deleted = TRUE;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user